Skip to content

Commit

Permalink
Merge #1528: tests: call secp256k1_ecmult_multi_var with a non-`NUL…
Browse files Browse the repository at this point in the history
…L` error callback

9554362 tests: call secp256k1_ecmult_multi_var with a non-NULL error callback (Nicolas Iooss)

Pull request description:

  Hello,
  This Pull Request fixes the issue reported in #1527. Function `secp256k1_ecmult_multi_var` expects to be called with a non-`NULL` `error_callback` parameter. Fix the invocation in `test_ecmult_accumulate` to do this. While at it, wrap the call in a `CHECK` macro to ensure it succeeds.

ACKs for top commit:
  real-or-random:
    utACK 9554362
  siv2r:
    ACK 9554362, I have also verified that other invocations of `ecmult_multi_var` (in tests) don’t use `NULL` for the error callback function argument.

Tree-SHA512: 6a9f6c10c575794da75f2254d6fbbc195de889c81a371ce35ab38e2e5483aa1e25ec0bcd5aa8d6a32a1493586f73430208a4bd0613e373571d2f04d63dbc4a1c
  • Loading branch information
real-or-random committed May 13, 2024
2 parents 4155e62 + 9554362 commit 06bff6d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tests.c
Expand Up @@ -5494,8 +5494,8 @@ static void test_ecmult_accumulate(secp256k1_sha256* acc, const secp256k1_scalar
secp256k1_ecmult_gen(&CTX->ecmult_gen_ctx, &rj1, x);
secp256k1_ecmult(&rj2, &gj, x, &secp256k1_scalar_zero);
secp256k1_ecmult(&rj3, &infj, &secp256k1_scalar_zero, x);
secp256k1_ecmult_multi_var(NULL, scratch, &rj4, x, NULL, NULL, 0);
secp256k1_ecmult_multi_var(NULL, scratch, &rj5, &secp256k1_scalar_zero, test_ecmult_accumulate_cb, (void*)x, 1);
CHECK(secp256k1_ecmult_multi_var(&CTX->error_callback, scratch, &rj4, x, NULL, NULL, 0));
CHECK(secp256k1_ecmult_multi_var(&CTX->error_callback, scratch, &rj5, &secp256k1_scalar_zero, test_ecmult_accumulate_cb, (void*)x, 1));
secp256k1_ecmult_const(&rj6, &secp256k1_ge_const_g, x);
secp256k1_ge_set_gej_var(&r, &rj1);
CHECK(secp256k1_gej_eq_ge_var(&rj2, &r));
Expand Down

0 comments on commit 06bff6d

Please sign in to comment.