issuance: Test only, cleanup revokedCertificatesFieldExists (#7510)

Two `//x/crypto/cryptobyte` `ReadASN1Element` calls were unneeded and
are now removed. In the original `//crypto/x509/parser.go` code, those
lines were used to populate fields in a struct, but we're operating on
raw bytes within this lint.
This commit is contained in:
Phil Porada 2024-05-29 16:49:47 -04:00 committed by GitHub
parent 14203c0dcf
commit ebc7dfb973
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 17 additions and 15 deletions

View File

@ -186,27 +186,29 @@ func TestIssueCRL(t *testing.T) {
//
// https://datatracker.ietf.org/doc/html/rfc5280#appendix-A.1 page 118
//
// TBSCertList ::= SEQUENCE {
// ..
// revokedCertificates SEQUENCE OF SEQUENCE {
// ..
// } OPTIONAL,
// }
// CertificateList ::= SEQUENCE {
// tbsCertList TBSCertList
// ..
// }
//
// TBSCertList ::= SEQUENCE {
// ..
// revokedCertificates SEQUENCE OF SEQUENCE {
// ..
// } OPTIONAL,
// }
func revokedCertificatesFieldExists(der []byte) (bool, error) {
input := cryptobyte.String(der)
if !input.ReadASN1Element(&input, cryptobyte_asn1.SEQUENCE) {
return false, errors.New("x509: malformed crl")
}
// Extract the CertificateList
if !input.ReadASN1(&input, cryptobyte_asn1.SEQUENCE) {
return false, errors.New("x509: malformed crl")
return false, errors.New("malformed crl")
}
var tbs cryptobyte.String
if !input.ReadASN1Element(&tbs, cryptobyte_asn1.SEQUENCE) {
return false, errors.New("x509: malformed tbs crl")
}
if !tbs.ReadASN1(&tbs, cryptobyte_asn1.SEQUENCE) {
return false, errors.New("x509: malformed tbs crl")
// Extract the TBSCertList from the CertificateList
if !input.ReadASN1(&tbs, cryptobyte_asn1.SEQUENCE) {
return false, errors.New("malformed tbs crl")
}
// Skip optional version