12
12
#include "include/secp256k1_frost.h"
13
13
#include "hash.h"
14
14
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 ) {
16
16
secp256k1_sha256 sha ;
17
17
size_t i ;
18
18
unsigned char rngseed [32 ];
19
19
20
20
VERIFY_CHECK (ctx != NULL );
21
21
ARG_CHECK (secp256k1_ecmult_gen_context_is_built (& ctx -> ecmult_gen_ctx ));
22
- ARG_CHECK (seckey != NULL );
22
+ ARG_CHECK (seckey32 != NULL );
23
23
24
24
if (threshold == 0 || threshold > n_signers ) {
25
25
return 0 ;
@@ -28,7 +28,7 @@ int secp256k1_frost_keygen_init(const secp256k1_context *ctx, secp256k1_scalar *
28
28
/* Compute a random seed which commits to all inputs */
29
29
/* TODO: allow user suplied function that takes seckey, threshold, and n_signers as inputs and supplies the rngseed */
30
30
secp256k1_sha256_initialize (& sha );
31
- secp256k1_sha256_write (& sha , seckey , 32 );
31
+ secp256k1_sha256_write (& sha , seckey32 , 32 );
32
32
for (i = 0 ; i < 8 ; i ++ ) {
33
33
rngseed [i + 0 ] = threshold / (1ull << (i * 8 ));
34
34
rngseed [i + 8 ] = n_signers / (1ull << (i * 8 ));
@@ -45,11 +45,11 @@ int secp256k1_frost_keygen_init(const secp256k1_context *ctx, secp256k1_scalar *
45
45
if (i % 2 == 0 ) {
46
46
secp256k1_scalar_chacha20 (& rand [0 ], & rand [1 ], rngseed , i );
47
47
}
48
- coefficients [i ] = rand [i % 2 ];
48
+ privcoeff [i ] = rand [i % 2 ];
49
49
/* Compute commitment to each coefficient */
50
50
secp256k1_ecmult_gen (& ctx -> ecmult_gen_ctx , & rj , & rand [i % 2 ]);
51
51
secp256k1_ge_set_gej (& rp , & rj );
52
- secp256k1_xonly_pubkey_save ( & commitments [i ], & rp );
52
+ secp256k1_pubkey_save ( & pubcoeff [i ], & rp );
53
53
}
54
54
55
55
return 1 ;
@@ -89,16 +89,16 @@ void secp256k1_frost_aggregate_shares(secp256k1_frost_share *aggregate_share, se
89
89
90
90
typedef struct {
91
91
const secp256k1_context * ctx ;
92
- const secp256k1_xonly_pubkey * pks ;
92
+ const secp256k1_pubkey * pks ;
93
93
} secp256k1_frost_pubkey_combine_ecmult_data ;
94
94
95
95
static int secp256k1_frost_pubkey_combine_callback (secp256k1_scalar * sc , secp256k1_ge * pt , size_t idx , void * data ) {
96
96
secp256k1_frost_pubkey_combine_ecmult_data * ctx = (secp256k1_frost_pubkey_combine_ecmult_data * ) data ;
97
97
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 ]);
99
99
}
100
100
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 ) {
102
102
secp256k1_frost_pubkey_combine_ecmult_data ecmult_data ;
103
103
secp256k1_gej pkj ;
104
104
secp256k1_ge pkp ;
0 commit comments