mirror of
https://github.com/bitcoin/bips.git
synced 2026-03-16 15:55:37 +00:00
Fix point_from_bytes accepting out-of-range pubkeys and add test vector
This commit is contained in:
@@ -53,6 +53,8 @@ def bytes_from_point(P):
|
||||
|
||||
def point_from_bytes(b):
|
||||
x = int_from_bytes(b)
|
||||
if x >= p:
|
||||
return None
|
||||
y_sq = (pow(x, 3, p) + 7) % p
|
||||
y = pow(y_sq, (p + 1) // 4, p)
|
||||
if pow(y, 2, p) != y_sq:
|
||||
|
||||
Reference in New Issue
Block a user