From 4ebd82852d3ad00ab579b26173575a4f4642ea76 Mon Sep 17 00:00:00 2001 From: roconnor-blockstream Date: Wed, 22 Mar 2023 22:06:47 -0400 Subject: [PATCH] Apply Checks only in VERIFY mode. --- src/field_10x26_impl.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/field_10x26_impl.h b/src/field_10x26_impl.h index 46b72ce78d..d02fdddc69 100644 --- a/src/field_10x26_impl.h +++ b/src/field_10x26_impl.h @@ -1363,7 +1363,9 @@ static void secp256k1_fe_inv(secp256k1_fe *r, const secp256k1_fe *x) { secp256k1_modinv32(&s, &secp256k1_const_modinfo_fe); secp256k1_fe_from_signed30(r, &s); +#ifdef VERIFY VERIFY_CHECK(secp256k1_fe_normalizes_to_zero(r) == secp256k1_fe_normalizes_to_zero(&tmp)); +#endif } static void secp256k1_fe_inv_var(secp256k1_fe *r, const secp256k1_fe *x) { @@ -1376,7 +1378,9 @@ static void secp256k1_fe_inv_var(secp256k1_fe *r, const secp256k1_fe *x) { secp256k1_modinv32_var(&s, &secp256k1_const_modinfo_fe); secp256k1_fe_from_signed30(r, &s); +#ifdef VERIFY VERIFY_CHECK(secp256k1_fe_normalizes_to_zero(r) == secp256k1_fe_normalizes_to_zero(&tmp)); +#endif } static int secp256k1_fe_is_square_var(const secp256k1_fe *x) {