diff --git a/src/scalar_low_impl.h b/src/scalar_low_impl.h index 5dbc35604c..daa5e37118 100644 --- a/src/scalar_low_impl.h +++ b/src/scalar_low_impl.h @@ -40,6 +40,8 @@ static void secp256k1_scalar_cadd_bit(secp256k1_scalar *r, unsigned int bit, int if (flag && bit < 32) *r += ((uint32_t)1 << bit); #ifdef VERIFY + VERIFY_CHECK(bit < 32); + VERIFY_CHECK(((uint32_t)1 << bit) - 1 <= UINT32_MAX - EXHAUSTIVE_TEST_ORDER); VERIFY_CHECK(secp256k1_scalar_check_overflow(r) == 0); #endif }