Skip to content

Commit eb5e71b

Browse files
committed
Merge #162: whitelist: remove ability to specific nonce function
11d675d whitelist: remove ability to specific nonce function (Andrew Poelstra) Pull request description: ACKs for top commit: jonasnick: ACK 11d675d Tree-SHA512: aa53d445a1e817e9998a41f5da186f1d92e3da0dcc088b9ff8fe795af06072d3e6b22be7842ece9f4dcb5e0ad97a90ebeaca097247fa8307d88a6d2bfb0fb573
2 parents 21e2d65 + 11d675d commit eb5e71b

File tree

4 files changed

+7
-15
lines changed

4 files changed

+7
-15
lines changed

include/secp256k1_whitelist.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ SECP256K1_API int secp256k1_whitelist_signature_serialize(
101101
* online_seckey: the secret key to the signer's online pubkey
102102
* summed_seckey: the secret key to the sum of (whitelisted key, signer's offline pubkey)
103103
* index: the signer's index in the lists of keys
104-
* noncefp:pointer to a nonce generation function. If NULL, secp256k1_nonce_function_default is used
105-
* ndata: pointer to arbitrary data used by the nonce generation function (can be NULL)
106104
* Out: sig: The produced signature.
107105
*
108106
* The signatures are of the list of all passed pubkeys in the order
@@ -120,10 +118,8 @@ SECP256K1_API int secp256k1_whitelist_sign(
120118
const size_t n_keys,
121119
const secp256k1_pubkey *sub_pubkey,
122120
const unsigned char *online_seckey,
123-
const unsigned char *summed_seckey,
124-
const size_t index,
125-
secp256k1_nonce_function noncefp,
126-
const void *noncedata
121+
const unsigned char *summed_seckeyx,
122+
const size_t index
127123
) 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);
128124

129125
/** Verify a whitelist signature

src/bench_whitelist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static void bench_whitelist(void* arg, int iters) {
3939
static void bench_whitelist_setup(void* arg) {
4040
bench_data* data = (bench_data*)arg;
4141
int i = 0;
42-
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));
42+
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));
4343
}
4444

4545
static void run_test(bench_data* data, int iters) {

src/modules/whitelist/main_impl.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,13 @@
1212

1313
#define MAX_KEYS SECP256K1_WHITELIST_MAX_N_KEYS /* shorter alias */
1414

15-
int secp256k1_whitelist_sign(const secp256k1_context* ctx, secp256k1_whitelist_signature *sig, const secp256k1_pubkey *online_pubkeys, const secp256k1_pubkey *offline_pubkeys, const size_t n_keys, const secp256k1_pubkey *sub_pubkey, const unsigned char *online_seckey, const unsigned char *summed_seckey, const size_t index, secp256k1_nonce_function noncefp, const void *noncedata) {
15+
int secp256k1_whitelist_sign(const secp256k1_context* ctx, secp256k1_whitelist_signature *sig, const secp256k1_pubkey *online_pubkeys, const secp256k1_pubkey *offline_pubkeys, const size_t n_keys, const secp256k1_pubkey *sub_pubkey, const unsigned char *online_seckey, const unsigned char *summed_seckey, const size_t index) {
1616
secp256k1_gej pubs[MAX_KEYS];
1717
secp256k1_scalar s[MAX_KEYS];
1818
secp256k1_scalar sec, non;
1919
unsigned char msg32[32];
2020
int ret;
2121

22-
if (noncefp == NULL) {
23-
noncefp = secp256k1_nonce_function_default;
24-
}
25-
2622
/* Sanity checks */
2723
VERIFY_CHECK(ctx != NULL);
2824
ARG_CHECK(secp256k1_ecmult_gen_context_is_built(&ctx->ecmult_gen_ctx));
@@ -53,7 +49,7 @@ int secp256k1_whitelist_sign(const secp256k1_context* ctx, secp256k1_whitelist_s
5349
size_t i;
5450
unsigned char nonce32[32];
5551
int done;
56-
ret = noncefp(nonce32, msg32, seckey32, NULL, (void*)noncedata, count);
52+
ret = secp256k1_nonce_function_default(nonce32, msg32, seckey32, NULL, NULL, count);
5753
if (!ret) {
5854
break;
5955
}
@@ -67,7 +63,7 @@ int secp256k1_whitelist_sign(const secp256k1_context* ctx, secp256k1_whitelist_s
6763
for (i = 0; i < n_keys; i++) {
6864
msg32[0] ^= i + 1;
6965
msg32[1] ^= (i + 1) / 0x100;
70-
ret = noncefp(&sig->data[32 * (i + 1)], msg32, seckey32, NULL, (void*)noncedata, count);
66+
ret = secp256k1_nonce_function_default(&sig->data[32 * (i + 1)], msg32, seckey32, NULL, NULL, count);
7167
if (!ret) {
7268
break;
7369
}

src/modules/whitelist/tests_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ void test_whitelist_end_to_end_internal(const unsigned char *summed_seckey, cons
1515
secp256k1_whitelist_signature sig;
1616
secp256k1_whitelist_signature sig1;
1717

18-
CHECK(secp256k1_whitelist_sign(ctx, &sig, online_pubkeys, offline_pubkeys, n_keys, sub_pubkey, online_seckey, summed_seckey, signer_i, NULL, NULL));
18+
CHECK(secp256k1_whitelist_sign(ctx, &sig, online_pubkeys, offline_pubkeys, n_keys, sub_pubkey, online_seckey, summed_seckey, signer_i));
1919
CHECK(secp256k1_whitelist_verify(ctx, &sig, online_pubkeys, offline_pubkeys, n_keys, sub_pubkey) == 1);
2020
/* Check that exchanging keys causes a failure */
2121
CHECK(secp256k1_whitelist_verify(ctx, &sig, offline_pubkeys, online_pubkeys, n_keys, sub_pubkey) != 1);

0 commit comments

Comments
 (0)