From d9556df292458844ed1691e50d77cb1122a2990b Mon Sep 17 00:00:00 2001 From: Ishbir Singh Date: Mon, 25 May 2015 16:42:43 +0530 Subject: [PATCH] Mitigate timing attacks while using btcec.Decrypt. --- btcec/ciphering.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/btcec/ciphering.go b/btcec/ciphering.go index 959240b3..d1a6db2a 100644 --- a/btcec/ciphering.go +++ b/btcec/ciphering.go @@ -178,7 +178,7 @@ func Decrypt(priv *PrivateKey, in []byte) ([]byte, error) { hm := hmac.New(sha256.New, keyM) hm.Write(in[:len(in)-sha256.Size]) // everything is hashed expectedMAC := hm.Sum(nil) - if !bytes.Equal(messageMAC, expectedMAC) { + if !hmac.Equal(messageMAC, expectedMAC) { return nil, ErrInvalidMAC }