7#ifndef SECP256K1_MODULE_RECOVERY_BENCH_H
8#define SECP256K1_MODULE_RECOVERY_BENCH_H
10#include "../../../include/secp256k1_recovery.h"
14 unsigned char msg[32];
15 unsigned char sig[64];
22 unsigned char pubkeyc[33];
24 for (i = 0; i < iters; i++) {
26 size_t pubkeylen = 33;
31 for (j = 0; j < 32; j++) {
34 data->sig[j] = pubkeyc[j + 1];
43 for (i = 0; i < 32; i++) {
46 for (i = 0; i < 64; i++) {
47 data->sig[i] = 65 + i;
57 if (d ||
have_flag(argc, argv,
"ecdsa") ||
have_flag(argc, argv,
"recover") ||
have_flag(argc, argv,
"ecdsa_recover"))
run_benchmark(
"ecdsa_recover",
bench_recover,
bench_recover_setup, NULL, &
data, 10, iters);
static void run_benchmark(char *name, void(*benchmark)(void *), void(*setup)(void *), void(*teardown)(void *), void *data, int count, int iter)
#define CHECK(cond)
Unconditional failure on condition failure.
static void bench_recover(void *arg, int iters)
static void run_recovery_bench(int iters, int argc, char **argv)
static void bench_recover_setup(void *arg)
static int have_flag(int argc, char **argv, char *flag)
SECP256K1_API void secp256k1_context_destroy(secp256k1_context *ctx) SECP256K1_ARG_NONNULL(1)
Destroy a secp256k1 context object (created in dynamically allocated memory).
SECP256K1_API int secp256k1_ec_pubkey_serialize(const secp256k1_context *ctx, unsigned char *output, size_t *outputlen, const secp256k1_pubkey *pubkey, unsigned int flags) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4)
Serialize a pubkey object into a serialized byte sequence.
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_NONE
Context flags to pass to secp256k1_context_create, secp256k1_context_preallocated_size,...
#define SECP256K1_EC_COMPRESSED
Flag to pass to secp256k1_ec_pubkey_serialize.
SECP256K1_API int secp256k1_ecdsa_recoverable_signature_parse_compact(const secp256k1_context *ctx, secp256k1_ecdsa_recoverable_signature *sig, const unsigned char *input64, int recid) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
Parse a compact ECDSA signature (64 bytes + recovery id).
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdsa_recover(const secp256k1_context *ctx, secp256k1_pubkey *pubkey, const secp256k1_ecdsa_recoverable_signature *sig, const unsigned char *msghash32) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4)
Recover an ECDSA public key from a signature.
Opaque data structure that holds a parsed ECDSA signature, supporting pubkey recovery.
Opaque data structure that holds a parsed and valid public key.