Reject encoded points with v not in the field

This commit is contained in:
Jack Grigg 2018-05-19 06:30:19 +12:00
parent d32ed1a957
commit ef17e5bc26
1 changed files with 2 additions and 0 deletions

View File

@ -148,6 +148,8 @@ class Point(object):
u_sign = buf[31] >> 7
buf = buf[:31] + bytes([buf[31] & 0b01111111])
v = Fq.from_bytes(buf)
if bytes(v) != buf:
return None
vv = v * v
u2 = (vv - Fq.ONE) / (vv * JUBJUB_D - JUBJUB_A)