aboutsummaryrefslogtreecommitdiff
path: root/src/crypto
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2024-03-08 21:01:17 -0500
committerRuss Cox <rsc@golang.org>2024-03-09 14:19:39 +0000
commit74726defe99bb1e19cee35e27db697085f06fda1 (patch)
treed6ca72b6d2d17b99de1001e0a53082b1ab0ad9db /src/crypto
parent065c5d220e802e85d410a5e6adba0819ab71aeda (diff)
downloadgo-74726defe99bb1e19cee35e27db697085f06fda1.tar.gz
go-74726defe99bb1e19cee35e27db697085f06fda1.zip
internal/godebugs: test for use of IncNonDefault
A few recent godebugs are missing IncNonDefault uses. Test for that, so that people remember to do it. Filed bugs for the missing ones. For #66215. For #66216. For #66217. Change-Id: Ia3fd10fd108e1b003bb30a8bc2f83995c768fab6 Reviewed-on: https://go-review.googlesource.com/c/go/+/570275 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com>
Diffstat (limited to 'src/crypto')
-rw-r--r--src/crypto/x509/x509.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/crypto/x509/x509.go b/src/crypto/x509/x509.go
index f33283b559..636a345eef 100644
--- a/src/crypto/x509/x509.go
+++ b/src/crypto/x509/x509.go
@@ -1101,7 +1101,7 @@ func isIA5String(s string) error {
return nil
}
-var usePoliciesField = godebug.New("x509usepolicies")
+var x509usepolicies = godebug.New("x509usepolicies")
func buildCertExtensions(template *Certificate, subjectIsEmpty bool, authorityKeyId []byte, subjectKeyId []byte) (ret []pkix.Extension, err error) {
ret = make([]pkix.Extension, 10 /* maximum number of elements. */)
@@ -1188,7 +1188,7 @@ func buildCertExtensions(template *Certificate, subjectIsEmpty bool, authorityKe
n++
}
- usePolicies := usePoliciesField.Value() == "1"
+ usePolicies := x509usepolicies.Value() == "1"
if ((!usePolicies && len(template.PolicyIdentifiers) > 0) || (usePolicies && len(template.Policies) > 0)) &&
!oidInExtensions(oidExtensionCertificatePolicies, template.ExtraExtensions) {
ret[n], err = marshalCertificatePolicies(template.Policies, template.PolicyIdentifiers)
@@ -1381,8 +1381,8 @@ func marshalCertificatePolicies(policies []OID, policyIdentifiers []asn1.ObjectI
b := cryptobyte.NewBuilder(make([]byte, 0, 128))
b.AddASN1(cryptobyte_asn1.SEQUENCE, func(child *cryptobyte.Builder) {
- if usePoliciesField.Value() == "1" {
- usePoliciesField.IncNonDefault()
+ if x509usepolicies.Value() == "1" {
+ x509usepolicies.IncNonDefault()
for _, v := range policies {
child.AddASN1(cryptobyte_asn1.SEQUENCE, func(child *cryptobyte.Builder) {
child.AddASN1(cryptobyte_asn1.OBJECT_IDENTIFIER, func(child *cryptobyte.Builder) {