mirror of https://github.com/golang/go.git
crypto/x509: fix panic when using unavailable hash function.
crypto.Hash.New() changed to panicking when the hash function isn't linked in, but crypto/x509 still expects it to return nil. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/6175047
This commit is contained in:
parent
278d4a583d
commit
c8e1946f33
|
|
@ -388,10 +388,10 @@ func (c *Certificate) CheckSignature(algo SignatureAlgorithm, signed, signature
|
|||
return ErrUnsupportedAlgorithm
|
||||
}
|
||||
|
||||
h := hashType.New()
|
||||
if h == nil {
|
||||
if !hashType.Available() {
|
||||
return ErrUnsupportedAlgorithm
|
||||
}
|
||||
h := hashType.New()
|
||||
|
||||
h.Write(signed)
|
||||
digest := h.Sum(nil)
|
||||
|
|
|
|||
Loading…
Reference in New Issue