Add missing test cases
(cherry picked from commit 91b12c0741676c33419e56bf098be7e2421fd408)
This commit is contained in:
parent
384dbd6c8b
commit
9b0bc8a525
|
@ -5444,5 +5444,26 @@
|
|||
"Gas": 3450,
|
||||
"Name": "wycheproof/ecdsa_webcrypto_test.json EcdsaP1363Verify SHA-256 #311: y-coordinate of the public key is large",
|
||||
"NoBenchmark": false
|
||||
},
|
||||
{
|
||||
"Input": "2f77668a9dfbf8d5848b9eeb4a7145ca94c6ed9236e4a773f6dcafa5132b2f9170bebe684cdcb5ca72a42f0d873879359bd1781a591809947628d313a3814f67aec03aca8f5587a4d535fa31027bbe9cc0e464b1c3577f4c2dcde6b2094798a90000000000000000000000000000000000000000000000000000000000000000fffffffeecad44b6f05d15b33146549c2297b522a5eed8430cff596758e6c43d",
|
||||
"Expected": "",
|
||||
"Gas": 3450,
|
||||
"Name": "invalid public key x param errors",
|
||||
"NoBenchmark": false
|
||||
},
|
||||
{
|
||||
"Input": "2f77668a9dfbf8d5848b9eeb4a7145ca94c6ed9236e4a773f6dcafa5132b2f9170bebe684cdcb5ca72a42f0d873879359bd1781a591809947628d313a3814f67aec03aca8f5587a4d535fa31027bbe9cc0e464b1c3577f4c2dcde6b2094798a9bcbb2914c79f045eaa6ecbbc612816b3be5d2d6796707d8125e9f851c18af0150000000000000000000000000000000000000000000000000000000000000000",
|
||||
"Expected": "",
|
||||
"Gas": 3450,
|
||||
"Name": "invalid public key y param errors",
|
||||
"NoBenchmark": false
|
||||
},
|
||||
{
|
||||
"Input": "2f77668a9dfbf8d5848b9eeb4a7145ca94c6ed9236e4a773f6dcafa5132b2f9170bebe684cdcb5ca72a42f0d873879359bd1781a591809947628d313a3814f67aec03aca8f5587a4d535fa31027bbe9cc0e464b1c3577f4c2dcde6b2094798a900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"Expected": "",
|
||||
"Gas": 3450,
|
||||
"Name": "reference point errors",
|
||||
"NoBenchmark": false
|
||||
}
|
||||
]
|
|
@ -6,7 +6,7 @@ import (
|
|||
"math/big"
|
||||
)
|
||||
|
||||
// Generates approptiate public key format from given coordinates
|
||||
// Generates appropriate public key format from given coordinates
|
||||
func newPublicKey(x, y *big.Int) *ecdsa.PublicKey {
|
||||
// Check if the given coordinates are valid
|
||||
if x == nil || y == nil || !elliptic.P256().IsOnCurve(x, y) {
|
||||
|
|
|
@ -5,7 +5,8 @@ import (
|
|||
"math/big"
|
||||
)
|
||||
|
||||
// Verifies the given signature (r, s) for the given hash and public key (x, y).
|
||||
// Verify verifies the given signature (r, s) for the given hash and public key (x, y).
|
||||
// It returns true if the signature is valid, false otherwise.
|
||||
func Verify(hash []byte, r, s, x, y *big.Int) bool {
|
||||
// Create the public key format
|
||||
publicKey := newPublicKey(x, y)
|
||||
|
|
Loading…
Reference in New Issue