From 6303e3b0caa49d13d8283ede90553450730bf76f Mon Sep 17 00:00:00 2001 From: Jonas Nick Date: Fri, 21 Jun 2019 08:54:50 +0000 Subject: [PATCH 1/2] Fix schnorrsig module after rebase on upstream e541a90e --- src/bench_schnorrsig.c | 2 +- src/modules/schnorrsig/main_impl.h | 2 +- src/modules/schnorrsig/tests_impl.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bench_schnorrsig.c b/src/bench_schnorrsig.c index d2451092..6cf3dc3f 100644 --- a/src/bench_schnorrsig.c +++ b/src/bench_schnorrsig.c @@ -122,7 +122,7 @@ int main(void) { free(data.msgs); free(data.sigs); - secp256k1_scratch_space_destroy(data.scratch); + secp256k1_scratch_space_destroy(data.ctx, data.scratch); secp256k1_context_destroy(data.ctx); return 0; } diff --git a/src/modules/schnorrsig/main_impl.h b/src/modules/schnorrsig/main_impl.h index bebb49fe..7a455fa6 100644 --- a/src/modules/schnorrsig/main_impl.h +++ b/src/modules/schnorrsig/main_impl.h @@ -331,7 +331,7 @@ int secp256k1_schnorrsig_verify_batch(const secp256k1_context *ctx, secp256k1_sc } secp256k1_scalar_negate(&s, &s); - return secp256k1_ecmult_multi_var(&ctx->ecmult_ctx, scratch, &rj, &s, secp256k1_schnorrsig_verify_batch_ecmult_callback, (void *) &ecmult_context, 2 * n_sigs) + return secp256k1_ecmult_multi_var(&ctx->error_callback, &ctx->ecmult_ctx, scratch, &rj, &s, secp256k1_schnorrsig_verify_batch_ecmult_callback, (void *) &ecmult_context, 2 * n_sigs) && secp256k1_gej_is_infinity(&rj); } diff --git a/src/modules/schnorrsig/tests_impl.h b/src/modules/schnorrsig/tests_impl.h index e067058a..a999a011 100644 --- a/src/modules/schnorrsig/tests_impl.h +++ b/src/modules/schnorrsig/tests_impl.h @@ -720,7 +720,7 @@ void run_schnorrsig_tests(void) { test_schnorrsig_sign(); test_schnorrsig_sign_verify(scratch); - secp256k1_scratch_space_destroy(scratch); + secp256k1_scratch_space_destroy(ctx, scratch); } #endif From 99e1fb271c4f599ad0183b7e750c5b1da53dd3e7 Mon Sep 17 00:00:00 2001 From: Jonas Nick Date: Fri, 21 Jun 2019 09:01:25 +0000 Subject: [PATCH 2/2] Fix musig module after rebase on upstream e541a90e --- src/modules/musig/main_impl.h | 2 +- src/modules/musig/tests_impl.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/modules/musig/main_impl.h b/src/modules/musig/main_impl.h index d6d9e17d..7215f4a5 100644 --- a/src/modules/musig/main_impl.h +++ b/src/modules/musig/main_impl.h @@ -113,7 +113,7 @@ int secp256k1_musig_pubkey_combine(const secp256k1_context* ctx, secp256k1_scrat if (!secp256k1_musig_compute_ell(ctx, ecmult_data.ell, pubkeys, n_pubkeys)) { return 0; } - if (!secp256k1_ecmult_multi_var(&ctx->ecmult_ctx, scratch, &pkj, NULL, secp256k1_musig_pubkey_combine_callback, (void *) &ecmult_data, n_pubkeys)) { + if (!secp256k1_ecmult_multi_var(&ctx->error_callback, &ctx->ecmult_ctx, scratch, &pkj, NULL, secp256k1_musig_pubkey_combine_callback, (void *) &ecmult_data, n_pubkeys)) { return 0; } secp256k1_ge_set_gej(&pkp, &pkj); diff --git a/src/modules/musig/tests_impl.h b/src/modules/musig/tests_impl.h index 79688af2..28301fa8 100644 --- a/src/modules/musig/tests_impl.h +++ b/src/modules/musig/tests_impl.h @@ -78,10 +78,10 @@ void musig_api_tests(secp256k1_scratch_space *scratch) { /* pubkey_combine does not require a scratch space */ CHECK(secp256k1_musig_pubkey_combine(vrfy, NULL, &combined_pk, pk_hash, pk, 2) == 1); CHECK(ecount == 2); - /* If a scratch space is given it shouldn't be too small */ + /* A small scratch space works too, but will result in using an ineffecient algorithm */ scratch_small = secp256k1_scratch_space_create(ctx, 1); - CHECK(secp256k1_musig_pubkey_combine(vrfy, scratch_small, &combined_pk, pk_hash, pk, 2) == 0); - secp256k1_scratch_space_destroy(scratch_small); + CHECK(secp256k1_musig_pubkey_combine(vrfy, scratch_small, &combined_pk, pk_hash, pk, 2) == 1); + secp256k1_scratch_space_destroy(ctx, scratch_small); CHECK(ecount == 2); CHECK(secp256k1_musig_pubkey_combine(vrfy, scratch, NULL, pk_hash, pk, 2) == 0); CHECK(ecount == 3); @@ -751,7 +751,7 @@ void run_musig_tests(void) { } sha256_tag_test(); - secp256k1_scratch_space_destroy(scratch); + secp256k1_scratch_space_destroy(ctx, scratch); } #endif