Bitcoin Core 32.99.0
P2P Digital Currency
Classes | Macros | Functions | Variables
tests.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <time.h>
#include "secp256k1.c"
#include "../include/secp256k1.h"
#include "../include/secp256k1_preallocated.h"
#include "testrand_impl.h"
#include "checkmem.h"
#include "testutil.h"
#include "util.h"
#include "unit_test.h"
#include "unit_test.c"
#include "../contrib/lax_der_parsing.c"
#include "../contrib/lax_der_privatekey_parsing.c"
#include "modinv32_impl.h"
#include "wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.h"
Include dependency graph for tests.c:

Go to the source code of this file.

Classes

struct  test_hsort_cmp_data
 
struct  ecmult_multi_data
 

Macros

#define CONDITIONAL_TEST(cnt, nam)   if (COUNT < (cnt)) { printf("Skipping %s (iteration count too low)\n", nam); } else
 
#define CHECK_COUNTING_CALLBACK_VOID(ctx, expr_or_stmt, callback, callback_setter)
 
#define CHECK_ERROR_VOID(ctx, expr_or_stmt)    CHECK_COUNTING_CALLBACK_VOID(ctx, expr_or_stmt, error_callback, secp256k1_context_set_error_callback)
 
#define CHECK_ILLEGAL_VOID(ctx, expr_or_stmt)    CHECK_COUNTING_CALLBACK_VOID(ctx, expr_or_stmt, illegal_callback, secp256k1_context_set_illegal_callback)
 
#define CHECK_ILLEGAL(ctx, expr)   CHECK_ILLEGAL_VOID(ctx, CHECK((expr) == 0))
 
#define CHECK_ERROR(ctx, expr)   CHECK_ERROR_VOID(ctx, CHECK((expr) == 0))
 
#define NUM   65
 
#define MAX_ELEMENT_LEN   65
 
#define SECP256K1_EC_PARSE_TEST_NVALID   (12)
 
#define SECP256K1_EC_PARSE_TEST_NXVALID   (4)
 
#define SECP256K1_EC_PARSE_TEST_NINVALID   (7)
 

Functions

static int all_bytes_equal (const void *s, unsigned char value, size_t n)
 
static void counting_callback_fn (const char *str, void *data)
 
static void run_xoshiro256pp_tests (void)
 
static void run_selftest_tests (void)
 
static int ecmult_gen_context_eq (const secp256k1_ecmult_gen_context *a, const secp256k1_ecmult_gen_context *b)
 
static int context_eq (const secp256k1_context *a, const secp256k1_context *b)
 
static void run_deprecated_context_flags_test (void)
 
static void run_ec_illegal_argument_tests (void)
 
static void run_static_context_tests (int use_prealloc)
 
static void run_all_static_context_tests (void)
 
static void run_proper_context_tests (int use_prealloc)
 
static void run_all_proper_context_tests (void)
 
static void run_scratch_tests (void)
 
static void run_invalid_scratch_space_tests (void)
 
static void invalid_sha256_compression (uint32_t *s, const unsigned char *msg, size_t rounds)
 
static void good_sha256_compression (uint32_t *s, const unsigned char *msg, size_t rounds)
 
static void run_plug_sha256_compression_tests (void)
 
static void sha256_transform_noadvance (uint32_t *s, const unsigned char *chunk, size_t blocks)
 
static void sha256_transform_short (uint32_t *s, const unsigned char *chunk, size_t blocks)
 
static void sha256_transform_ivreset (uint32_t *s, const unsigned char *chunk, size_t blocks)
 
static void sha256_transform_batch4 (uint32_t *s, const unsigned char *chunk, size_t blocks)
 
static void sha256_transform_corrupt (uint32_t *s, const unsigned char *chunk, size_t blocks)
 
static void run_sha256_compression_smoke_test_tests (void)
 
static void run_sha256_multi_block_compression_tests (void)
 
static void run_ctz_tests (void)
 
static void run_sha256_known_output_tests (void)
 
static void run_sha256_counter_tests (void)
 SHA256 counter tests. More...
 
static void test_sha256_eq (const secp256k1_sha256 *sha1, const secp256k1_sha256 *sha2)
 
static void test_sha256_tag_midstate (const secp256k1_hash_ctx *hash_ctx, secp256k1_sha256 *sha_tagged, const unsigned char *tag, size_t taglen)
 
static void run_hmac_sha256_tests (void)
 
static void run_rfc6979_hmac_sha256_tests (void)
 
static void run_tagged_sha256_tests (void)
 
static void run_sha256_initialize_midstate_tests (void)
 
static uint64_t modinv2p64 (uint64_t x)
 
static void mulmod256 (uint16_t *out, const uint16_t *a, const uint16_t *b, const uint16_t *m)
 
static void uint16_to_signed30 (secp256k1_modinv32_signed30 *out, const uint16_t *in)
 
static void signed30_to_uint16 (uint16_t *out, const secp256k1_modinv32_signed30 *in)
 
static void mutate_sign_signed30 (secp256k1_modinv32_signed30 *x)
 
static void test_modinv32_uint16 (uint16_t *out, const uint16_t *in, const uint16_t *mod)
 
static int coprime (const uint16_t *a, const uint16_t *b)
 
static void run_modinv_tests (void)
 
static void scalar_test (void)
 
static void run_scalar_set_b32_seckey_tests (void)
 
static void test_scalar_check_overflow (void)
 
static void run_scalar_tests (void)
 
static void random_fe_non_square (secp256k1_fe *ns)
 
static int fe_equal (const secp256k1_fe *a, const secp256k1_fe *b)
 
static void run_fe_equal_magnitude_boundaries (void)
 
static void run_field_convert (void)
 
static void run_field_be32_overflow (void)
 
static int fe_identical (const secp256k1_fe *a, const secp256k1_fe *b)
 
static void run_field_half (void)
 
static void run_field_misc (void)
 
static void test_fe_mul (const secp256k1_fe *a, const secp256k1_fe *b, int use_sqr)
 
static void run_fe_mul (void)
 
static void run_sqr (void)
 
static void test_sqrt (const secp256k1_fe *a, const secp256k1_fe *k)
 
static void run_sqrt (void)
 
static void test_inverse_scalar (secp256k1_scalar *out, const secp256k1_scalar *x, int var)
 
static void test_inverse_field (secp256k1_fe *out, const secp256k1_fe *x, int var)
 
static void run_inverse_tests (void)
 
static void test_heap_swap (void)
 
static void test_hsort_is_sorted (unsigned char *elements, size_t n, size_t len)
 
static int test_hsort_cmp (const void *ele1, const void *ele2, void *data)
 
static void test_hsort (size_t element_len)
 
static void run_hsort_tests (void)
 
static int gej_xyz_equals_gej (const secp256k1_gej *a, const secp256k1_gej *b)
 
static void test_ge (void)
 
static void test_initialized_inf (void)
 
static void test_add_neg_y_diff_x (void)
 
static void test_ge_bytes (void)
 
static void run_ge (void)
 
static void test_gej_cmov (const secp256k1_gej *a, const secp256k1_gej *b)
 
static void run_gej (void)
 
static void test_ec_combine (void)
 
static void run_ec_combine (void)
 
