mirror of
https://github.com/golang/go
synced 2024-09-15 22:20:06 +00:00
crypto/x509: use fingerprint map for (*CertPool).contains
This fell through the cracks from the CL 229917 comments. Change-Id: I22584107f1e8111f9c523f45307dd50e1e5f4b8f Reviewed-on: https://go-review.googlesource.com/c/go/+/268339 Trust: Filippo Valsorda <filippo@golang.org> Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
f858c22127
commit
feccfb8ada
|
@ -161,18 +161,7 @@ func (s *CertPool) contains(cert *Certificate) bool {
|
|||
if s == nil {
|
||||
return false
|
||||
}
|
||||
candidates := s.byName[string(cert.RawSubject)]
|
||||
for _, i := range candidates {
|
||||
c, err := s.cert(i)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
if c.Equal(cert) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
return s.haveSum[sha256.Sum224(cert.Raw)]
|
||||
}
|
||||
|
||||
// AddCert adds a certificate to a pool.
|
||||
|
|
Loading…
Reference in a new issue