mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 03:10:48 +00:00
crypto: add hash length check in nocgo VerifySignature
This commit is contained in:
parent
ece2b19ac0
commit
08f938feb8
1 changed files with 1 additions and 1 deletions
|
|
@ -103,7 +103,7 @@ func Sign(hash []byte, prv *ecdsa.PrivateKey) ([]byte, error) {
|
|||
// The public key should be in compressed (33 bytes) or uncompressed (65 bytes) format.
|
||||
// The signature should have the 64 byte [R || S] format.
|
||||
func VerifySignature(pubkey, hash, signature []byte) bool {
|
||||
if len(signature) != 64 {
|
||||
if len(signature) != 64 || len(hash) != DigestLength {
|
||||
return false
|
||||
}
|
||||
var r, s secp256k1.ModNScalar
|
||||
|
|
|
|||
Loading…
Reference in a new issue