add verification for scalars

secp256k1_scalar_verify checks that scalars are reduced mod the
group order
This commit is contained in:
stratospher
2023-07-04 00:43:10 +05:30
parent ad152151b0
commit c7d0454932
2 changed files with 11 additions and 0 deletions

View File

@@ -33,6 +33,14 @@ static int secp256k1_scalar_set_b32_seckey(secp256k1_scalar *r, const unsigned c
return (!overflow) & (!secp256k1_scalar_is_zero(r));
}
static void secp256k1_scalar_verify(const secp256k1_scalar *r) {
#ifdef VERIFY
VERIFY_CHECK(secp256k1_scalar_check_overflow(r) == 0);
#endif
(void)r;
}
#if defined(EXHAUSTIVE_TEST_ORDER)
/* Begin of section generated by sage/gen_exhaustive_groups.sage. */
# if EXHAUSTIVE_TEST_ORDER == 7