Reject encoded points with v not in the field
This commit is contained in:
parent
d32ed1a957
commit
ef17e5bc26
|
@ -148,6 +148,8 @@ class Point(object):
|
||||||
u_sign = buf[31] >> 7
|
u_sign = buf[31] >> 7
|
||||||
buf = buf[:31] + bytes([buf[31] & 0b01111111])
|
buf = buf[:31] + bytes([buf[31] & 0b01111111])
|
||||||
v = Fq.from_bytes(buf)
|
v = Fq.from_bytes(buf)
|
||||||
|
if bytes(v) != buf:
|
||||||
|
return None
|
||||||
|
|
||||||
vv = v * v
|
vv = v * v
|
||||||
u2 = (vv - Fq.ONE) / (vv * JUBJUB_D - JUBJUB_A)
|
u2 = (vv - Fq.ONE) / (vv * JUBJUB_D - JUBJUB_A)
|
||||||
|
|
Loading…
Reference in New Issue