7#ifndef SECP256K1_MODULE_RECOVERY_EXHAUSTIVE_TESTS_H
8#define SECP256K1_MODULE_RECOVERY_EXHAUSTIVE_TESTS_H
11#include "../../../include/secp256k1_recovery.h"
22 const int starting_k =
k;
27 unsigned char sk32[32], msg32[32];
41 CHECK(r == expected_r);
50 expected_recid = overflow ? 2 : 0;
51 r_dot_y_normalized =
group[
k].y;
59 CHECK(recid == expected_recid);
68 CHECK(r == expected_r);
97 unsigned char msg32[32];
114 if (r_s == check_x_s) {
133 memcpy(&nonconst_ge, &
group[sk_s],
sizeof(nonconst_ge));
135 CHECK(should_verify ==
#define secp256k1_fe_is_odd
#define secp256k1_fe_normalize
#define CHECK(cond)
Unconditional failure on condition failure.
static void secp256k1_ecdsa_recoverable_signature_save(secp256k1_ecdsa_recoverable_signature *sig, const secp256k1_scalar *r, const secp256k1_scalar *s, int recid)
static void secp256k1_ecdsa_recoverable_signature_load(const secp256k1_context *ctx, secp256k1_scalar *r, secp256k1_scalar *s, int *recid, const secp256k1_ecdsa_recoverable_signature *sig)
static void test_exhaustive_recovery(const secp256k1_context *ctx, const secp256k1_ge *group)
static void test_exhaustive_recovery_sign(const secp256k1_context *ctx, const secp256k1_ge *group)
static void test_exhaustive_recovery_verify(const secp256k1_context *ctx, const secp256k1_ge *group)
static void secp256k1_scalar_set_int(secp256k1_scalar *r, unsigned int v)
Set a scalar to an unsigned integer.
static int secp256k1_scalar_eq(const secp256k1_scalar *a, const secp256k1_scalar *b)
Compare two scalars.
static void secp256k1_scalar_get_b32(unsigned char *bin, const secp256k1_scalar *a)
Convert a scalar to a byte array.
static int secp256k1_scalar_add(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b)
Add two scalars together (modulo the group order).
static void secp256k1_scalar_mul(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b)
Multiply two scalars (modulo the group order).
static int secp256k1_scalar_is_high(const secp256k1_scalar *a)
Check whether a scalar is higher than the group order divided by 2.
static void secp256k1_pubkey_save(secp256k1_pubkey *pubkey, secp256k1_ge *ge)
static void secp256k1_ecdsa_signature_load(const secp256k1_context *ctx, secp256k1_scalar *r, secp256k1_scalar *s, const secp256k1_ecdsa_signature *sig)
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdsa_verify(const secp256k1_context *ctx, const secp256k1_ecdsa_signature *sig, const unsigned char *msghash32, const secp256k1_pubkey *pubkey) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4)
Verify an ECDSA signature.
SECP256K1_API int secp256k1_ecdsa_sign_recoverable(const secp256k1_context *ctx, secp256k1_ecdsa_recoverable_signature *sig, const unsigned char *msghash32, const unsigned char *seckey, secp256k1_nonce_function noncefp, const void *ndata) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4)
Create a recoverable ECDSA signature.
SECP256K1_API int secp256k1_ecdsa_recoverable_signature_convert(const secp256k1_context *ctx, secp256k1_ecdsa_signature *sig, const secp256k1_ecdsa_recoverable_signature *sigin) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
Convert a recoverable signature into a normal signature.
Opaque data structure that holds a parsed ECDSA signature, supporting pubkey recovery.
Opaque data structure that holds a parsed ECDSA signature.
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 ...
Opaque data structure that holds a parsed and valid public key.
A scalar modulo the group order of the secp256k1 curve.
static SECP256K1_INLINE int skip_section(uint64_t *iter)
static void r_from_k(secp256k1_scalar *r, const secp256k1_ge *group, int k, int *overflow)
#define EXHAUSTIVE_TEST_ORDER
static int secp256k1_nonce_function_smallint(unsigned char *nonce32, const unsigned char *msg32, const unsigned char *key32, const unsigned char *algo16, void *data, unsigned int attempt)