static void test_group_decompress (const secp256k1_fe *x)
 
static void run_group_decompress (void)
 
static void test_pre_g_table (const secp256k1_ge_storage *pre_g, size_t n)
 
static void run_ecmult_pre_g (void)
 
static void run_ecmult_chain (void)
 
static void test_point_times_order (const secp256k1_gej *point)
 
static void test_ecmult_target (const secp256k1_scalar *target, int mode)
 
static void run_ecmult_near_split_bound (void)
 
static void run_point_times_order (void)
 
static void ecmult_const_random_mult (void)
 
static void ecmult_const_commutativity (void)
 
static void ecmult_const_mult_zero_one (void)
 
static void ecmult_const_check_result (const secp256k1_ge *A, const secp256k1_scalar *q, const secp256k1_gej *res)
 
static void ecmult_const_edges (void)
 
static void ecmult_const_mult_xonly (void)
 
static void ecmult_const_chain_multiply (void)
 
static void run_ecmult_const_tests (void)
 
static int ecmult_multi_callback (secp256k1_scalar *sc, secp256k1_ge *pt, size_t idx, void *cbdata)
 
static int ecmult_multi_false_callback (secp256k1_scalar *sc, secp256k1_ge *pt, size_t idx, void *cbdata)
 
static void test_ecmult_multi (secp256k1_scratch *scratch, secp256k1_ecmult_multi_func ecmult_multi)
 
static int test_ecmult_multi_random (secp256k1_scratch *scratch)
 
static void test_ecmult_multi_batch_single (secp256k1_ecmult_multi_func ecmult_multi)
 
static void test_secp256k1_pippenger_bucket_window_inv (void)
 
static void test_ecmult_multi_pippenger_max_points (void)
 Probabilistically test the function returning the maximum number of possible points for a given scratch space. More...
 
static void test_ecmult_multi_batch_size_helper (void)
 
static void test_ecmult_multi_batching (void)
 Run secp256k1_ecmult_multi_var with num points and a scratch space restricted to 1 <= i <= num points. More...
 
static void run_ecmult_multi_tests (void)
 
static void test_wnaf (const secp256k1_scalar *number, int w)
 
static void test_fixed_wnaf (const secp256k1_scalar *number, int w)
 
static void test_fixed_wnaf_small_helper (int *wnaf, int *wnaf_expected, int w)
 
static void test_fixed_wnaf_small (void)
 
static void run_wnaf (void)
 
static int test_ecmult_accumulate_cb (secp256k1_scalar *sc, secp256k1_ge *pt, size_t idx, void *data)
 
static void test_ecmult_accumulate (secp256k1_sha256 *acc, const secp256k1_scalar *x, secp256k1_scratch *scratch)
 
static void test_ecmult_constants_2bit (void)
 
static void test_ecmult_constants_sha (uint32_t prefix, size_t iter, const unsigned char *expected32)
 
static void run_ecmult_constants (void)
 
static void run_ecmult_gen_ge (void)
 
static void test_ecmult_gen_blind (void)
 
static void test_ecmult_gen_blind_reset (void)
 
static void test_ecmult_gen_edge_cases (void)
 
static void run_ecmult_gen_blind (void)
 
static void test_scalar_split (const secp256k1_scalar *full)
 
static void run_endomorphism_tests (void)
 
static void ec_pubkey_parse_pointtest (const unsigned char *input, int xvalid, int yvalid)
 
static void run_ec_pubkey_parse_test (void)
 
static void run_eckey_edge_case_test (void)
 
static void run_eckey_negate_test (void)
 
static void random_sign (secp256k1_scalar *sigr, secp256k1_scalar *sigs, const secp256k1_scalar *key, const secp256k1_scalar *msg, int *recid)
 
static void test_ecdsa_sign_verify (void)
 
static void run_ecdsa_sign_verify (void)
 
static int precomputed_nonce_function (unsigned char *nonce32, const unsigned char *msg32, const unsigned char *key32, const unsigned char *algo16, void *data, unsigned int counter)
 Dummy nonce generation function that just uses a precomputed nonce, and fails if it is not accepted. More...
 
static int nonce_function_test_fail (unsigned char *nonce32, const unsigned char *msg32, const unsigned char *key32, const unsigned char *algo16, void *data, unsigned int counter)
 
static int nonce_function_test_retry (unsigned char *nonce32, const unsigned char *msg32, const unsigned char *key32, const unsigned char *algo16, void *data, unsigned int counter)
 
static int is_empty_signature (const secp256k1_ecdsa_signature *sig)
 
static void test_ecdsa_end_to_end (void)
 
static void test_random_pubkeys (void)
 
static void run_pubkey_comparison (void)
 
static void test_sort_helper (secp256k1_pubkey *pk, size_t *pk_order, size_t n_pk)
 
static void permute (size_t *arr, size_t n)
 
static void test_sort_api (void)
 
static void test_sort (void)
 
static void test_sort_vectors (void)
 
static void run_pubkey_sort (void)
 
static void run_random_pubkeys (void)
 
static void run_ecdsa_end_to_end (void)
 
static int test_ecdsa_der_parse (const unsigned char *sig, size_t siglen, int certainly_der, int certainly_not_der)
 
static void assign_big_endian (unsigned char *ptr, size_t ptrlen, uint32_t val)
 
static void damage_array (unsigned char *sig, size_t *len)
 
static void random_ber_signature (unsigned char *sig, size_t *len, int *certainly_der, int *certainly_not_der)
 
static void run_ecdsa_der_parse (void)
 
static size_t der_long_form_body (unsigned char *buf)
 
static size_t der_padded_integer (unsigned char *buf)
 
static void der_long_form_check (const secp256k1_ecdsa_signature *sig)
 
static void run_ecdsa_der_parse_long_form (void)
 
static void run_ecdsa_edge_cases (void)
 
static void ecdsa_ctx_sha256 (void)
 
static void test_ecdsa_wycheproof (void)
 Wycheproof tests. More...
 
static void run_ecdsa_wycheproof (void)
 
static void run_secp256k1_memczero_test (void)
 
static void run_secp256k1_is_zero_array_test (void)
 
static void run_secp256k1_byteorder_tests (void)
 
static void int_cmov_test (void)
 
static void fe_cmov_test (void)
 
static void fe_storage_cmov_test (void)
 
static void scalar_cmov_test (void)
 
static void ge_storage_cmov_test (void)
 
static void run_cmov_tests (void)
 
static int setup (void)
 
static int teardown (void)
 
int main (int argc, char **argv)
 

Variables

static secp256k1_contextCTX = NULL
 
static secp256k1_contextSTATIC_CTX = NULL
 
static int own_transform_called = 0
 
static const secp256k1_scalar scalar_minus_one
 
static const secp256k1_fe fe_minus_one
 
static const secp256k1_scalar scalars_near_split_bounds [20]
 
static const struct tf_test_entry tests_no_rng []
 
static const struct tf_test_module registry_modules_no_rng = MAKE_TEST_MODULE(no_rng)
 
static const struct tf_test_entry tests_general []
 
static const struct tf_test_entry tests_integer []
 
static const struct tf_test_entry tests_hash []
 
static const struct tf_test_entry tests_scalar []
 
static const struct tf_test_entry tests_field []
 
static const struct tf_test_entry tests_group []
 
static const struct tf_test_entry tests_ecmult []
 
static const struct tf_test_entry tests_ec []
 
static const struct tf_test_entry tests_ecdsa []
 
static const struct tf_test_entry tests_utils []
 
static const struct tf_test_module registry_modules []
 

Macro Definition Documentation

◆ CHECK_COUNTING_CALLBACK_VOID

#define CHECK_COUNTING_CALLBACK_VOID (   ctx,
  expr_or_stmt,
  callback,
  callback_setter 
)
Value:
do { \
int32_t _calls_to_callback = 0; \
secp256k1_callback _saved_callback = ctx->callback; \
callback_setter(ctx, counting_callback_fn, &_calls_to_callback); \
{ expr_or_stmt; } \
ctx->callback = _saved_callback; \
CHECK(_calls_to_callback == 1); \
} while(0);
static void counting_callback_fn(const char *str, void *data)
Definition: tests.c:88

Definition at line 63 of file tests.c.

◆ CHECK_ERROR

#define CHECK_ERROR (   ctx,
  expr 
)    CHECK_ERROR_VOID(ctx, CHECK((expr) == 0))

Definition at line 86 of file tests.c.

◆ CHECK_ERROR_VOID

#define CHECK_ERROR_VOID (   ctx,
  expr_or_stmt 
)     CHECK_COUNTING_CALLBACK_VOID(ctx, expr_or_stmt, error_callback, secp256k1_context_set_error_callback)

Definition at line 75 of file tests.c.

◆ CHECK_ILLEGAL

#define CHECK_ILLEGAL (   ctx,
  expr 
)    CHECK_ILLEGAL_VOID(ctx, CHECK((expr) == 0))

Definition at line 85 of file tests.c.

◆ CHECK_ILLEGAL_VOID

#define CHECK_ILLEGAL_VOID (   ctx,
  expr_or_stmt 
)     CHECK_COUNTING_CALLBACK_VOID(ctx, expr_or_stmt, illegal_callback, secp256k1_context_set_illegal_callback)

Definition at line 77 of file tests.c.

◆ CONDITIONAL_TEST

#define CONDITIONAL_TEST (   cnt,
  nam 
)    if (COUNT < (cnt)) { printf("Skipping %s (iteration count too low)\n", nam); } else

Definition at line 46 of file tests.c.

◆ MAX_ELEMENT_LEN

#define MAX_ELEMENT_LEN   65

Definition at line 3906 of file tests.c.

◆ NUM

#define NUM   65

Definition at line 3905 of file tests.c.

◆ SECP256K1_EC_PARSE_TEST_NINVALID

#define SECP256K1_EC_PARSE_TEST_NINVALID   (7)

◆ SECP256K1_EC_PARSE_TEST_NVALID

#define SECP256K1_EC_PARSE_TEST_NVALID   (12)

◆ SECP256K1_EC_PARSE_TEST_NXVALID

#define SECP256K1_EC_PARSE_TEST_NXVALID   (4)

Function Documentation

◆ all_bytes_equal()

static int all_bytes_equal ( const void *  s,
unsigned char  value,
size_t  n 
)
static

Definition at line 51 of file tests.c.

Here is the caller graph for this function:

◆ assign_big_endian()

static void assign_big_endian ( unsigned char *  ptr,
size_t  ptrlen,
uint32_t  val 
)
static

Definition at line 7187 of file tests.c.

Here is the caller graph for this function:

◆ context_eq()

static int context_eq ( const secp256k1_context a,
const secp256k1_context b 
)
static

Definition at line 138 of file tests.c.

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

◆ coprime()

static int coprime ( const uint16_t *  a,
const uint16_t *  b 
)
static

Definition at line 1274 of file tests.c.

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

◆ counting_callback_fn()

static void counting_callback_fn ( const char *  str,
void *  data 
)
static

Definition at line 88 of file tests.c.

Here is the caller graph for this function:

◆ damage_array()

static void damage_array ( unsigned char *  sig,
size_t *  len 
)
static

Definition at line 7199 of file tests.c.

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

◆ der_long_form_body()

static size_t der_long_form_body ( unsigned char *  buf)
static

Definition at line 7407 of file tests.c.

Here is the caller graph for this function:

◆ der_long_form_check()

static void der_long_form_check ( const secp256k1_ecdsa_signature sig)
static

Definition at line 7440 of file tests.c.

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

◆ der_padded_integer()

static size_t der_padded_integer ( unsigned char *  buf)
static

Definition at line 7425 of file tests.c.

Here is the caller graph for this function:

◆ ec_pubkey_parse_pointtest()

static void ec_pubkey_parse_pointtest ( const unsigned char *  input,
int  xvalid,
int  yvalid 
)
static

Definition at line 6015 of file tests.c.

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

◆ ecdsa_ctx_sha256()

static void ecdsa_ctx_sha256 ( void  )
static

Definition at line 7852 of file tests.c.

Here is the call graph for this function:

◆ ecmult_const_chain_multiply()

static void ecmult_const_chain_multiply ( void  )
static

Definition at line 4914 of file tests.c.

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

◆ ecmult_const_check_result()

static void ecmult_const_check_result ( const secp256k1_ge A,
const secp256k1_scalar q,
const secp256k1_gej res 
)
static

Definition at line 4823 of file tests.c.

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

◆ ecmult_const_commutativity()

static void ecmult_const_commutativity ( void  )
static

Definition at line 4769 of file tests.c.

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

◆ ecmult_const_edges()

static void ecmult_const_edges ( void  )
static

Definition at line 4832 of file tests.c.

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

◆ ecmult_const_mult_xonly()

static void ecmult_const_mult_xonly ( void  )
static

Definition at line 4859 of file tests.c.

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

◆ ecmult_const_mult_zero_one()

static void ecmult_const_mult_zero_one ( void  )
static

Definition at line 4790 of file tests.c.

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

◆ ecmult_const_random_mult()

static void ecmult_const_random_mult ( void  )
static

Definition at line 4742 of file tests.c.

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

◆ ecmult_gen_context_eq()

static int ecmult_gen_context_eq ( const secp256k1_ecmult_gen_context a,
const secp256k1_ecmult_gen_context b 
)
static

Definition at line 131 of file tests.c.

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

◆ ecmult_multi_callback()

static int ecmult_multi_callback ( secp256k1_scalar sc,
secp256k1_ge pt,
size_t  idx,
void *  cbdata 
)
static

Definition at line 4954 of file tests.c.

Here is the caller graph for this function:

◆ ecmult_multi_false_callback()

static int ecmult_multi_false_callback ( secp256k1_scalar sc,
secp256k1_ge pt,
size_t  idx,
void *  cbdata 
)
static

Definition at line 4961 of file tests.c.

Here is the caller graph for this function:

◆ fe_cmov_test()

static void fe_cmov_test ( void  )
static

Definition at line 8019 of file tests.c.

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

◆ fe_equal()

static int fe_equal ( const secp256k1_fe a,
const secp256k1_fe b 
)
static

Definition at line 3137 of file tests.c.

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

◆ fe_identical()

static int fe_identical ( const secp256k1_fe a,
const secp256k1_fe b 
)
static

