7 #ifndef SECP256K1_MODULE_EXTRAKEYS_TESTS_H
8 #define SECP256K1_MODULE_EXTRAKEYS_TESTS_H
26 unsigned char xy_sk[32];
27 unsigned char buf32[32];
28 unsigned char ones32[32];
29 unsigned char zeros64[64] = { 0 };
39 memset(ones32, 0xFF, 32);
54 memset(&pk, 0,
sizeof(pk));
59 memset(sk, 0,
sizeof(sk));
64 CHECK(pk_parity == 0);
72 CHECK(pk_parity == 1);
90 memset(&pk_tmp, 0,
sizeof(pk_tmp));
110 memset(&xonly_pk, 1,
sizeof(xonly_pk));
114 memset(&xonly_pk, 1,
sizeof(xonly_pk));
121 for (i = 0; i <
count; i++) {
122 unsigned char rand33[33];
126 memset(&xonly_pk, 1,
sizeof(xonly_pk));
141 unsigned char zeros64[64] = { 0 };
142 unsigned char overflows[32];
143 unsigned char sk[32];
148 unsigned char tweak[32];
156 memset(overflows, 0xff,
sizeof(overflows));
187 for (i = 0; i <
count; i++) {
200 memset(&internal_xonly_pk, 0,
sizeof(internal_xonly_pk));
213 unsigned char zeros64[64] = { 0 };
214 unsigned char overflows[32];
215 unsigned char sk[32];
220 unsigned char output_pk32[32];
221 unsigned char buf32[32];
223 unsigned char tweak[32];
230 memset(overflows, 0xff,
sizeof(overflows));
255 memset(tweak, 1,
sizeof(tweak));
284 unsigned char sk[32];
286 unsigned char pk_serialized[32];
295 memset(tweak[i], i + 1,
sizeof(tweak[i]));
313 unsigned char sk[32];
314 unsigned char sk_tmp[32];
315 unsigned char zeros96[96] = { 0 };
316 unsigned char overflows[32];
320 int pk_parity, pk_parity_tmp;
326 CHECK(
sizeof(zeros96) ==
sizeof(keypair));
327 memset(overflows, 0xFF,
sizeof(overflows));
363 memset(&keypair, 0,
sizeof(keypair));
387 memset(&keypair, 0,
sizeof(keypair));
398 CHECK(pk_parity == pk_parity_tmp);
418 memset(&keypair, 0,
sizeof(keypair));
428 unsigned char sk[32];
430 unsigned char overflows[32];
431 unsigned char zeros96[96] = { 0 };
432 unsigned char tweak[32];
439 CHECK(
sizeof(zeros96) ==
sizeof(keypair));
442 memset(overflows, 0xFF, 32);
467 for (i = 0; i <
count; i++) {
472 memcpy(&keypair_tmp, &keypair,
sizeof(keypair));
485 memset(&keypair, 0,
sizeof(keypair));
493 memset(&keypair, 0, 32);
498 memset(&keypair.
data[32], 0, 64);
504 for (i = 0; i <
count; i++) {
509 unsigned char pk32[32];
510 unsigned char sk32[32];
static void secp256k1_fe_negate(secp256k1_fe *r, const secp256k1_fe *a, int m)
Set a field element equal to the additive inverse of another.
static int secp256k1_fe_equal(const secp256k1_fe *a, const secp256k1_fe *b)
Compare two field elements.
static void secp256k1_scalar_set_b32(secp256k1_scalar *r, const unsigned char *bin, int *overflow)
Set a scalar from a big endian byte array.
static void secp256k1_scalar_get_b32(unsigned char *bin, const secp256k1_scalar *a)
Convert a scalar to a byte array.
static void secp256k1_scalar_negate(secp256k1_scalar *r, const secp256k1_scalar *a)
Compute the complement of a scalar (modulo the group order).
static SECP256K1_INLINE int secp256k1_memcmp_var(const void *s1, const void *s2, size_t n)
Semantics like memcmp.
static int secp256k1_pubkey_load(const secp256k1_context *ctx, secp256k1_ge *ge, const secp256k1_pubkey *pubkey)
#define SECP256K1_CONTEXT_SIGN
#define SECP256K1_TAG_PUBKEY_EVEN
Prefix byte used to tag various encoded curvepoints for specific purposes.
SECP256K1_API void secp256k1_context_set_error_callback(secp256k1_context *ctx, void(*fun)(const char *message, void *data), const void *data) SECP256K1_ARG_NONNULL(1)
Set a callback function to be called when an internal consistency check fails.
SECP256K1_API void secp256k1_context_set_illegal_callback(secp256k1_context *ctx, void(*fun)(const char *message, void *data), const void *data) SECP256K1_ARG_NONNULL(1)
Set a callback function to be called when an illegal argument is passed to an API call.
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_parse(const secp256k1_context *ctx, secp256k1_pubkey *pubkey, const unsigned char *input, size_t inputlen) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
Parse a variable-length public key into the pubkey object.
#define SECP256K1_CONTEXT_NONE
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_create(const secp256k1_context *ctx, secp256k1_pubkey *pubkey, const unsigned char *seckey) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
Compute the public key for a secret key.
SECP256K1_API secp256k1_context * secp256k1_context_create(unsigned int flags) SECP256K1_WARN_UNUSED_RESULT
Create a secp256k1 context object (in dynamically allocated memory).
#define SECP256K1_CONTEXT_VERIFY
Flags to pass to secp256k1_context_create, secp256k1_context_preallocated_size, and secp256k1_context...
SECP256K1_API void secp256k1_context_destroy(secp256k1_context *ctx)
Destroy a secp256k1 context object (created in dynamically allocated memory).
A group element of the secp256k1 curve, in affine coordinates.
Opaque data structure that holds a keypair consisting of a secret and a public key.
Opaque data structure that holds a parsed and valid public key.
A scalar modulo the group order of the secp256k1 curve.
Opaque data structure that holds a parsed and valid "x-only" public key.
static void secp256k1_testrand256(unsigned char *b32)
Generate a pseudorandom 32-byte array.
static void counting_illegal_callback_fn(const char *str, void *data)