 |
PRCYCoin
2.0.0.7rc1
P2P Digital Currency
|
Go to the documentation of this file.
26 unsigned char csub[32];
32 static void bench_whitelist(
void* arg) {
37 static void bench_whitelist_setup(
void* arg) {
40 CHECK(
secp256k1_whitelist_sign(data->
ctx, &data->
sig, data->
online_pubkeys, data->
offline_pubkeys, data->
n_keys, &data->
sub_pubkey, data->
online_seckey[i], data->
summed_seckey[i], i, NULL, NULL));
45 sprintf(str,
"whitelist_%i", (
int)data->
n_keys);
46 run_benchmark(str, bench_whitelist, bench_whitelist_setup, NULL, data, 100, 1);
51 unsigned char b32[32];
53 secp256k1_rand256(b32);
54 secp256k1_scalar_set_b32(num, b32, &overflow);
55 if (overflow || secp256k1_scalar_is_zero(num)) {
72 secp256k1_scalar_get_b32(data.
csub, &ssub);
76 for (i = 0; i < n_keys; i++) {
91 secp256k1_scalar_add(&soff, &soff, &ssub);
97 for (i = 1; i <= n_keys; ++i) {
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_create2(const secp256k1_context2 *ctx, secp256k1_pubkey2 *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_pubkey2 online_pubkeys[MAX_N_KEYS]
secp256k1_pubkey2 sub_pubkey
Opaque data structure that holds a parsed and valid public key.
SECP256K1_API void secp256k1_context_destroy(secp256k1_context2 *ctx)
Destroy a secp256k1 context object.
void run_benchmark(char *name, void(*benchmark)(void *), void(*setup)(void *), void(*teardown)(void *), void *data, int count, int iter)
A scalar modulo the group order of the secp256k1 curve.
SECP256K1_API int secp256k1_whitelist_sign(const secp256k1_context2 *ctx, secp256k1_whitelist_signature *sig, const secp256k1_pubkey2 *online_pubkeys, const secp256k1_pubkey2 *offline_pubkeys, const size_t n_keys, const secp256k1_pubkey2 *sub_pubkey, const unsigned char *online_seckey, const unsigned char *summed_seckey, const size_t index, secp256k1_nonce_function2 noncefp, const void *noncedata) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4) SECP256K1_ARG_NONNULL(6) SECP256K1_ARG_NONNULL(7) SECP256K1_ARG_NONNULL(8)
Compute a whitelist signature Returns 1: signature was successfully created 0: signature was not succ...
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_seckey_verify2(const secp256k1_context2 *ctx, const unsigned char *seckey) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2)
Verify an ECDSA secret key.
SECP256K1_API int secp256k1_whitelist_verify(const secp256k1_context2 *ctx, const secp256k1_whitelist_signature *sig, const secp256k1_pubkey2 *online_pubkeys, const secp256k1_pubkey2 *offline_pubkeys, const size_t n_keys, const secp256k1_pubkey2 *sub_pubkey) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4) SECP256K1_ARG_NONNULL(6)
Verify a whitelist signature Returns 1: signature is valid 0: signature is not valid In: ctx: pointer...
Opaque data structure that holds a parsed whitelist proof.
secp256k1_whitelist_signature sig
unsigned char online_seckey[MAX_N_KEYS][32]
void random_scalar_order(secp256k1_scalar *num)
SECP256K1_API secp256k1_context2 * secp256k1_context_create2(unsigned int flags) SECP256K1_WARN_UNUSED_RESULT
Create a secp256k1 context object.
secp256k1_pubkey2 offline_pubkeys[MAX_N_KEYS]
#define SECP256K1_CONTEXT_VERIFY
Flags to pass to secp256k1_context_create2.
#define SECP256K1_CONTEXT_SIGN
unsigned char summed_seckey[MAX_N_KEYS][32]