File tree 3 files changed +5
-2
lines changed
3 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -50,8 +50,9 @@ static int secp256k1_fe_normalizes_to_zero(const secp256k1_fe *r);
50
50
* without constant-time guarantee. */
51
51
static int secp256k1_fe_normalizes_to_zero_var (const secp256k1_fe * r );
52
52
53
- /** Set a field element equal to a small integer. Resulting field element is normalized; it has
54
- * magnitude 0 if a == 0, and magnitude 1 otherwise. */
53
+ /** Set a field element equal to a small (not greater than 0x7FFF), non-negative integer.
54
+ * Resulting field element is normalized; it has magnitude 0 if a == 0, and magnitude 1 otherwise.
55
+ */
55
56
static void secp256k1_fe_set_int (secp256k1_fe * r , int a );
56
57
57
58
/** Sets a field element equal to zero, initializing all fields. */
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) {
264
264
}
265
265
266
266
SECP256K1_INLINE static void secp256k1_fe_set_int (secp256k1_fe * r , int a ) {
267
+ VERIFY_CHECK (0 <= a && a <= 0x7FFF );
267
268
r -> n [0 ] = a ;
268
269
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 ;
269
270
#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) {
227
227
}
228
228
229
229
SECP256K1_INLINE static void secp256k1_fe_set_int (secp256k1_fe * r , int a ) {
230
+ VERIFY_CHECK (0 <= a && a <= 0x7FFF );
230
231
r -> n [0 ] = a ;
231
232
r -> n [1 ] = r -> n [2 ] = r -> n [3 ] = r -> n [4 ] = 0 ;
232
233
#ifdef VERIFY
You can’t perform that action at this time.
0 commit comments