Skip to content

Commit 9c5f919

Browse files
committed
fix: resolve comment for Shiwei
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
1 parent dc3a62e commit 9c5f919

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

revocation/crl/fetcher.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func (f *HTTPFetcher) fetch(ctx context.Context, url string) (*Bundle, error) {
142142
//
143143
// It returns errDeltaCRLNotFound if the delta CRL is not found.
144144
func (f *HTTPFetcher) fetchDeltaCRL(ctx context.Context, extensions []pkix.Extension) (*x509.RevocationList, error) {
145-
extension := x509util.FindExtensionByOID(oidFreshestCRL, extensions)
145+
extension := x509util.FindExtensionByOID(extensions, oidFreshestCRL)
146146
if extension == nil {
147147
return nil, errDeltaCRLNotFound
148148
}

revocation/internal/crl/crl.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,21 @@ import (
3030
"golang.org/x/crypto/cryptobyte"
3131
)
3232

33-
// RFC 5280, 5.3.1
34-
//
35-
// CRLReason ::= ENUMERATED {
36-
// unspecified (0),
37-
// keyCompromise (1),
38-
// cACompromise (2),
39-
// affiliationChanged (3),
40-
// superseded (4),
41-
// cessationOfOperation (5),
42-
// certificateHold (6),
43-
// -- value 7 is not used
44-
// removeFromCRL (8),
45-
// privilegeWithdrawn (9),
46-
// aACompromise (10) }
4733
const (
34+
// RFC 5280, 5.3.1
35+
//
36+
// CRLReason ::= ENUMERATED {
37+
// unspecified (0),
38+
// keyCompromise (1),
39+
// cACompromise (2),
40+
// affiliationChanged (3),
41+
// superseded (4),
42+
// cessationOfOperation (5),
43+
// certificateHold (6),
44+
// -- value 7 is not used
45+
// removeFromCRL (8),
46+
// privilegeWithdrawn (9),
47+
// aACompromise (10) }
4848
// certificateHold
4949
reasonCodeCertificateHold = 6
5050

@@ -118,7 +118,7 @@ func CertCheckStatus(ctx context.Context, cert, issuer *x509.Certificate, opts C
118118
serverResults = make([]*result.ServerResult, 0, len(cert.CRLDistributionPoints))
119119
lastErr error
120120
crlURL string
121-
hasFreshestCRLInCertificate = x509util.FindExtensionByOID(oidFreshestCRL, cert.Extensions) != nil
121+
hasFreshestCRLInCertificate = x509util.FindExtensionByOID(cert.Extensions, oidFreshestCRL) != nil
122122
)
123123

124124
// The CRLDistributionPoints contains the URIs of all the CRL distribution
@@ -221,7 +221,7 @@ func validate(bundle *crl.Bundle, issuer *x509.Certificate) error {
221221
}
222222

223223
// check delta CRL indicator extension
224-
extension := x509util.FindExtensionByOID(oidDeltaCRLIndicator, deltaCRL.Extensions)
224+
extension := x509util.FindExtensionByOID(deltaCRL.Extensions, oidDeltaCRLIndicator)
225225
if extension == nil {
226226
return errors.New("delta CRL indicator extension is not found")
227227
}

revocation/internal/x509util/extension.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
)
2121

2222
// FindExtensionByOID finds the extension by the given OID.
23-
func FindExtensionByOID(oid asn1.ObjectIdentifier, extensions []pkix.Extension) *pkix.Extension {
23+
func FindExtensionByOID(extensions []pkix.Extension, oid asn1.ObjectIdentifier) *pkix.Extension {
2424
idx := slices.IndexFunc(extensions, func(ext pkix.Extension) bool {
2525
return ext.Id.Equal(oid)
2626
})

revocation/internal/x509util/extension_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func TestFindExtensionByOID(t *testing.T) {
4949

5050
for _, tt := range tests {
5151
t.Run(tt.name, func(t *testing.T) {
52-
result := FindExtensionByOID(tt.oid, tt.extensions)
52+
result := FindExtensionByOID(tt.extensions, tt.oid)
5353
if result != tt.expected {
5454
t.Errorf("expected %v, got %v", tt.expected, result)
5555
}

0 commit comments

Comments
 (0)