mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 19:00:46 +00:00
Merge cf8d06115d into dddbaa4bf3
This commit is contained in:
commit
399e31ce86
1 changed files with 3 additions and 3 deletions
|
|
@ -17,12 +17,12 @@
|
|||
package scwallet
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/aes"
|
||||
"crypto/cipher"
|
||||
"crypto/rand"
|
||||
"crypto/sha256"
|
||||
"crypto/sha512"
|
||||
"crypto/subtle"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
|
|
@ -101,7 +101,7 @@ func (s *SecureChannelSession) Pair(pairingPassword []byte) error {
|
|||
cardCryptogram := response.Data[:32]
|
||||
cardChallenge := response.Data[32:64]
|
||||
|
||||
if !bytes.Equal(expectedCryptogram, cardCryptogram) {
|
||||
if subtle.ConstantTimeCompare(expectedCryptogram, cardCryptogram) != 1 {
|
||||
return fmt.Errorf("invalid card cryptogram %v != %v", expectedCryptogram, cardCryptogram)
|
||||
}
|
||||
|
||||
|
|
@ -253,7 +253,7 @@ func (s *SecureChannelSession) transmitEncrypted(cla, ins, p1, p2 byte, data []b
|
|||
if err = s.updateIV(rmeta[:], rdata); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !bytes.Equal(s.iv, rmac) {
|
||||
if subtle.ConstantTimeCompare(s.iv, rmac) != 1 {
|
||||
return nil, errors.New("invalid MAC in response")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue