![]() |
Bitcoin Core 32.99.0
P2P Digital Currency
|
#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"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) |
Variables | |
| static secp256k1_context * | CTX = NULL |
| static secp256k1_context * | STATIC_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 [] |
| #define CHECK_COUNTING_CALLBACK_VOID | ( | ctx, | |
| expr_or_stmt, | |||
| callback, | |||
| callback_setter | |||
| ) |
| #define CHECK_ERROR | ( | ctx, | |
| expr | |||
| ) | CHECK_ERROR_VOID(ctx, CHECK((expr) == 0)) |
| #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 | ( | ctx, | |
| expr | |||
| ) | CHECK_ILLEGAL_VOID(ctx, CHECK((expr) == 0)) |
| #define CHECK_ILLEGAL_VOID | ( | ctx, | |
| expr_or_stmt | |||
| ) | CHECK_COUNTING_CALLBACK_VOID(ctx, expr_or_stmt, illegal_callback, secp256k1_context_set_illegal_callback) |
| #define SECP256K1_EC_PARSE_TEST_NINVALID (7) |
| #define SECP256K1_EC_PARSE_TEST_NVALID (12) |
| #define SECP256K1_EC_PARSE_TEST_NXVALID (4) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
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).
Definition at line 784 of file tests.c.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |