@@ -34,52 +34,82 @@ typedef struct {
3434 unsigned char data [64 ];
3535} secp256k1_frost_secnonce ;
3636
37+ typedef struct {
38+ unsigned char data [32 ];
39+ } secp256k1_frost_partial_signature ;
40+
3741typedef struct {
3842 size_t threshold ;
3943 size_t my_index ;
4044 size_t n_signers ;
4145 int pk_parity ;
46+ unsigned char rngseed [32 ];
47+ unsigned char secret [32 ];
48+ secp256k1_ge coeff_ge ;
49+ secp256k1_scalar my_share ;
50+ } secp256k1_frost_keygen_session ;
51+
52+ typedef struct {
53+ size_t my_index ;
54+ secp256k1_scalar nonce ;
55+ secp256k1_ge nonce_ge ;
56+ int nonce_parity ;
57+ unsigned char msg [32 ];
4258 secp256k1_xonly_pubkey combined_pk ;
43- secp256k1_pubkey coeff_pk ;
4459 secp256k1_frost_share agg_share ;
45- } secp256k1_frost_keygen_session ;
60+ } secp256k1_frost_sign_session ;
4661
4762SECP256K1_API int secp256k1_frost_keygen_init (
4863 const secp256k1_context * ctx ,
49- secp256k1_frost_keygen_session * session ,
50- secp256k1_scalar * privcoeff ,
5164 secp256k1_pubkey * pubcoeff ,
65+ secp256k1_frost_keygen_session * session ,
5266 const size_t threshold ,
5367 const size_t n_signers ,
5468 const size_t my_index ,
55- const unsigned char * seckey
56- ) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL (3 ) SECP256K1_ARG_NONNULL (4 ) SECP256K1_ARG_NONNULL ( 8 );
69+ const unsigned char * seckey32
70+ ) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL (3 ) SECP256K1_ARG_NONNULL (7 );
5771
58- SECP256K1_API void secp256k1_frost_generate_shares (
59- secp256k1_frost_share * shares ,
60- secp256k1_scalar * coeff ,
61- const secp256k1_frost_keygen_session * session
62- ) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL (3 );
72+
73+ /* TODO: optionally allow nonce to be loaded into the function for pre-generated nonces */
74+ SECP256K1_API void secp256k1_frost_sign_init (
75+ const secp256k1_context * ctx ,
76+ secp256k1_pubkey * pubnonce ,
77+ secp256k1_frost_sign_session * session ,
78+ const unsigned char * session_id32 ,
79+ const unsigned char * msg32 ,
80+ const secp256k1_xonly_pubkey * combined_pk ,
81+ secp256k1_frost_share * agg_share ,
82+ const size_t my_index
83+ ) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL (3 ) SECP256K1_ARG_NONNULL (7 ) SECP256K1_ARG_NONNULL (8 );
6384
6485SECP256K1_API void secp256k1_frost_aggregate_shares (
65- const secp256k1_frost_share * shares ,
86+ secp256k1_frost_share * agg_share ,
87+ const secp256k1_frost_share * rec_shares ,
6688 const secp256k1_frost_keygen_session * session
67- ) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 );
89+ ) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL ( 3 ) ;
6890
69- SECP256K1_API int secp256k1_frost_pubkey_combine (
91+ SECP256K1_API int secp256k1_frost_gen_shares_and_pubkey (
7092 const secp256k1_context * ctx ,
7193 secp256k1_scratch_space * scratch ,
94+ secp256k1_frost_share * shares ,
95+ secp256k1_xonly_pubkey * combined_pk ,
7296 secp256k1_frost_keygen_session * session ,
73- const secp256k1_pubkey * pubkeys
74- ) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (3 ) SECP256K1_ARG_NONNULL (4 );
75-
76- SECP256K1_API int secp256k1_frost_nonce_combine (
77- const secp256k1_context * ctx ,
78- const secp256k1_pubkey * pubkeys ,
79- size_t n_signers ,
80- int * nonce_parity ,
81- secp256k1_xonly_pubkey * combined_pk
82- ) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL (4 ) SECP256K1_ARG_NONNULL (5 );
97+ const secp256k1_pubkey * rec_pubcoeff
98+ ) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (3 ) SECP256K1_ARG_NONNULL (4 ) SECP256K1_ARG_NONNULL (5 ) SECP256K1_ARG_NONNULL (6 );
99+
100+ /* TODO: this n_signers means something different than the other n_signers */
101+ SECP256K1_API int secp256k1_frost_partial_sign (
102+ const secp256k1_context * ctx ,
103+ secp256k1_scratch_space * scratch ,
104+ secp256k1_frost_partial_signature * partial_sig ,
105+ secp256k1_xonly_pubkey * combined_pubnonce ,
106+ secp256k1_frost_sign_session * session ,
107+ const secp256k1_pubkey * rec_pubnonce ,
108+ const size_t n_signers ,
109+ const size_t * indexes
110+ ) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (3 ) SECP256K1_ARG_NONNULL (4 ) SECP256K1_ARG_NONNULL (5 ) SECP256K1_ARG_NONNULL (6 ) SECP256K1_ARG_NONNULL (8 );
111+
112+ /* TODO: serialization APIs that facilitate communication rounds */
83113
84114#ifdef __cplusplus
85115}
0 commit comments