6#ifndef SECP256K1_MODULE_MUSIG_TESTS_IMPL_H
7#define SECP256K1_MODULE_MUSIG_TESTS_IMPL_H
12#include "../../../include/secp256k1.h"
13#include "../../../include/secp256k1_extrakeys.h"
14#include "../../../include/secp256k1_musig.h"
18#include "../../scalar.h"
19#include "../../field.h"
20#include "../../group.h"
21#include "../../hash.h"
22#include "../../util.h"
23#include "../../unit_test.h"
32 if (keypair != NULL) {
33 *keypair = keypair_tmp;
41 unsigned char sk[2][32];
46 unsigned char msg[32];
49 unsigned char session_secrand[2][32];
55 unsigned char final_sig[64];
60 for (i = 0; i < 2; i++) {
63 pubnonce_ptr[i] = &pubnonce[i];
64 partial_sig_ptr[i] = &partial_sig[i];
71 uint64_t nonrepeating_cnt = 0;
80 for (i = 0; i < 2; i++) {
100 for (i = 0; i < 2; i++) {
102 pubnonce_ptr[i] = &pubnonce[i];
116 for (i = 0; i < len; i++) {
127 unsigned char pre_sig[64];
128 unsigned char buf[32];
129 unsigned char sk[2][32];
132 unsigned char max64[64];
133 unsigned char zeros132[132] = { 0 };
134 unsigned char session_secrand[2][32];
135 unsigned char nonrepeating_cnt = 0;
141 unsigned char pubnonce_ser[66];
147 unsigned char aggnonce_ser[66];
148 unsigned char msg[32];
160 unsigned char tweak[32];
164 memset(max64, 0xff,
sizeof(max64));
165 memset(&invalid_keypair, 0,
sizeof(invalid_keypair));
166 memset(&invalid_pk, 0,
sizeof(invalid_pk));
167 memset(&invalid_secnonce, 0,
sizeof(invalid_secnonce));
168 memset(&invalid_partial_sig, 0,
sizeof(invalid_partial_sig));
173 memset(&invalid_keyagg_cache, 0,
sizeof(invalid_keyagg_cache));
174 memset(&invalid_pk, 0,
sizeof(invalid_pk));
175 memset(&invalid_pubnonce, 0,
sizeof(invalid_pubnonce));
176 memset(&invalid_session, 0,
sizeof(invalid_session));
180 for (i = 0; i < 2; i++) {
182 invalid_pk_ptr2[i] = &invalid_pk;
183 invalid_pk_ptr3[i] = &
pk[i];
184 pubnonce_ptr[i] = &pubnonce[i];
185 inf_pubnonce_ptr[i] = &inf_pubnonce[i];
186 partial_sig_ptr[i] = &partial_sig[i];
187 invalid_partial_sig_ptr[i] = &partial_sig[i];
192 invalid_pubnonce_ptr[0] = &invalid_pubnonce;
193 invalid_partial_sig_ptr[0] = &invalid_partial_sig;
196 invalid_pk_ptr3[2] = &invalid_pk;
228 for (i = 0; i < 2; i++) {
231 CHECK((*tweak_func[i])(
CTX, &tmp_output_pk, &tmp_keyagg_cache,
tweak) == 1);
233 tmp_keyagg_cache = keyagg_cache;
234 CHECK((*tweak_func[i])(
CTX, NULL, &tmp_keyagg_cache,
tweak) == 1);
235 tmp_keyagg_cache = keyagg_cache;
238 tmp_keyagg_cache = keyagg_cache;
241 tmp_keyagg_cache = keyagg_cache;
242 CHECK((*tweak_func[i])(
CTX, &tmp_output_pk, &tmp_keyagg_cache, max64) == 0);
244 tmp_keyagg_cache = keyagg_cache;
271 memcpy(&session_secrand[0], zeros132,
sizeof(session_secrand[0]));
362 for (i = 0; i < 2; i++) {
402 memcpy(&secnonce_tmp, &secnonce[0],
sizeof(secnonce_tmp));
407 memcpy(&secnonce_tmp, &secnonce[0],
sizeof(secnonce_tmp));
409 memcpy(&secnonce_tmp, &secnonce[0],
sizeof(secnonce_tmp));
413 memcpy(&secnonce_tmp, &secnonce[0],
sizeof(secnonce_tmp));
415 memcpy(&secnonce_tmp, &secnonce[0],
sizeof(secnonce_tmp));
417 unsigned char sk_tmp[32];
422 memcpy(&secnonce_tmp, &secnonce[0],
sizeof(secnonce_tmp));
425 memcpy(&secnonce_tmp, &secnonce[0],
sizeof(secnonce_tmp));
427 memcpy(&secnonce_tmp, &secnonce[0],
sizeof(secnonce_tmp));
429 memcpy(&secnonce_tmp, &secnonce[0],
sizeof(secnonce_tmp));
431 memcpy(&secnonce_tmp, &secnonce[0],
sizeof(secnonce_tmp));
498 unsigned char *
args[6];
499 unsigned char session_secrand[32];
500 unsigned char sk[32];
501 unsigned char pk[33];
502 unsigned char msg[32];
503 unsigned char agg_pk[32];
504 unsigned char extra_input[32];
516 args[0] = session_secrand;
521 args[5] = extra_input;
522 for (i = 0; i <
COUNT; i++) {
532 memcpy(
msg, session_secrand,
sizeof(
msg));
533 memcpy(
sk, session_secrand,
sizeof(
sk));
534 memcpy(
pk, session_secrand,
sizeof(session_secrand));
535 memcpy(agg_pk, session_secrand,
sizeof(agg_pk));
536 memcpy(extra_input, session_secrand,
sizeof(extra_input));
543 for (i = 0; i < 6; i++) {
545 for (j = i+1; j < 6; j++) {
558 static const unsigned char tag[] = {
'K',
'e',
'y',
'A',
'g',
'g',
' ',
'l',
'i',
's',
't'};
564 static const unsigned char tag[] = {
'K',
'e',
'y',
'A',
'g',
'g',
' ',
'c',
'o',
'e',
'f',
'f',
'i',
'c',
'i',
'e',
'n',
't'};
570 static const unsigned char tag[] = {
'M',
'u',
'S',
'i',
'g',
'/',
'a',
'u',
'x' };
576 static const unsigned char tag[] = {
'M',
'u',
'S',
'i',
'g',
'/',
'n',
'o',
'n',
'c',
'e' };
582 static const unsigned char tag[] = {
'M',
'u',
'S',
'i',
'g',
'/',
'n',
'o',
'n',
'c',
'e',
'c',
'o',
'e',
'f' };
592 unsigned char session_secrand[2][32];
593 unsigned char msg[32];
602 unsigned char final_sig[64];
605 for (i = 0; i < 2; i++) {
606 pubnonce_ptr[i] = &pubnonce[i];
607 partial_sig_ptr[i] = &partial_sig[i];
634 unsigned char sk[2][32];
638 enum { N_TWEAKS = 8 };
644 for (i = 0; i < 2; i++) {
658 for (i = 1; i <= N_TWEAKS; i++) {
659 unsigned char tweak[32];
673 unsigned char P_serialized[32];
688 unsigned char *agg_pk_ser,
689 const unsigned char pubkeys33[][33],
690 const unsigned char tweaks32[][32],
691 size_t key_indices_len,
692 const size_t *key_indices,
693 size_t tweak_indices_len,
694 const size_t *tweak_indices,
695 const int *is_xonly) {
702 for (i = 0; i < (int)key_indices_len; i++) {
707 pk_ptr[i] = &pubkeys[i];
714 for (i = 0; i < (int)tweak_indices_len; i++) {
737 if (agg_pk_ser != NULL) {
755 unsigned char agg_pk[32];
779 unsigned char session_secrand32[32];
782 const unsigned char *
sk = NULL;
783 const unsigned char *
msg = NULL;
784 const unsigned char *
extra_in = NULL;
786 unsigned char pubnonce66[66];
788 memcpy(session_secrand32, c->
rand_, 32);
796 memset(&cache_i, 0,
sizeof(cache_i));
800 keyagg_cache_ptr = &keyagg_cache;
834 unsigned char aggnonce66[66];
836 for (j = 0; j < 2; j++) {
838 pubnonce_ptr[j] = &pubnonce[j];
847 for (j = 0; j < 2; j++) {
879 unsigned char partial_sig32[32];
942 enum { NUM_PUBNONCES = 3 };
952 pubnonce_ptr[j] = &pubnonce[j];
1005 unsigned char partial_sig32[32];
1037 unsigned char final_sig[64];
1039 unsigned char agg_pk32[32];
1051 partial_sig_ptr[j] = &partial_sig[j];
1075 unsigned char pubnonce66[66];
1078 uint64_t nonrepeating_cnt = 0;
1079 unsigned char sk[32] = {
1080 0xEE, 0xC1, 0xCB, 0x7D, 0x1B, 0x72, 0x54, 0xC5,
1081 0xCA, 0xB0, 0xD9, 0xC6, 0x1A, 0xB0, 0x2E, 0x64,
1082 0x3D, 0x46, 0x4A, 0x59, 0xFE, 0x6C, 0x96, 0xA7,
1083 0xEF, 0xE8, 0x71, 0xF0, 0x7C, 0x5A, 0xEF, 0x54,
1085 unsigned char expected_secnonce[64] = {
1086 0x84, 0x2F, 0x13, 0x80, 0xCD, 0x17, 0xA1, 0x98,
1087 0xFC, 0x3D, 0xAD, 0x3B, 0x7D, 0xA7, 0x49, 0x29,
1088 0x41, 0xF4, 0x69, 0x76, 0xF2, 0x70, 0x2F, 0xF7,
1089 0xC6, 0x6F, 0x24, 0xF4, 0x72, 0x03, 0x6A, 0xF1,
1090 0xDA, 0x3F, 0x95, 0x2D, 0xDE, 0x4A, 0x2D, 0xA6,
1091 0xB6, 0x32, 0x57, 0x07, 0xCE, 0x87, 0xA4, 0xE3,
1092 0x61, 0x6D, 0x06, 0xFC, 0x5F, 0x81, 0xA9, 0xC9,
1093 0x93, 0x86, 0xD2, 0x0A, 0x99, 0xCE, 0xCF, 0x99,
1095 unsigned char expected_pubnonce[66] = {
1096 0x03, 0xA5, 0xB9, 0xB6, 0x90, 0x79, 0x42, 0xEA,
1097 0xCD, 0xDA, 0x49, 0xA3, 0x66, 0x01, 0x6E, 0xC2,
1098 0xE6, 0x24, 0x04, 0xA1, 0xBF, 0x4A, 0xB6, 0xD4,
1099 0xDB, 0x82, 0x06, 0x7B, 0xC3, 0xAD, 0xF0, 0x86,
1100 0xD7, 0x03, 0x32, 0x05, 0xDB, 0x9E, 0xB3, 0x4D,
1101 0x5C, 0x7C, 0xE0, 0x28, 0x48, 0xCA, 0xC6, 0x8A,
1102 0x83, 0xED, 0x73, 0xE3, 0x88, 0x34, 0x77, 0xF5,
1103 0x63, 0xF2, 0x3C, 0xE9, 0xA1, 0x1A, 0x77, 0x21,
1124 CASE1(musig_simple_test),
1127 CASE1(musig_tweak_test),
static SECP256K1_INLINE int secp256k1_xonly_pubkey_load(const secp256k1_context *ctx, secp256k1_ge *ge, const secp256k1_xonly_pubkey *pubkey)
static int secp256k1_gej_is_infinity(const secp256k1_gej *a)
Check whether a group element is the point at infinity.
static void secp256k1_ge_neg(secp256k1_ge *r, const secp256k1_ge *a)
Set r equal to the inverse of a (i.e., mirrored around the X axis)
static int secp256k1_ge_is_infinity(const secp256k1_ge *a)
Check whether a group element is the point at infinity.
static void secp256k1_musig_keyaggcoef_sha256(secp256k1_sha256 *sha)
static void secp256k1_musig_keyagglist_sha256(secp256k1_sha256 *sha)
static void secp256k1_keyagg_cache_save(secp256k1_musig_keyagg_cache *cache, const secp256k1_keyagg_cache_internal *cache_i)
#define CHECK(cond)
Unconditional failure on condition failure.
static const struct tf_test_entry tests_musig[]
static void musig_test_vectors_keyagg(void)
static void musig_nonce_test(void)
int musig_vectors_keyagg_and_tweak(enum MUSIG_ERROR *error, secp256k1_musig_keyagg_cache *keyagg_cache, unsigned char *agg_pk_ser, const unsigned char pubkeys33[][33], const unsigned char tweaks32[][32], size_t key_indices_len, const size_t *key_indices, size_t tweak_indices_len, const size_t *tweak_indices, const int *is_xonly)
static void musig_test_set_secnonce(secp256k1_musig_secnonce *secnonce, const unsigned char *secnonce64, const secp256k1_pubkey *pubkey)
static void sha256_tag_test(void)
static int create_keypair_and_pk(secp256k1_keypair *keypair, secp256k1_pubkey *pk, const unsigned char *sk)
static void musig_api_tests(void)
static void musig_test_vectors_sigagg(void)
static void musig_test_vectors_signverify(void)
static void pubnonce_summing_to_inf(secp256k1_musig_pubnonce *pubnonce)
static void musig_test_static_nonce_gen_counter(void)
int memcmp_and_randomize(unsigned char *value, const unsigned char *expected, size_t len)
static void musig_nonce_bitflip(unsigned char **args, size_t n_flip, size_t n_bytes)
static void musig_test_vectors_nonceagg(void)
static void musig_tweak_test_internal(void)
static void musig_tweak_test_helper(const secp256k1_xonly_pubkey *agg_pk, const unsigned char *sk0, const unsigned char *sk1, secp256k1_musig_keyagg_cache *keyagg_cache)
static void musig_test_vectors_noncegen(void)
static void musig_simple_test_internal(void)
static void musig_test_vectors_tweak(void)
static int tweak(const secp256k1_context *ctx, secp256k1_xonly_pubkey *agg_pk, secp256k1_musig_keyagg_cache *cache)
static void secp256k1_scalar_set_b32(secp256k1_scalar *r, const unsigned char *bin, int *overflow)
Set a scalar from a big endian byte array.
static int secp256k1_scalar_eq(const secp256k1_scalar *a, const secp256k1_scalar *b)
Compare two scalars.
static SECP256K1_INLINE int secp256k1_memcmp_var(const void *s1, const void *s2, size_t n)
Semantics like memcmp.
static int secp256k1_pubkey_load(const secp256k1_context *ctx, secp256k1_ge *ge, const secp256k1_pubkey *pubkey)
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_parse(const secp256k1_context *ctx, secp256k1_pubkey *pubkey, const unsigned char *input, size_t inputlen) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
Parse a variable-length public key into the pubkey object.
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_tweak_add(const secp256k1_context *ctx, secp256k1_pubkey *pubkey, const unsigned char *tweak32) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
Tweak a public key by adding tweak times the generator to it.
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_musig_pubkey_ec_tweak_add(const secp256k1_context *ctx, secp256k1_pubkey *output_pubkey, secp256k1_musig_keyagg_cache *keyagg_cache, const unsigned char *tweak32) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4)
Apply plain "EC" tweaking to a public key in a given keyagg_cache by adding the generator multiplied ...
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_musig_pubkey_xonly_tweak_add(const secp256k1_context *ctx, secp256k1_pubkey *output_pubkey, secp256k1_musig_keyagg_cache *keyagg_cache, const unsigned char *tweak32) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4)
Apply x-only tweaking to a public key in a given keyagg_cache by adding the generator multiplied with...
SECP256K1_API int secp256k1_musig_aggnonce_serialize(const secp256k1_context *ctx, unsigned char *out66, const secp256k1_musig_aggnonce *nonce) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
Serialize an aggregate public nonce.
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_musig_partial_sig_parse(const secp256k1_context *ctx, secp256k1_musig_partial_sig *sig, const unsigned char *in32) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
Parse a MuSig partial signature.
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_musig_pubnonce_parse(const secp256k1_context *ctx, secp256k1_musig_pubnonce *nonce, const unsigned char *in66) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
Parse a signer's public nonce.
SECP256K1_API int secp256k1_musig_nonce_agg(const secp256k1_context *ctx, secp256k1_musig_aggnonce *aggnonce, const secp256k1_musig_pubnonce *const *pubnonces, size_t n_pubnonces) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
Aggregates the nonces of all signers into a single nonce.
SECP256K1_API int secp256k1_musig_partial_sign(const secp256k1_context *ctx, secp256k1_musig_partial_sig *partial_sig, secp256k1_musig_secnonce *secnonce, const secp256k1_keypair *keypair, const secp256k1_musig_keyagg_cache *keyagg_cache, const secp256k1_musig_session *session) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4) SECP256K1_ARG_NONNULL(5) SECP256K1_ARG_NONNULL(6)
Produces a partial signature.
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_musig_aggnonce_parse(const secp256k1_context *ctx, secp256k1_musig_aggnonce *nonce, const unsigned char *in66) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
Parse an aggregate public nonce.
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_musig_pubkey_get(const secp256k1_context *ctx, secp256k1_pubkey *agg_pk, const secp256k1_musig_keyagg_cache *keyagg_cache) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
Obtain the aggregate public key from a keyagg_cache.
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_musig_nonce_gen(const secp256k1_context *ctx, secp256k1_musig_secnonce *secnonce, secp256k1_musig_pubnonce *pubnonce, unsigned char *session_secrand32, const unsigned char *seckey, const secp256k1_pubkey *pubkey, const unsigned char *msg32, const secp256k1_musig_keyagg_cache *keyagg_cache, const unsigned char *extra_input32) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4) SECP256K1_ARG_NONNULL(6)
Starts a signing session by generating a nonce.
SECP256K1_API int secp256k1_musig_partial_sig_serialize(const secp256k1_context *ctx, unsigned char *out32, const secp256k1_musig_partial_sig *sig) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
Serialize a MuSig partial signature.
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_musig_partial_sig_verify(const secp256k1_context *ctx, const secp256k1_musig_partial_sig *partial_sig, const secp256k1_musig_pubnonce *pubnonce, const secp256k1_pubkey *pubkey, const secp256k1_musig_keyagg_cache *keyagg_cache, const secp256k1_musig_session *session) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4) SECP256K1_ARG_NONNULL(5) SECP256K1_ARG_NONNULL(6)
Verifies an individual signer's partial signature.
SECP256K1_API int secp256k1_musig_partial_sig_agg(const secp256k1_context *ctx, unsigned char *sig64, const secp256k1_musig_session *session, const secp256k1_musig_partial_sig *const *partial_sigs, size_t n_sigs) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4)
Aggregates partial signatures.
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_musig_nonce_gen_counter(const secp256k1_context *ctx, secp256k1_musig_secnonce *secnonce, secp256k1_musig_pubnonce *pubnonce, uint64_t nonrepeating_cnt, const secp256k1_keypair *keypair, const unsigned char *msg32, const secp256k1_musig_keyagg_cache *keyagg_cache, const unsigned char *extra_input32) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(5)
Alternative way to generate a nonce and start a signing session.
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_musig_pubkey_agg(const secp256k1_context *ctx, secp256k1_xonly_pubkey *agg_pk, secp256k1_musig_keyagg_cache *keyagg_cache, const secp256k1_pubkey *const *pubkeys, size_t n_pubkeys) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(4)
Computes an aggregate public key and uses it to initialize a keyagg_cache.
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_musig_nonce_process(const secp256k1_context *ctx, secp256k1_musig_session *session, const secp256k1_musig_aggnonce *aggnonce, const unsigned char *msg32, const secp256k1_musig_keyagg_cache *keyagg_cache) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4) SECP256K1_ARG_NONNULL(5)
Takes the aggregate nonce and creates a session that is required for signing and verification of part...
SECP256K1_API int secp256k1_musig_pubnonce_serialize(const secp256k1_context *ctx, unsigned char *out66, const secp256k1_musig_pubnonce *nonce) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
Serialize a signer's public nonce.
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_schnorrsig_verify(const secp256k1_context *ctx, const unsigned char *sig64, const unsigned char *msg, size_t msglen, const secp256k1_xonly_pubkey *pubkey) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(5)
Verify a Schnorr signature.
static void secp256k1_musig_secnonce_save(secp256k1_musig_secnonce *secnonce, const secp256k1_scalar *k, const secp256k1_ge *pk)
static int secp256k1_musig_sum_pubnonces(const secp256k1_context *ctx, secp256k1_gej *summed_pubnonces, const secp256k1_musig_pubnonce *const *pubnonces, size_t n_pubnonces)
static void secp256k1_nonce_function_musig(secp256k1_scalar *k, const unsigned char *session_secrand, const unsigned char *msg32, const unsigned char *seckey32, const unsigned char *pk33, const unsigned char *agg_pk32, const unsigned char *extra_input32)
static void secp256k1_musig_compute_noncehash_sha256_tagged(secp256k1_sha256 *sha)
static void secp256k1_nonce_function_musig_sha256_tagged_aux(secp256k1_sha256 *sha)
static void secp256k1_nonce_function_musig_sha256_tagged(secp256k1_sha256 *sha)
static int secp256k1_musig_aggnonce_load(const secp256k1_context *ctx, secp256k1_ge *ges, const secp256k1_musig_aggnonce *nonce)
static void secp256k1_musig_pubnonce_save(secp256k1_musig_pubnonce *nonce, const secp256k1_ge *ges)
unsigned char expected[32]
struct musig_key_agg_error_test_case error_case[5]
unsigned char pubkeys[7][33]
struct musig_key_agg_valid_test_case valid_case[4]
unsigned char tweaks[2][32]
unsigned char expected[66]
unsigned char pnonces[7][66]
struct musig_nonce_agg_test_case error_case[3]
struct musig_nonce_agg_test_case valid_case[2]
unsigned char extra_in[32]
unsigned char expected_pubnonce[66]
unsigned char expected_secnonce[97]
struct musig_nonce_gen_test_case test_case[2]
unsigned char expected[64]
unsigned char aggnonce[66]
unsigned char pubkeys[4][33]
unsigned char tweaks[3][32]
unsigned char psigs[9][32]
struct musig_sig_agg_case error_case[1]
struct musig_sig_agg_case valid_case[4]
struct musig_verify_fail_error_case verify_fail_case[3]
struct musig_sign_error_case sign_error_case[6]
struct musig_verify_fail_error_case verify_error_case[2]
unsigned char msgs[1][32]
unsigned char aggnonces[5][66]
unsigned char secnonces[2][194]
unsigned char pubkeys[4][33]
unsigned char pubnonces[5][194]
struct musig_valid_case valid_case[4]
unsigned char expected[32]
unsigned char secnonce[97]
struct musig_tweak_case valid_case[5]
unsigned char aggnonce[66]
unsigned char pubnonces[3][194]
unsigned char pubkeys[3][33]
unsigned char tweaks[5][32]
struct musig_tweak_case error_case[1]
unsigned char expected[32]
A group element in affine coordinates on the secp256k1 curve, or occasionally on an isomorphic curve ...
A group element of the secp256k1 curve, in jacobian coordinates.
Opaque data structure that holds a keypair consisting of a secret and a public key.
Opaque data structure that holds an aggregate public nonce.
This module implements BIP 327 "MuSig2 for BIP340-compatible Multi-Signatures" (https://github....
Opaque data structure that holds a partial MuSig signature.
Opaque data structure that holds a signer's public nonce.
Opaque data structure that holds a signer's secret nonce.
Opaque data structure that holds a MuSig session.
Opaque data structure that holds a parsed and valid public key.
A scalar modulo the group order of the secp256k1 curve.
Opaque data structure that holds a parsed and valid "x-only" public key.
static void testrand_flip(unsigned char *b, size_t len)
Flip a single random bit in a byte array.
static void testrand256(unsigned char *b32)
Generate a pseudorandom 32-byte array.
static SECP256K1_INLINE uint64_t testrand_bits(int bits)
Generate a pseudorandom number in the range [0..2**bits-1].
static void testrand_bytes_test(unsigned char *bytes, size_t len)
Generate pseudorandom bytes with long sequences of zero and one bits.
#define CHECK_ILLEGAL(ctx, expr)
static secp256k1_context * CTX
static void test_sha256_tag_midstate(secp256k1_sha256 *sha_tagged, const unsigned char *tag, size_t taglen)
static secp256k1_context * STATIC_CTX
static void testutil_random_ge_test(secp256k1_ge *ge)
static const struct musig_sig_agg_vector musig_sig_agg_vector
static const struct musig_tweak_vector musig_tweak_vector
static const struct musig_nonce_agg_vector musig_nonce_agg_vector
MUSIG_ERROR
Automatically generated by .
@ MUSIG_VECTORS_MAX_PUBKEYS
static const struct musig_key_agg_vector musig_key_agg_vector
static const struct musig_nonce_gen_vector musig_nonce_gen_vector
static const struct musig_sign_verify_vector musig_sign_verify_vector