mirror of
https://github.com/LBRYFoundation/lbcd.git
synced 2025-08-23 17:47:24 +00:00
Mitigate timing attacks while using btcec.Decrypt.
This commit is contained in:
parent
9d6d0e4006
commit
d9556df292
1 changed files with 1 additions and 1 deletions
|
@ -178,7 +178,7 @@ func Decrypt(priv *PrivateKey, in []byte) ([]byte, error) {
|
||||||
hm := hmac.New(sha256.New, keyM)
|
hm := hmac.New(sha256.New, keyM)
|
||||||
hm.Write(in[:len(in)-sha256.Size]) // everything is hashed
|
hm.Write(in[:len(in)-sha256.Size]) // everything is hashed
|
||||||
expectedMAC := hm.Sum(nil)
|
expectedMAC := hm.Sum(nil)
|
||||||
if !bytes.Equal(messageMAC, expectedMAC) {
|
if !hmac.Equal(messageMAC, expectedMAC) {
|
||||||
return nil, ErrInvalidMAC
|
return nil, ErrInvalidMAC
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue