6#ifndef SECP256K1_TESTUTIL_H
7#define SECP256K1_TESTUTIL_H
15#define DEFINE_SHA256_TRANSFORM_PROBE(name) \
16 static int name##_called = 0; \
17 static void name(uint32_t *s, const unsigned char *msg, size_t rounds) { \
19 secp256k1_sha256_transform(s, msg, rounds); \
25 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
26 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe,
27 0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b,
28 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, 0x41
32 unsigned char bin[32];
49 int n = testrand_int(
m + 1);
59 CHECK(fe->magnitude == n);
64 unsigned char bin[32];
66 testrand256_test(bin);
103 if (secp256k1_ge_set_xo_var(ge, &fe, testrand_bits(1))) {
113 secp256k1_gej_set_ge(gej, ge);
114 secp256k1_gej_rescale(gej, &z);
126 secp256k1_pubkey_save(pk, &ge);
131 unsigned char b32[32];
133 testrand256_test(b32);
134 secp256k1_scalar_set_b32(num, b32, &overflow);
135 if (overflow || secp256k1_scalar_is_zero(num)) {
144 unsigned char b32[32];
147 secp256k1_scalar_set_b32(num, b32, &overflow);
148 if (overflow || secp256k1_scalar_is_zero(num)) {
158 secp256k1_scalar_get_b32(b32, &num);
#define secp256k1_fe_negate(r, a, m)
Negate a field element.
#define secp256k1_fe_is_zero
#define secp256k1_fe_mul_int_unchecked
#define secp256k1_fe_set_b32_limit
#define secp256k1_fe_normalize
#define secp256k1_fe_set_int(r, a)
Set a field element to an integer in range [0,0x7FFF].
#define SECP256K1_GE_X_MAGNITUDE_MAX
Maximum allowed magnitudes for group element coordinates in affine (x, y) and jacobian (x,...
#define SECP256K1_GEJ_Y_MAGNITUDE_MAX
#define SECP256K1_GE_Y_MAGNITUDE_MAX
#define SECP256K1_GEJ_Z_MAGNITUDE_MAX
#define SECP256K1_GEJ_X_MAGNITUDE_MAX
#define CHECK(cond)
Unconditional failure on condition failure.
This field implementation represents the value as 10 uint32_t limbs in base 2^26.
A group element in affine coordinates on the secp256k1 curve, or occasionally on an isomorphic curve ...
A group element of the secp256k1 curve, in jacobian coordinates.
Opaque data structure that holds a parsed and valid public key.
A scalar modulo the group order of the secp256k1 curve.
static void testutil_random_fe_test(secp256k1_fe *x)
static void testutil_random_pubkey_test(secp256k1_pubkey *pk)
static void testutil_random_gej_y_magnitude(secp256k1_gej *gej)
static const unsigned char secp256k1_group_order_bytes[32]
static void testutil_random_fe_non_zero(secp256k1_fe *nz)
static void testutil_random_scalar_order(secp256k1_scalar *num)
static void testutil_random_gej_test(secp256k1_gej *gej)
static void testutil_random_scalar_order_test(secp256k1_scalar *num)
static void testutil_random_scalar_order_b32(unsigned char *b32)
static void testutil_random_fe(secp256k1_fe *x)
static void testutil_random_fe_non_zero_test(secp256k1_fe *fe)
static void testutil_random_gej_x_magnitude(secp256k1_gej *gej)
static void testutil_random_fe_magnitude(secp256k1_fe *fe, int m)
static void testutil_random_ge_x_magnitude(secp256k1_ge *ge)
static void testutil_random_gej_z_magnitude(secp256k1_gej *gej)
static void testutil_random_ge_test(secp256k1_ge *ge)
static void testutil_random_ge_y_magnitude(secp256k1_ge *ge)
static void testutil_random_ge_jacobian_test(secp256k1_gej *gej, const secp256k1_ge *ge)