File tree Expand file tree Collapse file tree 3 files changed +3
-1
lines changed Expand file tree Collapse file tree 3 files changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ static int secp256k1_fe_normalizes_to_zero(const secp256k1_fe *r);
5050 * without constant-time guarantee. */
5151static int secp256k1_fe_normalizes_to_zero_var (const secp256k1_fe * r );
5252
53- /** Set a field element equal to a small integer. Resulting field element is normalized; it has
53+ /** Set a field element equal to a small, non-negative integer. Resulting field element is normalized; it has
5454 * magnitude 0 if a == 0, and magnitude 1 otherwise. */
5555static void secp256k1_fe_set_int (secp256k1_fe * r , int a );
5656
Original file line number Diff line number Diff line change @@ -264,6 +264,7 @@ static int secp256k1_fe_normalizes_to_zero_var(const secp256k1_fe *r) {
264264}
265265
266266SECP256K1_INLINE static void secp256k1_fe_set_int (secp256k1_fe * r , int a ) {
267+ VERIFY_CHECK (0 <= a && a <= 0x7FFF );
267268 r -> n [0 ] = a ;
268269 r -> n [1 ] = r -> n [2 ] = r -> n [3 ] = r -> n [4 ] = r -> n [5 ] = r -> n [6 ] = r -> n [7 ] = r -> n [8 ] = r -> n [9 ] = 0 ;
269270#ifdef VERIFY
Original file line number Diff line number Diff line change @@ -227,6 +227,7 @@ static int secp256k1_fe_normalizes_to_zero_var(const secp256k1_fe *r) {
227227}
228228
229229SECP256K1_INLINE static void secp256k1_fe_set_int (secp256k1_fe * r , int a ) {
230+ VERIFY_CHECK (0 <= a && a <= 0x7FFF );
230231 r -> n [0 ] = a ;
231232 r -> n [1 ] = r -> n [2 ] = r -> n [3 ] = r -> n [4 ] = 0 ;
232233#ifdef VERIFY
You can’t perform that action at this time.
0 commit comments