Skip to content

Commit 7d11b73

Browse files
committed
Rename index and my_index to idx
1 parent 8f74051 commit 7d11b73

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

include/secp256k1_frost.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,15 @@ SECP256K1_API int secp256k1_frost_share_agg(
8080
const secp256k1_pubkey * const* pubcoeffs,
8181
uint16_t n_shares,
8282
uint16_t threshold,
83-
uint16_t index
83+
uint16_t idx
8484
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4) SECP256K1_ARG_NONNULL(5) SECP256K1_ARG_NONNULL(6);
8585

8686
SECP256K1_API int secp256k1_frost_nonce_gen(
8787
const secp256k1_context* ctx,
8888
secp256k1_frost_secnonce *secnonce,
8989
secp256k1_frost_pubnonce *pubnonce,
9090
const unsigned char *session_id32,
91-
uint16_t index,
91+
uint16_t idx,
9292
const secp256k1_frost_share *agg_share,
9393
const unsigned char *msg32,
9494
const secp256k1_xonly_pubkey *agg_pk,

src/modules/frost/keygen_impl.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,19 +176,19 @@ static int secp256k1_frost_pubkey_combine_callback(secp256k1_scalar *sc, secp256
176176
return secp256k1_pubkey_load(ctx->ctx, pt, &ctx->pks[idx][0]);
177177
}
178178

179-
static int vss_verify(const secp256k1_context* ctx, uint16_t threshold, uint16_t index, const secp256k1_scalar *share, const secp256k1_pubkey * const* vss_commitment) {
179+
static int vss_verify(const secp256k1_context* ctx, uint16_t threshold, uint16_t idx, const secp256k1_scalar *share, const secp256k1_pubkey * const* vss_commitment) {
180180
secp256k1_scalar share_neg;
181181
secp256k1_gej tmpj;
182182
secp256k1_frost_verify_share_ecmult_data verify_share_ecmult_data;
183183

184184
/* Use an EC multi-multiplication to verify the following equation:
185-
* 0 = - share_i*G + index^0*vss_commitment[0]
185+
* 0 = - share_i*G + idx^0*vss_commitment[0]
186186
* + ...
187-
* + index^(threshold - 1)*vss_commitment[threshold - 1]*/
187+
* + idx^(threshold - 1)*vss_commitment[threshold - 1]*/
188188
verify_share_ecmult_data.ctx = ctx;
189189
verify_share_ecmult_data.pubcoeff = vss_commitment;
190-
/* Evaluate the public polynomial at the index */
191-
secp256k1_scalar_set_int(&verify_share_ecmult_data.idx, index);
190+
/* Evaluate the public polynomial at the idx */
191+
secp256k1_scalar_set_int(&verify_share_ecmult_data.idx, idx);
192192
secp256k1_scalar_set_int(&verify_share_ecmult_data.idxn, 1);
193193
secp256k1_scalar_negate(&share_neg, share);
194194
/* TODO: add scratch */
@@ -198,7 +198,7 @@ static int vss_verify(const secp256k1_context* ctx, uint16_t threshold, uint16_t
198198
return secp256k1_gej_is_infinity(&tmpj);
199199
}
200200

201-
int secp256k1_frost_share_agg(const secp256k1_context* ctx, secp256k1_frost_share *agg_share, secp256k1_xonly_pubkey *agg_pk, unsigned char *vss_hash, const secp256k1_frost_share * const* shares, const secp256k1_pubkey * const* pubcoeffs, uint16_t n_shares, uint16_t threshold, uint16_t index) {
201+
int secp256k1_frost_share_agg(const secp256k1_context* ctx, secp256k1_frost_share *agg_share, secp256k1_xonly_pubkey *agg_pk, unsigned char *vss_hash, const secp256k1_frost_share * const* shares, const secp256k1_pubkey * const* pubcoeffs, uint16_t n_shares, uint16_t threshold, uint16_t idx) {
202202
secp256k1_frost_pubkey_combine_ecmult_data pubkey_combine_ecmult_data;
203203
secp256k1_gej pkj;
204204
secp256k1_ge pkp;
@@ -214,7 +214,7 @@ int secp256k1_frost_share_agg(const secp256k1_context* ctx, secp256k1_frost_shar
214214
ARG_CHECK(shares != NULL);
215215
ARG_CHECK(pubcoeffs != NULL);
216216
ARG_CHECK(n_shares > 0);
217-
ARG_CHECK(index > 0);
217+
ARG_CHECK(idx > 0);
218218

219219
if (threshold == 0 || threshold > n_shares) {
220220
return 0;
@@ -228,7 +228,7 @@ int secp256k1_frost_share_agg(const secp256k1_context* ctx, secp256k1_frost_shar
228228
if (overflow) {
229229
return 0;
230230
}
231-
if (!vss_verify(ctx, threshold, index, &share_i, &pubcoeffs[i])) {
231+
if (!vss_verify(ctx, threshold, idx, &share_i, &pubcoeffs[i])) {
232232
return 0;
233233
}
234234
secp256k1_scalar_add(&acc, &acc, &share_i);

src/modules/frost/session_impl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ static void secp256k1_nonce_function_frost(secp256k1_scalar *k, const unsigned c
241241
}
242242
}
243243

244-
int secp256k1_frost_nonce_gen(const secp256k1_context* ctx, secp256k1_frost_secnonce *secnonce, secp256k1_frost_pubnonce *pubnonce, const unsigned char *session_id32, uint16_t my_index, const secp256k1_frost_share *agg_share, const unsigned char *msg32, const secp256k1_xonly_pubkey *agg_pk, const unsigned char *extra_input32) {
244+
int secp256k1_frost_nonce_gen(const secp256k1_context* ctx, secp256k1_frost_secnonce *secnonce, secp256k1_frost_pubnonce *pubnonce, const unsigned char *session_id32, uint16_t idx, const secp256k1_frost_share *agg_share, const unsigned char *msg32, const secp256k1_xonly_pubkey *agg_pk, const unsigned char *extra_input32) {
245245
secp256k1_scalar k[2];
246246
secp256k1_ge nonce_pt[2];
247247
int i;
@@ -297,7 +297,7 @@ int secp256k1_frost_nonce_gen(const secp256k1_context* ctx, secp256k1_frost_secn
297297
secp256k1_scalar_clear(&k[i]);
298298
}
299299
/* nonce_pt won't be infinity because k != 0 with overwhelming probability */
300-
secp256k1_frost_pubnonce_save(pubnonce, nonce_pt, my_index);
300+
secp256k1_frost_pubnonce_save(pubnonce, nonce_pt, idx);
301301
return ret;
302302
}
303303

0 commit comments

Comments
 (0)