Skip to content

Commit 475554e

Browse files
committed
Use 33-byte pubkeys for internal keys
1 parent ffa9527 commit 475554e

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

include/secp256k1_frost.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ typedef struct {
3636

3737
SECP256K1_API int secp256k1_frost_keygen_init(
3838
const secp256k1_context *ctx,
39-
secp256k1_scalar *coefficients,
40-
secp256k1_xonly_pubkey *commitments,
39+
secp256k1_scalar *privcoeff,
40+
secp256k1_pubkey *pubcoeff,
4141
const size_t threshold,
4242
const size_t n_signers,
4343
const unsigned char *seckey
@@ -54,7 +54,7 @@ SECP256K1_API int secp256k1_frost_pubkey_combine(
5454
const secp256k1_context *ctx,
5555
secp256k1_scratch_space *scratch,
5656
secp256k1_xonly_pubkey *combined_pk,
57-
const secp256k1_xonly_pubkey *pubkeys,
57+
const secp256k1_pubkey *pubkeys,
5858
size_t n_pubkeys
5959
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4);
6060

src/modules/frost/main_impl.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
#include "include/secp256k1_frost.h"
1313
#include "hash.h"
1414

15-
int secp256k1_frost_keygen_init(const secp256k1_context *ctx, secp256k1_scalar *coefficients, secp256k1_xonly_pubkey *commitments, const size_t threshold, const size_t n_signers, const unsigned char *seckey) {
15+
int secp256k1_frost_keygen_init(const secp256k1_context *ctx, secp256k1_scalar *privcoeff, secp256k1_pubkey *pubcoeff, const size_t threshold, const size_t n_signers, const unsigned char *seckey32) {
1616
secp256k1_sha256 sha;
1717
size_t i;
1818
unsigned char rngseed[32];
1919

2020
VERIFY_CHECK(ctx != NULL);
2121
ARG_CHECK(secp256k1_ecmult_gen_context_is_built(&ctx->ecmult_gen_ctx));
22-
ARG_CHECK(seckey != NULL);
22+
ARG_CHECK(seckey32 != NULL);
2323

2424
if (threshold == 0 || threshold > n_signers) {
2525
return 0;
@@ -28,7 +28,7 @@ int secp256k1_frost_keygen_init(const secp256k1_context *ctx, secp256k1_scalar *
2828
/* Compute a random seed which commits to all inputs */
2929
/* TODO: allow user suplied function that takes seckey, threshold, and n_signers as inputs and supplies the rngseed */
3030
secp256k1_sha256_initialize(&sha);
31-
secp256k1_sha256_write(&sha, seckey, 32);
31+
secp256k1_sha256_write(&sha, seckey32, 32);
3232
for (i = 0; i < 8; i++) {
3333
rngseed[i + 0] = threshold / (1ull << (i * 8));
3434
rngseed[i + 8] = n_signers / (1ull << (i * 8));
@@ -45,11 +45,11 @@ int secp256k1_frost_keygen_init(const secp256k1_context *ctx, secp256k1_scalar *
4545
if (i % 2 == 0) {
4646
secp256k1_scalar_chacha20(&rand[0], &rand[1], rngseed, i);
4747
}
48-
coefficients[i] = rand[i % 2];
48+
privcoeff[i] = rand[i % 2];
4949
/* Compute commitment to each coefficient */
5050
secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &rj, &rand[i % 2]);
5151
secp256k1_ge_set_gej(&rp, &rj);
52-
secp256k1_xonly_pubkey_save(&commitments[i], &rp);
52+
secp256k1_pubkey_save(&pubcoeff[i], &rp);
5353
}
5454

5555
return 1;
@@ -89,16 +89,16 @@ void secp256k1_frost_aggregate_shares(secp256k1_frost_share *aggregate_share, se
8989

9090
typedef struct {
9191
const secp256k1_context *ctx;
92-
const secp256k1_xonly_pubkey *pks;
92+
const secp256k1_pubkey *pks;
9393
} secp256k1_frost_pubkey_combine_ecmult_data;
9494

9595
static int secp256k1_frost_pubkey_combine_callback(secp256k1_scalar *sc, secp256k1_ge *pt, size_t idx, void *data) {
9696
secp256k1_frost_pubkey_combine_ecmult_data *ctx = (secp256k1_frost_pubkey_combine_ecmult_data *) data;
9797
secp256k1_scalar_set_int(sc, 1);
98-
return secp256k1_xonly_pubkey_load(ctx->ctx, pt, &ctx->pks[idx]);
98+
return secp256k1_pubkey_load(ctx->ctx, pt, &ctx->pks[idx]);
9999
}
100100

101-
int secp256k1_frost_pubkey_combine(const secp256k1_context *ctx, secp256k1_scratch_space *scratch, secp256k1_xonly_pubkey *combined_pk, const secp256k1_xonly_pubkey *pubkeys, size_t n_pubkeys) {
101+
int secp256k1_frost_pubkey_combine(const secp256k1_context *ctx, secp256k1_scratch_space *scratch, secp256k1_xonly_pubkey *combined_pk, const secp256k1_pubkey *pubkeys, size_t n_pubkeys) {
102102
secp256k1_frost_pubkey_combine_ecmult_data ecmult_data;
103103
secp256k1_gej pkj;
104104
secp256k1_ge pkp;

0 commit comments

Comments
 (0)