aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-11-06 08:08:25 +0100
committerMarcoFalke <falke.marco@gmail.com>2020-11-06 08:08:27 +0100
commitc51c2753a4ff34413f7369e9cf0282f64a5e38de (patch)
tree894ea49c1482a65fdd007ccba63868f57e27db04
parent65460c207c0b92122b8abf87495403d3a396da2b (diff)
parent568a1d72619371a45b14a8356d3f80bd0c0efabc (diff)
downloadbitcoin-c51c2753a4ff34413f7369e9cf0282f64a5e38de.tar.xz
Merge #20326: tests: Fix ecdsa_verify in test framework
568a1d72619371a45b14a8356d3f80bd0c0efabc fix ecdsa verify in test framework (Stepan Snigirev) Pull request description: This PR fixes a small bug in the test framework in `verify_ecdsa` function. `r` in ecdsa signature is modulo curve order, so if the point `R` calculated during verification has x-coordinate that is larger than the curve order, the verification will fail in the test framework but pass in libsecp256k1. Example (all in hex): public key: `0289d889551598a0263746c01e5882ccf9b7dc4ca5a37108482c9d80de40e0a8cf` der signature: `3006020104020104` (r = 4, s = 4) message: `3232323232323232323232323232323232323232323232323232323232323232` libsecp256k1 returns `true`, test framework returns `false`. ACKs for top commit: sipa: utACK 568a1d72619371a45b14a8356d3f80bd0c0efabc Tree-SHA512: 9e9c58498f10085d2ad85e95caff6c92793799d2a40696ef43febcd7d313c8c3d5ecec715ca903cbb8432a8a96bd0065d86d060966d4ee651c3871ce16c252bf
-rw-r--r--test/functional/test_framework/key.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/functional/test_framework/key.py b/test/functional/test_framework/key.py
index a6bc187985..abf2507154 100644
--- a/test/functional/test_framework/key.py
+++ b/test/functional/test_framework/key.py
@@ -322,7 +322,7 @@ class ECPubKey():
u1 = z*w % SECP256K1_ORDER
u2 = r*w % SECP256K1_ORDER
R = SECP256K1.affine(SECP256K1.mul([(SECP256K1_G, u1), (self.p, u2)]))
- if R is None or R[0] != r:
+ if R is None or (R[0] % SECP256K1_ORDER) != r:
return False
return True