Definition at line 3253 of file tests.c.

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

◆ fe_storage_cmov_test()

static void fe_storage_cmov_test ( void  )
static

Definition at line 8049 of file tests.c.

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

◆ ge_storage_cmov_test()

static void ge_storage_cmov_test ( void  )
static

Definition at line 8107 of file tests.c.

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

◆ gej_xyz_equals_gej()

static int gej_xyz_equals_gej ( const secp256k1_gej a,
const secp256k1_gej b 
)
static

Definition at line 3946 of file tests.c.

Here is the caller graph for this function:

◆ good_sha256_compression()

static void good_sha256_compression ( uint32_t *  s,
const unsigned char *  msg,
size_t  rounds 
)
static

Definition at line 454 of file tests.c.

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

◆ int_cmov_test()

static void int_cmov_test ( void  )
static

Definition at line 7994 of file tests.c.

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

◆ invalid_sha256_compression()

static void invalid_sha256_compression ( uint32_t *  s,
const unsigned char *  msg,
size_t  rounds 
)
static

Definition at line 449 of file tests.c.

Here is the caller graph for this function:

◆ is_empty_signature()

static int is_empty_signature ( const secp256k1_ecdsa_signature sig)
static

Definition at line 6703 of file tests.c.

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

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 8318 of file tests.c.

Here is the call graph for this function:

◆ modinv2p64()

static uint64_t modinv2p64 ( uint64_t  x)
static

Definition at line 989 of file tests.c.

Here is the caller graph for this function:

◆ mulmod256()

static void mulmod256 ( uint16_t *  out,
const uint16_t *  a,
const uint16_t *  b,
const uint16_t *  m 
)
static

Definition at line 1006 of file tests.c.

Here is the caller graph for this function:

◆ mutate_sign_signed30()

static void mutate_sign_signed30 ( secp256k1_modinv32_signed30 x)
static

Definition at line 1108 of file tests.c.

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

◆ nonce_function_test_fail()

static int nonce_function_test_fail ( unsigned char *  nonce32,
const unsigned char *  msg32,
const unsigned char *  key32,
const unsigned char *  algo16,
void *  data,
unsigned int  counter 
)
static

Definition at line 6671 of file tests.c.

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

◆ nonce_function_test_retry()

static int nonce_function_test_retry ( unsigned char *  nonce32,
const unsigned char *  msg32,
const unsigned char *  key32,
const unsigned char *  algo16,
void *  data,
unsigned int  counter 
)
static

Definition at line 6679 of file tests.c.

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

◆ permute()

static void permute ( size_t *  arr,
size_t  n 
)
static

Definition at line 6971 of file tests.c.

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

◆ precomputed_nonce_function()

static int precomputed_nonce_function ( unsigned char *  nonce32,
const unsigned char *  msg32,
const unsigned char *  key32,
const unsigned char *  algo16,
void *  data,
unsigned int  counter 
)
static

Dummy nonce generation function that just uses a precomputed nonce, and fails if it is not accepted.

Use only for testing.

Definition at line 6663 of file tests.c.

Here is the caller graph for this function:

◆ random_ber_signature()

static void random_ber_signature ( unsigned char *  sig,
size_t *  len,
int *  certainly_der,
int *  certainly_not_der 
)
static

Definition at line 7226 of file tests.c.

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

◆ random_fe_non_square()

static void random_fe_non_square ( secp256k1_fe ns)
static

Definition at line 3129 of file tests.c.

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

◆ random_sign()

static void random_sign ( secp256k1_scalar sigr,
secp256k1_scalar sigs,
const secp256k1_scalar key,
const secp256k1_scalar msg,
int *  recid 
)
static

Definition at line 6623 of file tests.c.

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

◆ run_all_proper_context_tests()

static void run_all_proper_context_tests ( void  )
static

Definition at line 361 of file tests.c.

Here is the call graph for this function:

◆ run_all_static_context_tests()

static void run_all_static_context_tests ( void  )
static

Definition at line 235 of file tests.c.

Here is the call graph for this function:

◆ run_cmov_tests()

static void run_cmov_tests ( void  )
static

Definition at line 8139 of file tests.c.

Here is the call graph for this function:

◆ run_ctz_tests()

static void run_ctz_tests ( void  )
static

Definition at line 661 of file tests.c.

Here is the call graph for this function:

◆ run_deprecated_context_flags_test()

static void run_deprecated_context_flags_test ( void  )
static

Definition at line 148 of file tests.c.

Here is the call graph for this function:

◆ run_ec_combine()

static void run_ec_combine ( void  )
static

Definition at line 4420 of file tests.c.

Here is the call graph for this function:

◆ run_ec_illegal_argument_tests()

static void run_ec_illegal_argument_tests ( void  )
static

Definition at line 166 of file tests.c.

Here is the call graph for this function:

◆ run_ec_pubkey_parse_test()

static void run_ec_pubkey_parse_test ( void  )
static

Definition at line 6082 of file tests.c.

Here is the call graph for this function:

◆ run_ecdsa_der_parse()

static void run_ecdsa_der_parse ( void  )
static

Definition at line 7372 of file tests.c.

Here is the call graph for this function:

◆ run_ecdsa_der_parse_long_form()

static void run_ecdsa_der_parse_long_form ( void  )
static

Definition at line 7458 of file tests.c.

Here is the call graph for this function:

◆ run_ecdsa_edge_cases()

static void run_ecdsa_edge_cases ( void  )
static

Definition at line 7520 of file tests.c.

Here is the call graph for this function:

◆ run_ecdsa_end_to_end()

static void run_ecdsa_end_to_end ( void  )
static

Definition at line 7120 of file tests.c.

Here is the call graph for this function:

◆ run_ecdsa_sign_verify()

static void run_ecdsa_sign_verify ( void  )
static

Definition at line 6655 of file tests.c.

Here is the call graph for this function:

◆ run_ecdsa_wycheproof()

static void run_ecdsa_wycheproof ( void  )
static

Definition at line 7907 of file tests.c.

Here is the call graph for this function:

◆ run_eckey_edge_case_test()

static void run_eckey_edge_case_test ( void  )
static

Definition at line 6367 of file tests.c.

Here is the call graph for this function:

◆ run_eckey_negate_test()

static void run_eckey_negate_test ( void  )
static

Definition at line 6593 of file tests.c.

Here is the call graph for this function:

◆ run_ecmult_chain()

static void run_ecmult_chain ( void  )
static

Definition at line 4547 of file tests.c.

Here is the call graph for this function:

◆ run_ecmult_const_tests()

static void run_ecmult_const_tests ( void  )
static

Definition at line 4940 of file tests.c.

Here is the call graph for this function:

◆ run_ecmult_constants()

static void run_ecmult_constants ( void  )
static

Definition at line 5849 of file tests.c.

Here is the call graph for this function:

◆ run_ecmult_gen_blind()

static void run_ecmult_gen_blind ( void  )
static

Definition at line 5957 of file tests.c.

Here is the call graph for this function:

◆ run_ecmult_gen_ge()

static void run_ecmult_gen_ge ( void  )
static

Definition at line 5883 of file tests.c.

Here is the call graph for this function:

◆ run_ecmult_multi_tests()

static void run_ecmult_multi_tests ( void  )
static

Definition at line 5542 of file tests.c.

Here is the call graph for this function:

◆ run_ecmult_near_split_bound()

static void run_ecmult_near_split_bound ( void  )
static

Definition at line 4709 of file tests.c.

Here is the call graph for this function:

◆ run_ecmult_pre_g()

static void run_ecmult_pre_g ( void  )
static

Definition at line 4523 of file tests.c.

Here is the call graph for this function:

◆ run_endomorphism_tests()

static void run_endomorphism_tests ( void  )
static

Definition at line 5994 of file tests.c.

Here is the call graph for this function:

◆ run_fe_equal_magnitude_boundaries()

static void run_fe_equal_magnitude_boundaries ( void  )
static

Definition at line 3144 of file tests.c.

Here is the call graph for this function:

◆ run_fe_mul()

static void run_fe_mul ( void  )
static

Definition at line 3459 of file tests.c.

Here is the call graph for this function:

◆ run_field_be32_overflow()

static void run_field_be32_overflow ( void  )
static

Definition at line 3186 of file tests.c.

Here is the call graph for this function:

◆ run_field_convert()

static void run_field_convert ( void  )
static

Definition at line 3156 of file tests.c.

Here is the call graph for this function:

◆ run_field_half()

static void run_field_half ( void  )
static

Definition at line 3260 of file tests.c.

Here is the call graph for this function:

◆ run_field_misc()

static void run_field_misc ( void  )
static

Definition at line 3309 of file tests.c.

Here is the call graph for this function:

◆ run_ge()

static void run_ge ( void  )
static

Definition at line 4344 of file tests.c.

Here is the call graph for this function:

◆ run_gej()

static void run_gej ( void  )
static

Definition at line 4362 of file tests.c.

Here is the call graph for this function:

◆ run_group_decompress()

static void run_group_decompress ( void  )
static

Definition at line 4462 of file tests.c.

Here is the call graph for this function:

◆ run_hmac_sha256_tests()

static void run_hmac_sha256_tests ( void  )
static

Definition at line 861 of file tests.c.

Here is the call graph for this function:

◆ run_hsort_tests()

static void run_hsort_tests ( void  )
static

Definition at line 3936 of file tests.c.

Here is the call graph for this function:

◆ run_invalid_scratch_space_tests()

static void run_invalid_scratch_space_tests ( void  )
static

Definition at line 434 of file tests.c.

Here is the call graph for this function:

◆ run_inverse_tests()

static void run_inverse_tests ( void  )
static

Definition at line 3625 of file tests.c.

Here is the call graph for this function:

◆ run_modinv_tests()

static void run_modinv_tests ( void  )
static

Definition at line 1304 of file tests.c.

Here is the call graph for this function:

◆ run_plug_sha256_compression_tests()

static void run_plug_sha256_compression_tests ( void  )
static

Definition at line 459 of file tests.c.

Here is the call graph for this function:

◆ run_point_times_order()

static void run_point_times_order ( void  )
static

Definition at line 4721 of file tests.c.

Here is the call graph for this function:

◆ run_proper_context_tests()

static void run_proper_context_tests ( int  use_prealloc)
static

Definition at line 241 of file tests.c.

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

◆ run_pubkey_comparison()

static void run_pubkey_comparison ( void  )
static

Definition at line 6913 of file tests.c.

Here is the call graph for this function:

◆ run_pubkey_sort()

static void run_pubkey_sort ( void  )
static

Definition at line 7106 of file tests.c.

Here is the call graph for this function:

◆ run_random_pubkeys()

static void run_random_pubkeys ( void  )
static

Definition at line 7113 of file tests.c.

Here is the call graph for this function:

◆ run_rfc6979_hmac_sha256_tests()

static void run_rfc6979_hmac_sha256_tests ( void  )
static

Definition at line 906 of file tests.c.

Here is the call graph for this function:

◆ run_scalar_set_b32_seckey_tests()

static void run_scalar_set_b32_seckey_tests ( void  )
static

Definition at line 2423 of file tests.c.

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

◆ run_scalar_tests()

static void run_scalar_tests ( void  )
static

Definition at line 2487 of file tests.c.

Here is the call graph for this function:

◆ run_scratch_tests()

static void run_scratch_tests ( void  )
static

Definition at line 367 of file tests.c.

Here is the call graph for this function:

◆ run_secp256k1_byteorder_tests()

static void run_secp256k1_byteorder_tests ( void  )
static

Definition at line 7966 of file tests.c.

Here is the call graph for this function:

◆ run_secp256k1_is_zero_array_test()

static void run_secp256k1_is_zero_array_test ( void  )
static

Definition at line 7955 of file tests.c.

Here is the call graph for this function:

◆ run_secp256k1_memczero_test()

static void run_secp256k1_memczero_test ( void  )
static

Definition at line 7939 of file tests.c.

Here is the call graph for this function:

◆ run_selftest_tests()

static void run_selftest_tests ( void  )
static

Definition at line 126 of file tests.c.

Here is the call graph for this function:

◆ run_sha256_compression_smoke_test_tests()

static void run_sha256_compression_smoke_test_tests ( void  )
static

Definition at line 554 of file tests.c.

Here is the call graph for this function:

◆ run_sha256_counter_tests()

static void run_sha256_counter_tests ( void  )
static

SHA256 counter tests.

The tests verify that the SHA256 counter doesn't wrap around at message length 2^i bytes for i = 20, ..., 33. This wide range aims at being independent of the implementation of the counter and it catches multiple natural 32-bit overflows (e.g., counting bits, counting bytes, counting blocks, ...).

The test vectors have been generated using following Python script which relies on https://github.com/cloudtools/sha256/ (v0.3 on Python v3.10.2).

