7#ifndef SECP256K1_MODULE_ECDH_BENCH_H
8#define SECP256K1_MODULE_ECDH_BENCH_H
10#include "../../../include/secp256k1_ecdh.h"
15 unsigned char scalar[32];
21 const unsigned char point[] = {
23 0x54, 0x94, 0xc1, 0x5d, 0x32, 0x09, 0x97, 0x06,
24 0xc2, 0x39, 0x5f, 0x94, 0x34, 0x87, 0x45, 0xfd,
25 0x75, 0x7c, 0xe3, 0x0e, 0x4e, 0x8c, 0x90, 0xfb,
26 0xa2, 0xba, 0xd1, 0x84, 0xf8, 0x83, 0xc6, 0x9f
29 for (i = 0; i < 32; i++) {
30 data->scalar[i] = i + 1;
37 unsigned char res[32];
40 for (i = 0; i < iters; i++) {
static void run_benchmark(char *name, void(*benchmark)(void *), void(*setup)(void *), void(*teardown)(void *), void *data, int count, int iter)
static void bench_ecdh_setup(void *arg)
static void bench_ecdh(void *arg, int iters)
static void run_ecdh_bench(int iters, int argc, char **argv)
#define CHECK(cond)
Unconditional failure on condition failure.
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 secp256k1_context * secp256k1_context_create(unsigned int flags) SECP256K1_WARN_UNUSED_RESULT
Create a secp256k1 context object (in dynamically allocated memory).
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_FLAGS_TYPE_CONTEXT
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdh(const secp256k1_context *ctx, unsigned char *output, const secp256k1_pubkey *pubkey, const unsigned char *seckey, secp256k1_ecdh_hash_function hashfp, void *data) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4)
Compute an EC Diffie-Hellman secret in constant time.
Opaque data structure that holds a parsed and valid public key.