diff options
Diffstat (limited to 'src/crypto/hmac/hmac.go')
-rw-r--r-- | src/crypto/hmac/hmac.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/crypto/hmac/hmac.go b/src/crypto/hmac/hmac.go index 801ece67ae..d9f0bd24ea 100644 --- a/src/crypto/hmac/hmac.go +++ b/src/crypto/hmac/hmac.go @@ -22,6 +22,7 @@ timing side-channels: package hmac import ( + "crypto/internal/boring" "crypto/subtle" "hash" ) @@ -68,6 +69,13 @@ func (h *hmac) Reset() { // the returned Hash does not implement encoding.BinaryMarshaler // or encoding.BinaryUnmarshaler. func New(h func() hash.Hash, key []byte) hash.Hash { + if boring.Enabled { + hm := boring.NewHMAC(h, key) + if hm != nil { + return hm + } + // BoringCrypto did not recognize h, so fall through to standard Go code. + } hm := new(hmac) hm.outer = h() hm.inner = h() |