from sha256 import sha256
from copy import copy
def midstate_c_definition(hasher):
ret = ' {{0x' + hasher.state[0].hex('_', 4).replace('_', ', 0x') + '},\n'
ret += ' {0x00}, ' + str(hex(hasher.state[1])) + '}'
return ret
def output_c_literal(hasher):
return '{0x' + hasher.digest().hex('_').replace('_', ', 0x') + '}'
MESSAGE = b'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmno'
assert(len(MESSAGE) == 64)
BYTE_BOUNDARIES = [(2**b)//len(MESSAGE) - 1 for b in range(20, 34)]
midstates = []
digests = []
hasher = sha256()
for i in range(BYTE_BOUNDARIES[-1] + 1):
if i in BYTE_BOUNDARIES:
midstates.append(midstate_c_definition(hasher))
hasher_copy = copy(hasher)
hasher_copy.update(MESSAGE)
digests.append(output_c_literal(hasher_copy))
hasher.update(MESSAGE)
for x in midstates:
print(x + ',')
for x in digests:
print(x + ',')
int ret
if(!SetupNetworking())
for(const auto &cache :caches)
Internal SHA-256 implementation.
Definition: sha256.cpp:68
assert(!tx.IsCoinBase())

Definition at line 784 of file tests.c.

Here is the call graph for this function:

◆ run_sha256_initialize_midstate_tests()

static void run_sha256_initialize_midstate_tests ( void  )
static

Definition at line 972 of file tests.c.

Here is the call graph for this function:

◆ run_sha256_known_output_tests()

static void run_sha256_known_output_tests ( void  )
static

Definition at line 682 of file tests.c.

Here is the call graph for this function:

◆ run_sha256_multi_block_compression_tests()

static void run_sha256_multi_block_compression_tests ( void  )
static

Definition at line 568 of file tests.c.

Here is the call graph for this function:

◆ run_sqr()

static void run_sqr ( void  )
static

Definition at line 3480 of file tests.c.

Here is the call graph for this function:

◆ run_sqrt()

static void run_sqrt ( void  )
static

Definition at line 3523 of file tests.c.

Here is the call graph for this function:

◆ run_static_context_tests()

static void run_static_context_tests ( int  use_prealloc)
static

Definition at line 197 of file tests.c.

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

◆ run_tagged_sha256_tests()

static void run_tagged_sha256_tests ( void  )
static

Definition at line 948 of file tests.c.

Here is the call graph for this function:

◆ run_wnaf()

static void run_wnaf ( void  )
static

Definition at line 5703 of file tests.c.

Here is the call graph for this function:

◆ run_xoshiro256pp_tests()

static void run_xoshiro256pp_tests ( void  )
static

Definition at line 97 of file tests.c.

Here is the call graph for this function:

◆ scalar_cmov_test()

static void scalar_cmov_test ( void  )
static

Definition at line 8079 of file tests.c.

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

◆ scalar_test()

static void scalar_test ( void  )
static

Definition at line 2268 of file tests.c.

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

◆ setup()

static int setup ( void  )
static

Definition at line 8289 of file tests.c.

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

◆ sha256_transform_batch4()

static void sha256_transform_batch4 ( uint32_t *  s,
const unsigned char *  chunk,
size_t  blocks 
)
static

Definition at line 517 of file tests.c.

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

◆ sha256_transform_corrupt()

static void sha256_transform_corrupt ( uint32_t *  s,
const unsigned char *  chunk,
size_t  blocks 
)
static

Definition at line 522 of file tests.c.

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

◆ sha256_transform_ivreset()

static void sha256_transform_ivreset ( uint32_t *  s,
const unsigned char *  chunk,
size_t  blocks 
)
static

Definition at line 509 of file tests.c.

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

◆ sha256_transform_noadvance()

static void sha256_transform_noadvance ( uint32_t *  s,
const unsigned char *  chunk,
size_t  blocks 
)
static

Definition at line 496 of file tests.c.

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

◆ sha256_transform_short()

static void sha256_transform_short ( uint32_t *  s,
const unsigned char *  chunk,
size_t  blocks 
)
static

Definition at line 504 of file tests.c.

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

◆ signed30_to_uint16()

static void signed30_to_uint16 ( uint16_t *  out,
const secp256k1_modinv32_signed30 in 
)
static

Definition at line 1099 of file tests.c.

Here is the caller graph for this function:

◆ teardown()

static int teardown ( void  )
static

Definition at line 8312 of file tests.c.

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

◆ test_add_neg_y_diff_x()

static void test_add_neg_y_diff_x ( void  )
static

Definition at line 4256 of file tests.c.

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

◆ test_ec_combine()

static void test_ec_combine ( void  )
static

Definition at line 4398 of file tests.c.

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

◆ test_ecdsa_der_parse()

static int test_ecdsa_der_parse ( const unsigned char *  sig,
size_t  siglen,
int  certainly_der,
int  certainly_not_der 
)
static

Definition at line 7127 of file tests.c.

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

◆ test_ecdsa_end_to_end()

static void test_ecdsa_end_to_end ( void  )
static

Definition at line 6708 of file tests.c.

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

◆ test_ecdsa_sign_verify()

static void test_ecdsa_sign_verify ( void  )
static

Definition at line 6630 of file tests.c.

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

◆ test_ecdsa_wycheproof()

static void test_ecdsa_wycheproof ( void  )
static

Wycheproof tests.

The tests check for known attacks (range checks in (r,s), arithmetic errors, malleability).

Definition at line 7876 of file tests.c.

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

◆ test_ecmult_accumulate()

static void test_ecmult_accumulate ( secp256k1_sha256 acc,
const secp256k1_scalar x,
secp256k1_scratch scratch 
)
static

Definition at line 5730 of file tests.c.

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

◆ test_ecmult_accumulate_cb()

static int test_ecmult_accumulate_cb ( secp256k1_scalar sc,
secp256k1_ge pt,
size_t  idx,
void *  data 
)
static

Definition at line 5722 of file tests.c.

Here is the caller graph for this function:

◆ test_ecmult_constants_2bit()

static void test_ecmult_constants_2bit ( void  )
static

Definition at line 5761 of file tests.c.

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

◆ test_ecmult_constants_sha()

static void test_ecmult_constants_sha ( uint32_t  prefix,
size_t  iter,
const unsigned char *  expected32 
)
static

Definition at line 5805 of file tests.c.

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

◆ test_ecmult_gen_blind()

static void test_ecmult_gen_blind ( void  )
static

Definition at line 5902 of file tests.c.

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

◆ test_ecmult_gen_blind_reset()

static void test_ecmult_gen_blind_reset ( void  )
static

Definition at line 5925 of file tests.c.

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

◆ test_ecmult_gen_edge_cases()

static void test_ecmult_gen_edge_cases ( void  )
static

Definition at line 5939 of file tests.c.

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

◆ test_ecmult_multi()

static void test_ecmult_multi ( secp256k1_scratch scratch,
secp256k1_ecmult_multi_func  ecmult_multi 
)
static

Definition at line 4969 of file tests.c.

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

◆ test_ecmult_multi_batch_single()

static void test_ecmult_multi_batch_single ( secp256k1_ecmult_multi_func  ecmult_multi)
static

Definition at line 5358 of file tests.c.

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

◆ test_ecmult_multi_batch_size_helper()

static void test_ecmult_multi_batch_size_helper ( void  )
static

Definition at line 5429 of file tests.c.

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

◆ test_ecmult_multi_batching()

static void test_ecmult_multi_batching ( void  )
static

Run secp256k1_ecmult_multi_var with num points and a scratch space restricted to 1 <= i <= num points.

Definition at line 5477 of file tests.c.

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

◆ test_ecmult_multi_pippenger_max_points()

static void test_ecmult_multi_pippenger_max_points ( void  )
static

Probabilistically test the function returning the maximum number of possible points for a given scratch space.

Definition at line 5396 of file tests.c.

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

◆ test_ecmult_multi_random()

static int test_ecmult_multi_random ( secp256k1_scratch scratch)
static

Definition at line 5192 of file tests.c.

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

◆ test_ecmult_target()

static void test_ecmult_target ( const secp256k1_scalar target,
int  mode 
)
static

Definition at line 4671 of file tests.c.

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

◆ test_fe_mul()

static void test_fe_mul ( const secp256k1_fe a,
const secp256k1_fe b,
int  use_sqr 
)
static

Definition at line 3416 of file tests.c.

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

◆ test_fixed_wnaf()

static void test_fixed_wnaf ( const secp256k1_scalar number,
int  w 
)
static

Definition at line 5603 of file tests.c.

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

◆ test_fixed_wnaf_small()

static void test_fixed_wnaf_small ( void  )
static

Definition at line 5649 of file tests.c.

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

◆ test_fixed_wnaf_small_helper()

static void test_fixed_wnaf_small_helper ( int *  wnaf,
int *  wnaf_expected,
int  w 
)
static

Definition at line 5639 of file tests.c.

Here is the caller graph for this function:

◆ test_ge()

static void test_ge ( void  )
static

Definition at line 3967 of file tests.c.

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

◆ test_ge_bytes()

static void test_ge_bytes ( void  )
static

Definition at line 4316 of file tests.c.

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

◆ test_gej_cmov()

static void test_gej_cmov ( const secp256k1_gej a,
const secp256k1_gej b 
)
static

Definition at line 4354 of file tests.c.

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

◆ test_group_decompress()

static void test_group_decompress ( const secp256k1_fe x)
static

Definition at line 4427 of file tests.c.

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

◆ test_heap_swap()

static void test_heap_swap ( void  )
static

Definition at line 3873 of file tests.c.

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

◆ test_hsort()

static void test_hsort ( size_t  element_len)
static

Definition at line 3907 of file tests.c.

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

◆ test_hsort_cmp()

static int test_hsort_cmp ( const void *  ele1,
const void *  ele2,
void *  data 
)
static

Definition at line 3899 of file tests.c.

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

◆ test_hsort_is_sorted()

static void test_hsort_is_sorted ( unsigned char *  elements,
size_t  n,
size_t  len 
)
static

Definition at line 3886 of file tests.c.

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

◆ test_initialized_inf()

static void test_initialized_inf ( void  )
static

Definition at line 4224 of file tests.c.

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

◆ test_inverse_field()

static void test_inverse_field ( secp256k1_fe out,
const secp256k1_fe x,
int  var 
)
static

Definition at line 3600 of file tests.c.

Here is the caller graph for this function:

◆ test_inverse_scalar()

static void test_inverse_scalar ( secp256k1_scalar out,
const secp256k1_scalar x,
int  var 
)
static

Definition at line 3578 of file tests.c.

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

◆ test_modinv32_uint16()

static void test_modinv32_uint16 ( uint16_t *  out,
const uint16_t *  in,
const uint16_t *  mod 
)
static

Definition at line 1123 of file tests.c.

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

◆ test_point_times_order()

static void test_point_times_order ( const secp256k1_gej point)
static

Definition at line 4606 of file tests.c.

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

◆ test_pre_g_table()

static void test_pre_g_table ( const secp256k1_ge_storage pre_g,
size_t  n 
)
static

Definition at line 4473 of file tests.c.

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

◆ test_random_pubkeys()

static void test_random_pubkeys ( void  )
static

Definition at line 6851 of file tests.c.

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

◆ test_scalar_check_overflow()

static void test_scalar_check_overflow ( void  )
static

Definition at line 2440 of file tests.c.

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

◆ test_scalar_split()

static void test_scalar_split ( const secp256k1_scalar full)
static

Definition at line 5967 of file tests.c.

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

◆ test_secp256k1_pippenger_bucket_window_inv()

static void test_secp256k1_pippenger_bucket_window_inv ( void  )
static

Definition at line 5376 of file tests.c.

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

◆ test_sha256_eq()

static void test_sha256_eq ( const secp256k1_sha256 sha1,
const secp256k1_sha256 sha2 
)
static

Definition at line 846 of file tests.c.

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

◆ test_sha256_tag_midstate()

static void test_sha256_tag_midstate ( const secp256k1_hash_ctx hash_ctx,
secp256k1_sha256 sha_tagged,
const unsigned char *  tag,
size_t  taglen 
)
static

Definition at line 855 of file tests.c.

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

◆ test_sort()

static void test_sort ( void  )
static

Definition at line 7016 of file tests.c.

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

◆ test_sort_api()

static void test_sort_api ( void  )
static

Definition at line 6982 of file tests.c.

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

◆ test_sort_helper()

static void test_sort_helper ( secp256k1_pubkey pk,
size_t *  pk_order,
size_t  n_pk 
)
static

Definition at line 6958 of file tests.c.

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

◆ test_sort_vectors()

static void test_sort_vectors ( void  )
static

Definition at line 7062 of file tests.c.

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

◆ test_sqrt()

static void test_sqrt ( const secp256k1_fe a,
const secp256k1_fe k 
)
static

Definition at line 3509 of file tests.c.

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

◆ test_wnaf()

static void test_wnaf ( const secp256k1_scalar number,
int  w 
)
static

Definition at line 5569 of file tests.c.

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

◆ uint16_to_signed30()

static void uint16_to_signed30 ( secp256k1_modinv32_signed30 out,
const uint16_t *  in 
)
static

Definition at line 1090 of file tests.c.

Here is the caller graph for this function:

Variable Documentation

◆ CTX

secp256k1_context* CTX = NULL
static

Definition at line 48 of file tests.c.

◆ fe_minus_one

const secp256k1_fe fe_minus_one
static
Initial value:
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFC2E
)
#define SECP256K1_FE_CONST(d7, d6, d5, d4, d3, d2, d1, d0)
This expands to an initializer for a secp256k1_fe valued sum((i*32) * d_i, i=0..7) mod p.
Definition: field.h:66

