Fabcoin Core  0.16.2
P2P Digital Currency
Macros | Functions
tests.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "secp256k1.c"
#include "include/secp256k1.h"
#include "testrand_impl.h"
#include "contrib/lax_der_parsing.c"
#include "contrib/lax_der_privatekey_parsing.c"
Include dependency graph for tests.c:

Go to the source code of this file.

Macros

#define VG_UNDEF(x, y)
 
#define VG_CHECK(x, y)
 
#define SECP256K1_EC_PARSE_TEST_NVALID   (12)
 
#define SECP256K1_EC_PARSE_TEST_NXVALID   (4)
 
#define SECP256K1_EC_PARSE_TEST_NINVALID   (7)
 

Functions

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 run_context_tests (void)
 
void run_sha256_tests (void)
 
void run_hmac_sha256_tests (void)
 
void run_rfc6979_hmac_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)
 
void random_num_negate (secp256k1_num *num)
 
void random_num_order_test (secp256k1_num *num)
 
void random_num_order (secp256k1_num *num)
 
void test_num_negate (void)
 
void test_num_add_sub (void)
 
void test_num_mod (void)
 
void test_num_jacobi (void)
 
void run_num_smalltests (void)
 
void scalar_test (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)
 
int check_fe_inverse (const secp256k1_fe *a, const secp256k1_fe *ai)
 
void run_field_convert (void)
 
int fe_memcmp (const secp256k1_fe *a, const secp256k1_fe *b)
 
void run_field_misc (void)
 
void run_field_inv (void)
 
void run_field_inv_var (void)
 
void run_field_inv_all_var (void)
 
void run_sqr (void)
 
void test_sqrt (const secp256k1_fe *a, const secp256k1_fe *k)
 
void run_sqrt (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_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 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)
 
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 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 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 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)
 
int is_empty_signature (const secp256k1_ecdsa_signature *sig)
 
void test_ecdsa_end_to_end (void)
 
void test_random_pubkeys (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)
 
void run_ecdsa_der_parse (void)
 
void test_ecdsa_edge_cases (void)
 
void run_ecdsa_edge_cases (void)
 
int main (int argc, char **argv)
 

Macro Definition Documentation

#define SECP256K1_EC_PARSE_TEST_NINVALID   (7)
#define SECP256K1_EC_PARSE_TEST_NVALID   (12)
#define SECP256K1_EC_PARSE_TEST_NXVALID   (4)
#define VG_CHECK (   x,
 
)

Definition at line 38 of file tests.c.

#define VG_UNDEF (   x,
 
)

Definition at line 37 of file tests.c.

Function Documentation

int check_fe_equal ( const secp256k1_fe a,
const secp256k1_fe b 
)

Definition at line 1594 of file tests.c.

Here is the caller graph for this function:

int check_fe_inverse ( const secp256k1_fe a,
const secp256k1_fe ai 
)

Definition at line 1602 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 2712 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void ecmult_const_chain_multiply ( void  )

Definition at line 2457 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void ecmult_const_commutativity ( void  )

Definition at line 2414 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void ecmult_const_mult_zero_one ( void  )

Definition at line 2435 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void ecmult_const_random_mult ( void  )

Definition at line 2387 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int fe_memcmp ( const secp256k1_fe a,
const secp256k1_fe b 
)

Definition at line 1639 of file tests.c.

Here is the caller graph for this function:

void ge_equals_ge ( const secp256k1_ge a,
const secp256k1_ge b 
)

Definition at line 1832 of file tests.c.

Here is the caller graph for this function:

void ge_equals_gej ( const secp256k1_ge a,
const secp256k1_gej b 
)

Definition at line 1863 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int gej_xyz_equals_gej ( const secp256k1_gej a,
const secp256k1_gej b 
)

Definition at line 1842 of file tests.c.

Here is the caller graph for this function:

int is_empty_signature ( const secp256k1_ecdsa_signature sig)

Definition at line 3434 of file tests.c.

Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)

Definition at line 4410 of file tests.c.

Here is the call graph for this function:

void random_fe ( secp256k1_fe x)

Definition at line 1553 of file tests.c.

Here is the caller graph for this function:

void random_fe_non_square ( secp256k1_fe ns)

Definition at line 1586 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void random_fe_non_zero ( secp256k1_fe nz)

Definition at line 1573 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void random_fe_test ( secp256k1_fe x)

Definition at line 1563 of file tests.c.

Here is the caller graph for this function:

void random_field_element_magnitude ( secp256k1_fe fe)

Definition at line 71 of file tests.c.

Here is the caller graph for this function:

void random_field_element_test ( secp256k1_fe fe)

Definition at line 61 of file tests.c.

Here is the caller graph for this function:

void random_group_element_jacobian_test ( secp256k1_gej gej,
const secp256k1_ge ge 
)

Definition at line 96 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void random_group_element_test ( secp256k1_ge ge)

Definition at line 85 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void random_num_negate ( secp256k1_num num)

Definition at line 449 of file tests.c.

Here is the caller graph for this function:

void random_num_order ( secp256k1_num num)

Definition at line 461 of file tests.c.

Here is the call graph for this function:

void random_num_order_test ( secp256k1_num num)

Definition at line 455 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void random_scalar_order ( secp256k1_scalar num)

Definition at line 124 of file tests.c.

Here is the caller graph for this function:

void random_scalar_order_test ( secp256k1_scalar num)

Definition at line 111 of file tests.c.

Here is the caller graph for this function:

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

Definition at line 3350 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void run_context_tests ( void  )

Definition at line 137 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void run_ec_combine ( void  )

Definition at line 2184 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void run_ec_pubkey_parse_test ( void  )

Definition at line 2787 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void run_ecdsa_der_parse ( void  )

Definition at line 3941 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void run_ecdsa_edge_cases ( void  )

Definition at line 4342 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void run_ecdsa_end_to_end ( void  )

Definition at line 3637 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void run_ecdsa_sign_verify ( void  )

Definition at line 3380 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void run_eckey_edge_case_test ( void  )

Definition at line 3114 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void run_ecmult_chain ( void  )

Definition at line 2266 of file tests.c.

Here is the caller graph for this function:

void run_ecmult_const_tests ( void  )

Definition at line 2483 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void run_ecmult_constants ( void  )

Definition at line 2635 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void run_ecmult_gen_blind ( void  )

Definition at line 2674 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void run_field_convert ( void  )

Definition at line 1609 of file tests.c.

Here is the caller graph for this function:

void run_field_inv ( void  )

Definition at line 1720 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void run_field_inv_all_var ( void  )

Definition at line 1744 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void run_field_inv_var ( void  )

Definition at line 1732 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void run_field_misc ( void  )

Definition at line 1648 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void run_ge ( void  )

Definition at line 2151 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void run_group_decompress ( void  )

Definition at line 2255 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void run_hmac_sha256_tests ( void  )

Definition at line 289 of file tests.c.

Here is the caller graph for this function:

void run_num_smalltests ( void  )

Definition at line 621 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void run_point_times_order ( void  )

Definition at line 2365 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void run_rand_bits ( void  )

Definition at line 427 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void run_rand_int ( void  )

Definition at line 435 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void run_random_pubkeys ( void  )

Definition at line 3630 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void run_rfc6979_hmac_sha256_tests ( void  )

Definition at line 333 of file tests.c.

Here is the caller graph for this function:

void run_scalar_tests ( void  )

Definition at line 923 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void run_sha256_tests ( void  )

Definition at line 253 of file tests.c.

Here is the caller graph for this function:

void run_sqr ( void  )

Definition at line 1766 of file tests.c.

Here is the caller graph for this function:

void run_sqrt ( void  )

Definition at line 1796 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void run_wnaf ( void  )

Definition at line 2578 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void scalar_test ( void  )

Definition at line 634 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void test_add_neg_y_diff_x ( void  )

Definition at line 2084 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void test_constant_wnaf ( const secp256k1_scalar number,
int  w 
)

Definition at line 2539 of file tests.c.

Here is the caller graph for this function:

void test_constant_wnaf_negate ( const secp256k1_scalar number)

Definition at line 2524 of file tests.c.

Here is the caller graph for this function:

void test_ec_combine ( void  )

Definition at line 2159 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 3644 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void test_ecdsa_edge_cases ( void  )

Definition at line 3973 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void test_ecdsa_end_to_end ( void  )

Definition at line 3439 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void test_ecdsa_sign_verify ( void  )

Definition at line 3357 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void test_ecmult_constants ( void  )

Definition at line 2602 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void test_ecmult_gen_blind ( void  )

Definition at line 2639 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void test_ecmult_gen_blind_reset ( void  )

Definition at line 2662 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void test_ge ( void  )

Definition at line 1880 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void test_group_decompress ( const secp256k1_fe x)

Definition at line 2191 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void test_num_add_sub ( void  )

Definition at line 487 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void test_num_jacobi ( void  )

test large values with 5 as group order

test with secp group order as order

Definition at line 560 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void test_num_mod ( void  )

Definition at line 529 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void test_num_negate ( void  )

Definition at line 467 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void test_point_times_order ( const secp256k1_gej point)

Definition at line 2330 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void test_rand_bits ( int  rand32,
int  bits 
)

Definition at line 376 of file tests.c.

Here is the caller graph for this function:

void test_rand_int ( uint32_t  range,
uint32_t  subrange 
)

Definition at line 411 of file tests.c.

Here is the caller graph for this function:

void test_random_pubkeys ( void  )

Definition at line 3570 of file tests.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void test_sqrt ( const secp256k1_fe a,
const secp256k1_fe k 
)

Definition at line 1782 of file tests.c.

Here is the caller graph for this function:

void test_wnaf ( const secp256k1_scalar number,
int  w 
)

Definition at line 2490 of file tests.c.

Here is the caller graph for this function: