Skip to content

Commit ae25fa8

Browse files
committed
secp256k1proto: deserialize x-only-pk with from_bytes_xonly (schnorr_verify)
If the passed x-only-pubkey overflows (x >= p), this method fails immediately rather than silently wrapping around and then likely failing later (either because x % p is not on the curve or because the actual signature verification fails). For the user of `schnorr_verify` this shouldn't make any difference, as `False` is returned with both variants, so this is probably more of a cosmetic change.
1 parent dcdbd1f commit ae25fa8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python/secp256k1proto/bip340.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def schnorr_verify(
5656
if len(sig) != 64:
5757
raise ValueError("The signature must be a 64-byte array.")
5858
try:
59-
P = GE.lift_x(int_from_bytes(pubkey))
59+
P = GE.from_bytes_xonly(pubkey)
6060
except ValueError:
6161
return False
6262
r = int_from_bytes(sig[0:32])

0 commit comments

Comments
 (0)