Definition at line 3566 of file tests.c.

◆ own_transform_called

int own_transform_called = 0
static

Definition at line 453 of file tests.c.

◆ registry_modules

const struct tf_test_module registry_modules[]
static

Definition at line 8253 of file tests.c.

◆ registry_modules_no_rng

const struct tf_test_module registry_modules_no_rng = MAKE_TEST_MODULE(no_rng)
static

Definition at line 8155 of file tests.c.

◆ scalar_minus_one

const secp256k1_scalar scalar_minus_one
static
Initial value:
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFE,
0xBAAEDCE6, 0xAF48A03B, 0xBFD25E8C, 0xD0364140
)
#define SECP256K1_SCALAR_CONST(d7, d6, d5, d4, d3, d2, d1, d0)
Definition: scalar_4x64.h:17

Definition at line 3561 of file tests.c.

◆ scalars_near_split_bounds

const secp256k1_scalar scalars_near_split_bounds[20]
static
Initial value:
= {
SECP256K1_SCALAR_CONST(0xd938a566, 0x7f479e3e, 0xb5b3c7fa, 0xefdb3749, 0x3aa0585c, 0xc5ea2367, 0xe1b660db, 0x0209e6fc),
SECP256K1_SCALAR_CONST(0xd938a566, 0x7f479e3e, 0xb5b3c7fa, 0xefdb3749, 0x3aa0585c, 0xc5ea2367, 0xe1b660db, 0x0209e6fd),
SECP256K1_SCALAR_CONST(0xd938a566, 0x7f479e3e, 0xb5b3c7fa, 0xefdb3749, 0x3aa0585c, 0xc5ea2367, 0xe1b660db, 0x0209e6fe),
SECP256K1_SCALAR_CONST(0xd938a566, 0x7f479e3e, 0xb5b3c7fa, 0xefdb3749, 0x3aa0585c, 0xc5ea2367, 0xe1b660db, 0x0209e6ff),
SECP256K1_SCALAR_CONST(0x2c9c52b3, 0x3fa3cf1f, 0x5ad9e3fd, 0x77ed9ba5, 0xb294b893, 0x3722e9a5, 0x00e698ca, 0x4cf7632d),
SECP256K1_SCALAR_CONST(0x2c9c52b3, 0x3fa3cf1f, 0x5ad9e3fd, 0x77ed9ba5, 0xb294b893, 0x3722e9a5, 0x00e698ca, 0x4cf7632e),
SECP256K1_SCALAR_CONST(0x2c9c52b3, 0x3fa3cf1f, 0x5ad9e3fd, 0x77ed9ba5, 0xb294b893, 0x3722e9a5, 0x00e698ca, 0x4cf7632f),
SECP256K1_SCALAR_CONST(0x2c9c52b3, 0x3fa3cf1f, 0x5ad9e3fd, 0x77ed9ba5, 0xb294b893, 0x3722e9a5, 0x00e698ca, 0x4cf76330),
SECP256K1_SCALAR_CONST(0x7fffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xd576e735, 0x57a4501d, 0xdfe92f46, 0x681b209f),
SECP256K1_SCALAR_CONST(0x7fffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xd576e735, 0x57a4501d, 0xdfe92f46, 0x681b20a0),
SECP256K1_SCALAR_CONST(0x7fffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xd576e735, 0x57a4501d, 0xdfe92f46, 0x681b20a1),
SECP256K1_SCALAR_CONST(0x7fffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xd576e735, 0x57a4501d, 0xdfe92f46, 0x681b20a2),
SECP256K1_SCALAR_CONST(0xd363ad4c, 0xc05c30e0, 0xa5261c02, 0x88126459, 0xf85915d7, 0x7825b696, 0xbeebc5c2, 0x833ede11),
SECP256K1_SCALAR_CONST(0xd363ad4c, 0xc05c30e0, 0xa5261c02, 0x88126459, 0xf85915d7, 0x7825b696, 0xbeebc5c2, 0x833ede12),
SECP256K1_SCALAR_CONST(0xd363ad4c, 0xc05c30e0, 0xa5261c02, 0x88126459, 0xf85915d7, 0x7825b696, 0xbeebc5c2, 0x833ede13),
SECP256K1_SCALAR_CONST(0xd363ad4c, 0xc05c30e0, 0xa5261c02, 0x88126459, 0xf85915d7, 0x7825b696, 0xbeebc5c2, 0x833ede14),
SECP256K1_SCALAR_CONST(0x26c75a99, 0x80b861c1, 0x4a4c3805, 0x1024c8b4, 0x704d760e, 0xe95e7cd3, 0xde1bfdb1, 0xce2c5a42),
SECP256K1_SCALAR_CONST(0x26c75a99, 0x80b861c1, 0x4a4c3805, 0x1024c8b4, 0x704d760e, 0xe95e7cd3, 0xde1bfdb1, 0xce2c5a43),
SECP256K1_SCALAR_CONST(0x26c75a99, 0x80b861c1, 0x4a4c3805, 0x1024c8b4, 0x704d760e, 0xe95e7cd3, 0xde1bfdb1, 0xce2c5a44),
}

