Skip to content

Commit e029d93

Browse files
committed
Conditionally invert secret when generating shares
1 parent f065a84 commit e029d93

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/modules/frost/main_impl.h

+10
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,16 @@ int secp256k1_frost_keygen_init(const secp256k1_context *ctx, secp256k1_frost_ke
6767
void secp256k1_frost_generate_shares(secp256k1_frost_share *shares, secp256k1_scalar *coeff, const secp256k1_frost_keygen_session *session) {
6868
size_t i;
6969

70+
/* Invert the first coeeficient if the combined pubkey has an odd Y coordinate. We can't wait for signing to invert because it must be done prior to generating the polynomial from which the shares will be derived. */
71+
if (session->pk_parity) {
72+
/* TODO: do this without overwriting by writing to new scalar value */
73+
/* do this within the loop so we only do this check once */
74+
/* update test because when it reads from privcoeff it will no longer */
75+
/* be inverted */
76+
secp256k1_scalar_negate(&coeff[0], &coeff[0]);
77+
78+
}
79+
7080
for (i = 0; i < session->n_signers; i++) {
7181
size_t j;
7282
secp256k1_scalar share_i;

0 commit comments

Comments
 (0)