@@ -34,52 +34,82 @@ typedef struct {
34
34
unsigned char data [64 ];
35
35
} secp256k1_frost_secnonce ;
36
36
37
+ typedef struct {
38
+ unsigned char data [32 ];
39
+ } secp256k1_frost_partial_signature ;
40
+
37
41
typedef struct {
38
42
size_t threshold ;
39
43
size_t my_index ;
40
44
size_t n_signers ;
41
45
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 ];
42
58
secp256k1_xonly_pubkey combined_pk ;
43
- secp256k1_pubkey coeff_pk ;
44
59
secp256k1_frost_share agg_share ;
45
- } secp256k1_frost_keygen_session ;
60
+ } secp256k1_frost_sign_session ;
46
61
47
62
SECP256K1_API int secp256k1_frost_keygen_init (
48
63
const secp256k1_context * ctx ,
49
- secp256k1_frost_keygen_session * session ,
50
- secp256k1_scalar * privcoeff ,
51
64
secp256k1_pubkey * pubcoeff ,
65
+ secp256k1_frost_keygen_session * session ,
52
66
const size_t threshold ,
53
67
const size_t n_signers ,
54
68
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 );
57
71
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 );
63
84
64
85
SECP256K1_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 ,
66
88
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 ) ;
68
90
69
- SECP256K1_API int secp256k1_frost_pubkey_combine (
91
+ SECP256K1_API int secp256k1_frost_gen_shares_and_pubkey (
70
92
const secp256k1_context * ctx ,
71
93
secp256k1_scratch_space * scratch ,
94
+ secp256k1_frost_share * shares ,
95
+ secp256k1_xonly_pubkey * combined_pk ,
72
96
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 */
83
113
84
114
#ifdef __cplusplus
85
115
}
0 commit comments