Definition at line 4648 of file tests.c.

◆ STATIC_CTX

secp256k1_context* STATIC_CTX = NULL
static

Definition at line 49 of file tests.c.

◆ tests_ec

const struct tf_test_entry tests_ec[]
static
Initial value:
= {
CASE(endomorphism_tests),
CASE(ec_pubkey_parse_test),
CASE(eckey_edge_case_test),
CASE(eckey_negate_test),
}
#define CASE(name)
Definition: unit_test.h:26

Definition at line 8223 of file tests.c.

◆ tests_ecdsa

const struct tf_test_entry tests_ecdsa[]
static
Initial value:
= {
CASE(ec_illegal_argument_tests),
CASE(pubkey_comparison),
CASE(pubkey_sort),
CASE(random_pubkeys),
CASE(ecdsa_der_parse),
CASE(ecdsa_der_parse_long_form),
CASE(ecdsa_sign_verify),
CASE(ecdsa_end_to_end),
CASE(ecdsa_edge_cases),
CASE(ecdsa_wycheproof),
}
static void ecdsa_ctx_sha256(void)
Definition: tests.c:7852
#define CASE1(name)
Definition: unit_test.h:27

Definition at line 8230 of file tests.c.

◆ tests_ecmult

const struct tf_test_entry tests_ecmult[]
static
Initial value:
= {
CASE(ecmult_pre_g),
CASE(wnaf),
CASE(point_times_order),
CASE(ecmult_near_split_bound),
CASE(ecmult_chain),
CASE(ecmult_constants),
CASE(ecmult_gen_ge),
CASE(ecmult_gen_blind),
CASE(ecmult_const_tests),
CASE(ecmult_multi_tests),
CASE(ec_combine),
}

Definition at line 8209 of file tests.c.

◆ tests_field

const struct tf_test_entry tests_field[]
static
Initial value:
= {
CASE(field_half),
CASE(field_misc),
CASE(fe_equal_magnitude_boundaries),
CASE(field_convert),
CASE(field_be32_overflow),
CASE(fe_mul),
CASE(sqr),
CASE(sqrt),
}

Definition at line 8192 of file tests.c.

◆ tests_general

const struct tf_test_entry tests_general[]
static
Initial value:
= {
CASE(selftest_tests),
CASE(all_proper_context_tests),
CASE(all_static_context_tests),
CASE(deprecated_context_flags_test),
CASE(scratch_tests),
CASE(invalid_scratch_space_tests),
CASE(plug_sha256_compression_tests),
CASE(sha256_compression_smoke_test_tests),
CASE(sha256_multi_block_compression_tests),
}

Definition at line 8158 of file tests.c.

◆ tests_group

const struct tf_test_entry tests_group[]
static
Initial value:
= {
CASE(ge),
CASE(gej),
CASE(group_decompress),
}

Definition at line 8203 of file tests.c.

◆ tests_hash

const struct tf_test_entry tests_hash[]
static
Initial value:
= {
CASE(sha256_known_output_tests),
CASE(sha256_counter_tests),
CASE(hmac_sha256_tests),
CASE(rfc6979_hmac_sha256_tests),
CASE(tagged_sha256_tests),
CASE(sha256_initialize_midstate_tests),
}

Definition at line 8179 of file tests.c.

◆ tests_integer

const struct tf_test_entry tests_integer[]
static
Initial value:
= {
CASE(ctz_tests),
CASE(modinv_tests),
CASE(inverse_tests),
}

Definition at line 8170 of file tests.c.

◆ tests_no_rng

const struct tf_test_entry tests_no_rng[]
static
Initial value:
= {
CASE(xoshiro256pp_tests),
}

Definition at line 8152 of file tests.c.

◆ tests_scalar

const struct tf_test_entry tests_scalar[]
static
Initial value:
= {
CASE(scalar_tests),
}

Definition at line 8188 of file tests.c.

◆ tests_utils

const struct tf_test_entry tests_utils[]
static
Initial value:
= {
CASE(hsort_tests),
CASE(secp256k1_memczero_test),
CASE(secp256k1_is_zero_array_test),
CASE(secp256k1_byteorder_tests),
CASE(cmov_tests),
}

Definition at line 8244 of file tests.c.