Skip to content

Commit c083cc6

Browse files
committed
Merge #903: Make argument of fe_normalizes_to_zero{_var} const
23c3fb6 Make argument of fe_normalizes_to_zero{_var} const (Pieter Wuille) Pull request description: ACKs for top commit: real-or-random: ACK 23c3fb6 diff looks good jonasnick: ACK 23c3fb6 Tree-SHA512: a51894a9e59851dc4854e92e4200ef6d12a11f6785b903c23585cfff5ef8d369216f4121260fe8789d46d3e215f3c2baa42decae99ab9328e8081f5274e67fab
2 parents 6e89853 + 23c3fb6 commit c083cc6

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
@@ -182,7 +182,7 @@ static void secp256k1_fe_normalize_var(secp256k1_fe *r) {
182182
#endif
183183
}
184184

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

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

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

src/field_5x52_impl.h

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

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

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

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

0 commit comments

Comments
 (0)