Abstract out verify logic for fe_negate
This commit is contained in:
@@ -253,6 +253,17 @@ SECP256K1_INLINE static void secp256k1_fe_get_b32(unsigned char *r, const secp25
|
||||
VERIFY_CHECK(a->normalized);
|
||||
secp256k1_fe_impl_get_b32(r, a);
|
||||
}
|
||||
|
||||
static void secp256k1_fe_impl_negate(secp256k1_fe *r, const secp256k1_fe *a, int m);
|
||||
SECP256K1_INLINE static void secp256k1_fe_negate(secp256k1_fe *r, const secp256k1_fe *a, int m) {
|
||||
secp256k1_fe_verify(a);
|
||||
VERIFY_CHECK(m >= 0 && m <= 31);
|
||||
VERIFY_CHECK(a->magnitude <= m);
|
||||
secp256k1_fe_impl_negate(r, a, m);
|
||||
r->magnitude = m + 1;
|
||||
r->normalized = 0;
|
||||
secp256k1_fe_verify(r);
|
||||
}
|
||||
#endif /* defined(VERIFY) */
|
||||
|
||||
#endif /* SECP256K1_FIELD_IMPL_H */
|
||||
|
||||
Reference in New Issue
Block a user