aboutsummaryrefslogtreecommitdiff
path: root/src/secp256k1/src/field_5x52_impl.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/secp256k1/src/field_5x52_impl.h')
-rw-r--r--src/secp256k1/src/field_5x52_impl.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/secp256k1/src/field_5x52_impl.h b/src/secp256k1/src/field_5x52_impl.h
index 60ded927f6..b56bdd1353 100644
--- a/src/secp256k1/src/field_5x52_impl.h
+++ b/src/secp256k1/src/field_5x52_impl.h
@@ -227,10 +227,11 @@ static int secp256k1_fe_normalizes_to_zero_var(const secp256k1_fe *r) {
}
SECP256K1_INLINE static void secp256k1_fe_set_int(secp256k1_fe *r, int a) {
+ VERIFY_CHECK(0 <= a && a <= 0x7FFF);
r->n[0] = a;
r->n[1] = r->n[2] = r->n[3] = r->n[4] = 0;
#ifdef VERIFY
- r->magnitude = 1;
+ r->magnitude = (a != 0);
r->normalized = 1;
secp256k1_fe_verify(r);
#endif
@@ -496,6 +497,7 @@ static SECP256K1_INLINE void secp256k1_fe_from_storage(secp256k1_fe *r, const se
#ifdef VERIFY
r->magnitude = 1;
r->normalized = 1;
+ secp256k1_fe_verify(r);
#endif
}