You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the deserialization of prime field elements, we sometimes check that the resulting value lies in the correct range: [0, p-1].
This check is performed by the function is_less_than_modulus:
It simply subtracts the modulus as a big integer and checks for an underflow. Note that the input must be in canonical form, not in Montgomery form.
The function is called correctly in some places, but incorrectly in others (mainly in SerdeObject implementation).
In the deserialization of prime field elements, we sometimes check that the resulting value lies in the correct range:
[0, p-1]
.This check is performed by the function
is_less_than_modulus
:halo2curves/derive/src/field/mod.rs
Lines 359 to 364 in 8771fe5
It simply subtracts the modulus as a big integer and checks for an underflow. Note that the input must be in canonical form, not in Montgomery form.
The function is called correctly in some places, but incorrectly in others (mainly in
SerdeObject
implementation).Here it is correctly used:
halo2curves/derive/src/field/mod.rs
Lines 464 to 468 in 8771fe5
(Note that it receives the canonical form, so the input is multiplied by
R2
, but not in theless_than_modulus
call).But here it is not:
halo2curves/derive/src/field/mod.rs
Lines 497 to 503 in 8771fe5
and
halo2curves/derive/src/field/mod.rs
Lines 522 to 538 in 8771fe5
The text was updated successfully, but these errors were encountered: