Skip to content

Commit 23c3fb6

Browse files
committed
Make argument of fe_normalizes_to_zero{_var} const
1 parent 4c3ba88 commit 23c3fb6

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

src/field.h

+5-6
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,12 @@ static void secp256k1_fe_normalize_weak(secp256k1_fe *r);
4343
/** Normalize a field element, without constant-time guarantee. */
4444
static void secp256k1_fe_normalize_var(secp256k1_fe *r);
4545

46-
/** Verify whether a field element represents zero i.e. would normalize to a zero value. The field
47-
* implementation may optionally normalize the input, but this should not be relied upon. */
48-
static int secp256k1_fe_normalizes_to_zero(secp256k1_fe *r);
46+
/** Verify whether a field element represents zero i.e. would normalize to a zero value. */
47+
static int secp256k1_fe_normalizes_to_zero(const secp256k1_fe *r);
4948

50-
/** Verify whether a field element represents zero i.e. would normalize to a zero value. The field
51-
* implementation may optionally normalize the input, but this should not be relied upon. */
52-
static int secp256k1_fe_normalizes_to_zero_var(secp256k1_fe *r);
49+
/** Verify whether a field element represents zero i.e. would normalize to a zero value,
50+
* without constant-time guarantee. */
51+
static int secp256k1_fe_normalizes_to_zero_var(const secp256k1_fe *r);
5352

5453
/** Set a field element equal to a small integer. Resulting field element is normalized. */
5554
static void secp256k1_fe_set_int(secp256k1_fe *r, int a);

src/field_10x26_impl.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ static void secp256k1_fe_normalize_var(secp256k1_fe *r) {
181181
#endif
182182
}
183183

184-
static int secp256k1_fe_normalizes_to_zero(secp256k1_fe *r) {
184+
static int secp256k1_fe_normalizes_to_zero(const secp256k1_fe *r) {
185185
uint32_t t0 = r->n[0], t1 = r->n[1], t2 = r->n[2], t3 = r->n[3], t4 = r->n[4],
186186
t5 = r->n[5], t6 = r->n[6], t7 = r->n[7], t8 = r->n[8], t9 = r->n[9];
187187

@@ -210,7 +210,7 @@ static int secp256k1_fe_normalizes_to_zero(secp256k1_fe *r) {
210210
return (z0 == 0) | (z1 == 0x3FFFFFFUL);
211211
}
212212

213-
static int secp256k1_fe_normalizes_to_zero_var(secp256k1_fe *r) {
213+
static int secp256k1_fe_normalizes_to_zero_var(const secp256k1_fe *r) {
214214
uint32_t t0, t1, t2, t3, t4, t5, t6, t7, t8, t9;
215215
uint32_t z0, z1;
216216
uint32_t x;

src/field_5x52_impl.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static void secp256k1_fe_normalize_var(secp256k1_fe *r) {
161161
#endif
162162
}
163163

164-
static int secp256k1_fe_normalizes_to_zero(secp256k1_fe *r) {
164+
static int secp256k1_fe_normalizes_to_zero(const secp256k1_fe *r) {
165165
uint64_t t0 = r->n[0], t1 = r->n[1], t2 = r->n[2], t3 = r->n[3], t4 = r->n[4];
166166

167167
/* z0 tracks a possible raw value of 0, z1 tracks a possible raw value of P */
@@ -184,7 +184,7 @@ static int secp256k1_fe_normalizes_to_zero(secp256k1_fe *r) {
184184
return (z0 == 0) | (z1 == 0xFFFFFFFFFFFFFULL);
185185
}
186186

187-
static int secp256k1_fe_normalizes_to_zero_var(secp256k1_fe *r) {
187+
static int secp256k1_fe_normalizes_to_zero_var(const secp256k1_fe *r) {
188188
uint64_t t0, t1, t2, t3, t4;
189189
uint64_t z0, z1;
190190
uint64_t x;

0 commit comments

Comments
 (0)