Bitcoin ABC 0.30.5
P2P Digital Currency
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "secp256k1.c"
#include "include/secp256k1.h"
#include "include/secp256k1_preallocated.h"
#include "testrand_impl.h"
#include "util.h"
#include "contrib/lax_der_parsing.c"
#include "contrib/lax_der_privatekey_parsing.c"
#include "modinv32_impl.h"
Go to the source code of this file.
Classes | |
struct | ecmult_multi_data |
Macros | |
#define | SECP256K1_EC_PARSE_TEST_NVALID (12) |
#define | SECP256K1_EC_PARSE_TEST_NXVALID (4) |
#define | SECP256K1_EC_PARSE_TEST_NINVALID (7) |
Functions | |
static void | counting_illegal_callback_fn (const char *str, void *data) |
static void | uncounting_illegal_callback_fn (const char *str, void *data) |
void | random_field_element_test (secp256k1_fe *fe) |
void | random_field_element_magnitude (secp256k1_fe *fe) |
void | random_group_element_test (secp256k1_ge *ge) |
void | random_group_element_jacobian_test (secp256k1_gej *gej, const secp256k1_ge *ge) |
void | random_scalar_order_test (secp256k1_scalar *num) |
void | random_scalar_order (secp256k1_scalar *num) |
void | random_scalar_order_b32 (unsigned char *b32) |
void | run_context_tests (int use_prealloc) |
void | run_scratch_tests (void) |
void | run_ctz_tests (void) |
void | run_sha256_tests (void) |
void | run_hmac_sha256_tests (void) |
void | run_rfc6979_hmac_sha256_tests (void) |
void | run_tagged_sha256_tests (void) |
void | test_rand_bits (int rand32, int bits) |
void | test_rand_int (uint32_t range, uint32_t subrange) |
void | run_rand_bits (void) |
void | run_rand_int (void) |
uint64_t | modinv2p64 (uint64_t x) |
void | mulmod256 (uint16_t *out, const uint16_t *a, const uint16_t *b, const uint16_t *m) |
void | uint16_to_signed30 (secp256k1_modinv32_signed30 *out, const uint16_t *in) |
void | signed30_to_uint16 (uint16_t *out, const secp256k1_modinv32_signed30 *in) |
void | mutate_sign_signed30 (secp256k1_modinv32_signed30 *x) |
void | test_modinv32_uint16 (uint16_t *out, const uint16_t *in, const uint16_t *mod) |
int | coprime (const uint16_t *a, const uint16_t *b) |
void | run_modinv_tests (void) |
void | scalar_test (void) |
void | run_scalar_set_b32_seckey_tests (void) |
void | run_scalar_tests (void) |
void | random_fe (secp256k1_fe *x) |
void | random_fe_test (secp256k1_fe *x) |
void | random_fe_non_zero (secp256k1_fe *nz) |
void | random_fe_non_square (secp256k1_fe *ns) |
int | check_fe_equal (const secp256k1_fe *a, const secp256k1_fe *b) |
void | run_field_convert (void) |
int | fe_secp256k1_memcmp_var (const secp256k1_fe *a, const secp256k1_fe *b) |
void | run_field_misc (void) |
void | run_sqr (void) |
void | test_sqrt (const secp256k1_fe *a, const secp256k1_fe *k) |
void | run_sqrt (void) |
void | test_inverse_scalar (secp256k1_scalar *out, const secp256k1_scalar *x, int var) |
void | test_inverse_field (secp256k1_fe *out, const secp256k1_fe *x, int var) |
void | run_inverse_tests (void) |
void | ge_equals_ge (const secp256k1_ge *a, const secp256k1_ge *b) |
int | gej_xyz_equals_gej (const secp256k1_gej *a, const secp256k1_gej *b) |
void | ge_equals_gej (const secp256k1_ge *a, const secp256k1_gej *b) |
void | test_ge (void) |
void | test_intialized_inf (void) |
void | test_add_neg_y_diff_x (void) |
void | run_ge (void) |
void | test_ec_combine (void) |
void | run_ec_combine (void) |
void | test_group_decompress (const secp256k1_fe *x) |
void | run_group_decompress (void) |
void | run_ecmult_chain (void) |
void | test_point_times_order (const secp256k1_gej *point) |
void | test_ecmult_target (const secp256k1_scalar *target, int mode) |
void | run_ecmult_near_split_bound (void) |
void | run_point_times_order (void) |
void | ecmult_const_random_mult (void) |
void | ecmult_const_commutativity (void) |
void | ecmult_const_mult_zero_one (void) |
void | ecmult_const_chain_multiply (void) |
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) |
void | test_ecmult_multi (secp256k1_scratch *scratch, secp256k1_ecmult_multi_func ecmult_multi) |
void | test_ecmult_multi_batch_single (secp256k1_ecmult_multi_func ecmult_multi) |
void | test_secp256k1_pippenger_bucket_window_inv (void) |
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... | |
void | test_ecmult_multi_batch_size_helper (void) |
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... | |
void | run_ecmult_multi_tests (void) |
void | test_wnaf (const secp256k1_scalar *number, int w) |
void | test_constant_wnaf_negate (const secp256k1_scalar *number) |
void | test_constant_wnaf (const secp256k1_scalar *number, int w) |
void | test_fixed_wnaf (const secp256k1_scalar *number, int w) |
void | test_fixed_wnaf_small_helper (int *wnaf, int *wnaf_expected, int w) |
void | test_fixed_wnaf_small (void) |
void | run_wnaf (void) |
void | test_ecmult_constants (void) |
void | run_ecmult_constants (void) |
void | test_ecmult_gen_blind (void) |
void | test_ecmult_gen_blind_reset (void) |
void | run_ecmult_gen_blind (void) |
void | test_scalar_split (const secp256k1_scalar *full) |
void | run_endomorphism_tests (void) |
void | ec_pubkey_parse_pointtest (const unsigned char *input, int xvalid, int yvalid) |
void | run_ec_pubkey_parse_test (void) |
void | run_eckey_edge_case_test (void) |
void | run_eckey_negate_test (void) |
void | random_sign (secp256k1_scalar *sigr, secp256k1_scalar *sigs, const secp256k1_scalar *key, const secp256k1_scalar *msg, int *recid) |
void | test_ecdsa_sign_verify (void) |
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) |
int | is_empty_signature (const secp256k1_ecdsa_signature *sig) |
void | test_ecdsa_end_to_end (void) |
void | test_random_pubkeys (void) |
void | run_pubkey_comparison (void) |
void | run_random_pubkeys (void) |
void | run_ecdsa_end_to_end (void) |
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) |
void | run_ecdsa_der_parse (void) |
void | test_ecdsa_edge_cases (void) |
void | run_ecdsa_edge_cases (void) |
void | run_secp256k1_memczero_test (void) |
void | int_cmov_test (void) |
void | fe_cmov_test (void) |
void | fe_storage_cmov_test (void) |
void | scalar_cmov_test (void) |
void | ge_storage_cmov_test (void) |
void | run_cmov_tests (void) |
int | main (int argc, char **argv) |
Variables | |
static int | count = 64 |
static secp256k1_context * | ctx = NULL |
static const secp256k1_scalar | scalar_minus_one |
static const secp256k1_fe | fe_minus_one |
static const secp256k1_scalar | scalars_near_split_bounds [20] |
#define SECP256K1_EC_PARSE_TEST_NINVALID (7) |
#define SECP256K1_EC_PARSE_TEST_NVALID (12) |
#define SECP256K1_EC_PARSE_TEST_NXVALID (4) |
|
static |
int check_fe_equal | ( | const secp256k1_fe * | a, |
const secp256k1_fe * | b | ||
) |
int coprime | ( | const uint16_t * | a, |
const uint16_t * | b | ||
) |
|
static |
|
static |
void ec_pubkey_parse_pointtest | ( | const unsigned char * | input, |
int | xvalid, | ||
int | yvalid | ||
) |
void ecmult_const_chain_multiply | ( | void | ) |
void ecmult_const_commutativity | ( | void | ) |
void ecmult_const_mult_zero_one | ( | void | ) |
void ecmult_const_random_mult | ( | void | ) |
|
static |
|
static |
void fe_cmov_test | ( | void | ) |
int fe_secp256k1_memcmp_var | ( | const secp256k1_fe * | a, |
const secp256k1_fe * | b | ||
) |
void fe_storage_cmov_test | ( | void | ) |
void ge_equals_ge | ( | const secp256k1_ge * | a, |
const secp256k1_ge * | b | ||
) |
void ge_equals_gej | ( | const secp256k1_ge * | a, |
const secp256k1_gej * | b | ||
) |
void ge_storage_cmov_test | ( | void | ) |
int gej_xyz_equals_gej | ( | const secp256k1_gej * | a, |
const secp256k1_gej * | b | ||
) |
void int_cmov_test | ( | void | ) |
int is_empty_signature | ( | const secp256k1_ecdsa_signature * | sig | ) |
uint64_t modinv2p64 | ( | uint64_t | x | ) |
void mulmod256 | ( | uint16_t * | out, |
const uint16_t * | a, | ||
const uint16_t * | b, | ||
const uint16_t * | m | ||
) |
void mutate_sign_signed30 | ( | secp256k1_modinv32_signed30 * | x | ) |
|
static |
|
static |
|
static |
|
static |
void random_fe | ( | secp256k1_fe * | x | ) |
void random_fe_non_square | ( | secp256k1_fe * | ns | ) |
void random_fe_non_zero | ( | secp256k1_fe * | nz | ) |
void random_fe_test | ( | secp256k1_fe * | x | ) |
void random_field_element_magnitude | ( | secp256k1_fe * | fe | ) |
void random_field_element_test | ( | secp256k1_fe * | fe | ) |
void random_group_element_jacobian_test | ( | secp256k1_gej * | gej, |
const secp256k1_ge * | ge | ||
) |
void random_group_element_test | ( | secp256k1_ge * | ge | ) |
void random_scalar_order | ( | secp256k1_scalar * | num | ) |
void random_scalar_order_b32 | ( | unsigned char * | b32 | ) |
void random_scalar_order_test | ( | secp256k1_scalar * | num | ) |
void random_sign | ( | secp256k1_scalar * | sigr, |
secp256k1_scalar * | sigs, | ||
const secp256k1_scalar * | key, | ||
const secp256k1_scalar * | msg, | ||
int * | recid | ||
) |
void run_cmov_tests | ( | void | ) |
void run_context_tests | ( | int | use_prealloc | ) |
void run_ctz_tests | ( | void | ) |
void run_ec_combine | ( | void | ) |
void run_ec_pubkey_parse_test | ( | void | ) |
void run_ecdsa_der_parse | ( | void | ) |
void run_ecdsa_edge_cases | ( | void | ) |
void run_ecdsa_end_to_end | ( | void | ) |
void run_ecdsa_sign_verify | ( | void | ) |
void run_eckey_edge_case_test | ( | void | ) |
void run_eckey_negate_test | ( | void | ) |
void run_ecmult_chain | ( | void | ) |
void run_ecmult_const_tests | ( | void | ) |
void run_ecmult_constants | ( | void | ) |
void run_ecmult_gen_blind | ( | void | ) |
void run_ecmult_multi_tests | ( | void | ) |
void run_ecmult_near_split_bound | ( | void | ) |
void run_endomorphism_tests | ( | void | ) |
void run_field_convert | ( | void | ) |
void run_field_misc | ( | void | ) |
void run_ge | ( | void | ) |
void run_group_decompress | ( | void | ) |
void run_hmac_sha256_tests | ( | void | ) |
void run_inverse_tests | ( | void | ) |
void run_modinv_tests | ( | void | ) |
void run_point_times_order | ( | void | ) |
void run_pubkey_comparison | ( | void | ) |
void run_rand_bits | ( | void | ) |
void run_rand_int | ( | void | ) |
void run_random_pubkeys | ( | void | ) |
void run_rfc6979_hmac_sha256_tests | ( | void | ) |
void run_scalar_set_b32_seckey_tests | ( | void | ) |
void run_scalar_tests | ( | void | ) |
void run_scratch_tests | ( | void | ) |
void run_secp256k1_memczero_test | ( | void | ) |
void run_sha256_tests | ( | void | ) |
void run_sqr | ( | void | ) |
void run_sqrt | ( | void | ) |
void run_tagged_sha256_tests | ( | void | ) |
void run_wnaf | ( | void | ) |
void scalar_cmov_test | ( | void | ) |
void scalar_test | ( | void | ) |
void signed30_to_uint16 | ( | uint16_t * | out, |
const secp256k1_modinv32_signed30 * | in | ||
) |
void test_add_neg_y_diff_x | ( | void | ) |
void test_constant_wnaf | ( | const secp256k1_scalar * | number, |
int | w | ||
) |
void test_constant_wnaf_negate | ( | const secp256k1_scalar * | number | ) |
void test_ec_combine | ( | void | ) |
int test_ecdsa_der_parse | ( | const unsigned char * | sig, |
size_t | siglen, | ||
int | certainly_der, | ||
int | certainly_not_der | ||
) |
void test_ecdsa_edge_cases | ( | void | ) |
void test_ecdsa_end_to_end | ( | void | ) |
void test_ecdsa_sign_verify | ( | void | ) |
void test_ecmult_constants | ( | void | ) |
void test_ecmult_gen_blind | ( | void | ) |
void test_ecmult_gen_blind_reset | ( | void | ) |
void test_ecmult_multi | ( | secp256k1_scratch * | scratch, |
secp256k1_ecmult_multi_func | ecmult_multi | ||
) |
void test_ecmult_multi_batch_single | ( | secp256k1_ecmult_multi_func | ecmult_multi | ) |
void test_ecmult_multi_batch_size_helper | ( | void | ) |
void test_ecmult_multi_batching | ( | void | ) |
void test_ecmult_multi_pippenger_max_points | ( | void | ) |
void test_ecmult_target | ( | const secp256k1_scalar * | target, |
int | mode | ||
) |
void test_fixed_wnaf | ( | const secp256k1_scalar * | number, |
int | w | ||
) |
void test_fixed_wnaf_small | ( | void | ) |
void test_fixed_wnaf_small_helper | ( | int * | wnaf, |
int * | wnaf_expected, | ||
int | w | ||
) |
void test_ge | ( | void | ) |
void test_group_decompress | ( | const secp256k1_fe * | x | ) |
void test_intialized_inf | ( | void | ) |
void test_inverse_field | ( | secp256k1_fe * | out, |
const secp256k1_fe * | x, | ||
int | var | ||
) |
void test_inverse_scalar | ( | secp256k1_scalar * | out, |
const secp256k1_scalar * | x, | ||
int | var | ||
) |
void test_modinv32_uint16 | ( | uint16_t * | out, |
const uint16_t * | in, | ||
const uint16_t * | mod | ||
) |
void test_point_times_order | ( | const secp256k1_gej * | point | ) |
void test_rand_bits | ( | int | rand32, |
int | bits | ||
) |
void test_rand_int | ( | uint32_t | range, |
uint32_t | subrange | ||
) |
void test_random_pubkeys | ( | void | ) |
void test_scalar_split | ( | const secp256k1_scalar * | full | ) |
void test_secp256k1_pippenger_bucket_window_inv | ( | void | ) |
void test_sqrt | ( | const secp256k1_fe * | a, |
const secp256k1_fe * | k | ||
) |
void test_wnaf | ( | const secp256k1_scalar * | number, |
int | w | ||
) |
void uint16_to_signed30 | ( | secp256k1_modinv32_signed30 * | out, |
const uint16_t * | in | ||
) |
|
static |
|
static |
|
static |
|
static |
|
static |