Bitcoin Core 31.99.0
P2P Digital Currency
Functions | Variables
tests_impl.h File Reference
#include <stdlib.h>
#include <string.h>
#include "../../../include/secp256k1.h"
#include "../../../include/secp256k1_extrakeys.h"
#include "../../../include/secp256k1_musig.h"
#include "session.h"
#include "keyagg.h"
#include "../../scalar.h"
#include "../../field.h"
#include "../../group.h"
#include "../../hash.h"
#include "../../util.h"
#include "../../unit_test.h"
#include "vectors.h"
Include dependency graph for tests_impl.h:

Go to the source code of this file.

Functions

static int create_keypair_and_pk (secp256k1_keypair *keypair, secp256k1_pubkey *pk, const unsigned char *sk)
 
static void musig_simple_test_internal (void)
 
static void pubnonce_summing_to_inf (secp256k1_musig_pubnonce *pubnonce)
 
int memcmp_and_randomize (unsigned char *value, const unsigned char *expected, size_t len)
 
static void musig_api_tests (void)
 
static void musig_nonce_bitflip (const secp256k1_hash_ctx *hash_ctx, unsigned char **args, size_t n_flip, size_t n_bytes)
 
static void musig_nonce_test (void)
 
static void sha256_tag_test (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_tweak_test_internal (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_vectors_keyagg (void)
 
static void musig_test_vectors_noncegen (void)
 
static void musig_test_vectors_nonceagg (void)
 
static void musig_test_set_secnonce (secp256k1_musig_secnonce *secnonce, const unsigned char *secnonce64, const secp256k1_pubkey *pubkey)
 
static void musig_test_vectors_signverify (void)
 
static void musig_test_vectors_tweak (void)
 
static void musig_test_vectors_sigagg (void)
 
static void musig_test_static_nonce_gen_counter (void)
 

Variables

static const struct tf_test_entry tests_musig []
 

Function Documentation

◆ create_keypair_and_pk()

static int create_keypair_and_pk ( secp256k1_keypair keypair,
secp256k1_pubkey pk,
const unsigned char *  sk 
)
static

Definition at line 27 of file tests_impl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ memcmp_and_randomize()

int memcmp_and_randomize ( unsigned char *  value,
const unsigned char *  expected,
size_t  len 
)

Definition at line 112 of file tests_impl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ musig_api_tests()

static void musig_api_tests ( void  )
static

setup

main test body

Key aggregation

Tweaking

Session creation with nonce_gen

Session creation with nonce_gen_counter

Serialize and parse public nonces

Receive nonces and aggregate

Serialize and parse aggregate nonces

Process nonces

Partial signature verification

Signature aggregation and verification

Definition at line 122 of file tests_impl.h.

Here is the call graph for this function:

◆ musig_nonce_bitflip()

static void musig_nonce_bitflip ( const secp256k1_hash_ctx hash_ctx,
unsigned char **  args,
size_t  n_flip,
size_t  n_bytes 
)
static

Definition at line 508 of file tests_impl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ musig_nonce_test()

static void musig_nonce_test ( void  )
static

Definition at line 518 of file tests_impl.h.

Here is the call graph for this function:

◆ musig_simple_test_internal()

static void musig_simple_test_internal ( void  )
static

Definition at line 40 of file tests_impl.h.

Here is the call graph for this function:

◆ musig_test_set_secnonce()

static void musig_test_set_secnonce ( secp256k1_musig_secnonce secnonce,
const unsigned char *  secnonce64,
const secp256k1_pubkey pubkey 
)
static

Definition at line 877 of file tests_impl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ musig_test_static_nonce_gen_counter()

static void musig_test_static_nonce_gen_counter ( void  )
static

Definition at line 1095 of file tests_impl.h.

Here is the call graph for this function:

◆ musig_test_vectors_keyagg()

static void musig_test_vectors_keyagg ( void  )
static

Definition at line 770 of file tests_impl.h.

Here is the call graph for this function:

◆ musig_test_vectors_nonceagg()

static void musig_test_vectors_nonceagg ( void  )
static

Definition at line 847 of file tests_impl.h.

Here is the call graph for this function:

◆ musig_test_vectors_noncegen()

static void musig_test_vectors_noncegen ( void  )
static

Definition at line 794 of file tests_impl.h.

Here is the call graph for this function:

◆ musig_test_vectors_sigagg()

static void musig_test_vectors_sigagg ( void  )
static

Definition at line 1053 of file tests_impl.h.

Here is the call graph for this function:

◆ musig_test_vectors_signverify()

static void musig_test_vectors_signverify ( void  )
static

Definition at line 887 of file tests_impl.h.

Here is the call graph for this function:

◆ musig_test_vectors_tweak()

static void musig_test_vectors_tweak ( void  )
static

Definition at line 1010 of file tests_impl.h.

Here is the call graph for this function:

◆ musig_tweak_test_helper()

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

Definition at line 613 of file tests_impl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ musig_tweak_test_internal()

static void musig_tweak_test_internal ( void  )
static

Definition at line 656 of file tests_impl.h.

Here is the call graph for this function:

◆ musig_vectors_keyagg_and_tweak()

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 
)

Definition at line 709 of file tests_impl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pubnonce_summing_to_inf()

static void pubnonce_summing_to_inf ( secp256k1_musig_pubnonce pubnonce)
static

Definition at line 91 of file tests_impl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sha256_tag_test()

static void sha256_tag_test ( void  )
static

Definition at line 576 of file tests_impl.h.

Here is the call graph for this function:

Variable Documentation

◆ tests_musig

const struct tf_test_entry tests_musig[]
static
Initial value:
= {
CASE1(musig_simple_test),
CASE1(musig_tweak_test),
}
static void musig_test_vectors_keyagg(void)
Definition: tests_impl.h:770
static void musig_nonce_test(void)
Definition: tests_impl.h:518
static void sha256_tag_test(void)
Definition: tests_impl.h:576
static void musig_api_tests(void)
Definition: tests_impl.h:122
static void musig_test_vectors_sigagg(void)
Definition: tests_impl.h:1053
static void musig_test_vectors_signverify(void)
Definition: tests_impl.h:887
static void musig_test_static_nonce_gen_counter(void)
Definition: tests_impl.h:1095
static void musig_test_vectors_nonceagg(void)
Definition: tests_impl.h:847
static void musig_test_vectors_noncegen(void)
Definition: tests_impl.h:794
static void musig_test_vectors_tweak(void)
Definition: tests_impl.h:1010
#define CASE1(name)
Definition: unit_test.h:27

Definition at line 1146 of file tests_impl.h.