Skip to content

Commit ac1e367

Browse files
committed
musig: turn off multiexponentiation for now
Before turning it on we need to have a discussion about our confidence in the correctness of the multiexponentiation code.
1 parent 3c79d97 commit ac1e367

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

include/secp256k1_musig.h

+7-5
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,13 @@ SECP256K1_API int secp256k1_musig_partial_sig_parse(
197197
*
198198
* Returns: 0 if the arguments are invalid, 1 otherwise
199199
* Args: ctx: pointer to a context object initialized for verification
200-
* scratch: scratch space used to compute the aggregate pubkey by
201-
* multiexponentiation. Generally, the larger the scratch
202-
* space, the faster this function. However, the returns of
203-
* providing a larger scratch space are diminishing. If NULL,
204-
* an inefficient algorithm is used.
200+
* scratch: should be NULL because it is not yet implemented. If it
201+
* was implemented then the scratch space would be used to
202+
* compute the aggregate pubkey by multiexponentiation.
203+
* Generally, the larger the scratch space, the faster this
204+
* function. However, the returns of providing a larger
205+
* scratch space are diminishing. If NULL, an inefficient
206+
* algorithm is used.
205207
* Out: agg_pk: the MuSig-aggregated x-only public key. If you do not need it,
206208
* this arg can be NULL.
207209
* keyagg_cache: if non-NULL, pointer to a musig_keyagg_cache struct that

src/modules/musig/keyagg_impl.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ int secp256k1_musig_pubkey_agg(const secp256k1_context* ctx, secp256k1_scratch_s
190190
secp256k1_gej pkj;
191191
secp256k1_ge pkp;
192192
size_t i;
193+
(void) scratch;
193194

194195
VERIFY_CHECK(ctx != NULL);
195196
if (agg_pk != NULL) {
@@ -216,7 +217,9 @@ int secp256k1_musig_pubkey_agg(const secp256k1_context* ctx, secp256k1_scratch_s
216217
if (!secp256k1_musig_compute_pk_hash(ctx, ecmult_data.pk_hash, pubkeys, n_pubkeys)) {
217218
return 0;
218219
}
219-
if (!secp256k1_ecmult_multi_var(&ctx->error_callback, scratch, &pkj, NULL, secp256k1_musig_pubkey_agg_callback, (void *) &ecmult_data, n_pubkeys)) {
220+
/* TODO: actually use optimized ecmult_multi algorithms by providing a
221+
* scratch space */
222+
if (!secp256k1_ecmult_multi_var(&ctx->error_callback, NULL, &pkj, NULL, secp256k1_musig_pubkey_agg_callback, (void *) &ecmult_data, n_pubkeys)) {
220223
/* In order to reach this line with the current implementation of
221224
* ecmult_multi_var one would need to provide a callback that can
222225
* fail. */

0 commit comments

Comments
 (0)