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, 0xFF, 0xFF, 0xFF, 0xFF
59 #define NUM_INVALID_KEYS (sizeof(invalid_pubkey_bytes) / sizeof(invalid_pubkey_bytes[0]))
62 const unsigned char *key32,
const unsigned char *xonly_pk32,
63 const unsigned char *algo16,
void* data) {
82 unsigned char pk32[32];
83 memcpy(pk32, xonly_pubkey_bytes[d - 1], 32);
88 unsigned char sig64[64];
94 memcpy(sig64, xonly_pubkey_bytes[k - 1], 32);
102 unsigned char msg32[32];
109 int count_valid = 0, s;
111 int expect_valid, valid;
123 CHECK(valid == expect_valid);
124 count_valid += valid;
127 CHECK(count_valid == (actual_k != -1));
147 int e_count_done = 0;
148 unsigned char msg32[32];
149 unsigned char sig64[64];
161 unsigned char expected_s_bytes[32];
194 unsigned char buf[32];
static void secp256k1_scalar_set_int(secp256k1_scalar *r, unsigned int v)
Set a scalar to an unsigned integer.
static void secp256k1_scalar_get_b32(unsigned char *bin, const secp256k1_scalar *a)
Convert a scalar to a byte array.
static void secp256k1_schnorrsig_challenge(secp256k1_scalar *e, const unsigned char *r32, const unsigned char *msg32, const unsigned char *pubkey32)
static void test_exhaustive_schnorrsig(const secp256k1_context *ctx)
static int secp256k1_hardened_nonce_function_smallint(unsigned char *nonce32, const unsigned char *msg32, const unsigned char *key32, const unsigned char *xonly_pk32, const unsigned char *algo16, void *data)
static const unsigned char invalid_pubkey_bytes[][32]
static void test_exhaustive_schnorrsig_verify(const secp256k1_context *ctx, const secp256k1_xonly_pubkey *pubkeys, unsigned char(*xonly_pubkey_bytes)[32], const int *parities)
static void test_exhaustive_schnorrsig_sign(const secp256k1_context *ctx, unsigned char(*xonly_pubkey_bytes)[32], const secp256k1_keypair *keypairs, const int *parities)
static SECP256K1_INLINE int secp256k1_memcmp_var(const void *s1, const void *s2, size_t n)
Semantics like memcmp.
SECP256K1_API int secp256k1_schnorrsig_sign(const secp256k1_context *ctx, unsigned char *sig64, const unsigned char *msg32, const secp256k1_keypair *keypair, secp256k1_nonce_function_hardened noncefp, void *ndata) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4)
Create a Schnorr signature.
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_schnorrsig_verify(const secp256k1_context *ctx, const unsigned char *sig64, const unsigned char *msg32, const secp256k1_xonly_pubkey *pubkey) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4)
Verify a Schnorr signature.
Opaque data structure that holds a keypair consisting of a secret and a 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 SECP256K1_INLINE int skip_section(uint64_t *iter)
#define EXHAUSTIVE_TEST_ORDER