Merge bitcoin-core/secp256k1#986: tests: remove `secp256k1_fe_verify` from tests.c and modify `_fe_from_storage` to call `_fe_verify`

d43993724d tests: remove `secp256k1_fe_verify` from tests.c and modify `secp256k1_fe_from_storage` to call `secp256k1_fe_verify` (siv2r)

Pull request description:

ACKs for top commit:
  roconnor-blockstream:
    utACK d439937 diff looks correct, I also didn't run the tests locally.
  real-or-random:
    utACK d43993724d diff looks correct, I didn't run the tests locally
  jonasnick:
    ACK d43993724d ran tests with `--enable-coverage`

Tree-SHA512: c3c9ecf8e9b7dfdcd1144ddcf8bcc637996c699dbd0fc6223e6186d082908728468fa276b09c6f344e036ca05f54432dde6366a83eb39f915a334164faadd556
This commit is contained in:
Jonas Nick 2021-10-04 18:52:56 +00:00
commit da0092bccc
No known key found for this signature in database
GPG Key ID: 4861DBF262123605
3 changed files with 2 additions and 4 deletions

View File

@ -1162,6 +1162,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
}

View File

@ -496,6 +496,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
}

View File

@ -3435,8 +3435,6 @@ void test_pre_g_table(const secp256k1_ge_storage * pre_g, size_t n) {
CHECK(0 < n);
secp256k1_ge_from_storage(&p, &pre_g[0]);
secp256k1_fe_verify(&p.x);
secp256k1_fe_verify(&p.y);
CHECK(secp256k1_ge_is_valid_var(&p));
secp256k1_gej_set_ge(&g2, &p);
@ -3449,8 +3447,6 @@ void test_pre_g_table(const secp256k1_ge_storage * pre_g, size_t n) {
CHECK(!secp256k1_fe_normalizes_to_zero_var(&dpx) || !secp256k1_fe_normalizes_to_zero_var(&dpy));
secp256k1_ge_from_storage(&q, &pre_g[i]);
secp256k1_fe_verify(&q.x);
secp256k1_fe_verify(&q.y);
CHECK(secp256k1_ge_is_valid_var(&q));
secp256k1_fe_negate(&dqx, &q.x, 1); secp256k1_fe_add(&dqx, &gg.x); secp256k1_fe_normalize_weak(&dqx);