Skip to content

Commit f663209

Browse files
peterdettmansipa
authored andcommitted
Avoid unnecessary doublings in precomputation
1 parent 6200aee commit f663209

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/ecmult_gen_impl.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ static void secp256k1_ecmult_gen_context_build(secp256k1_ecmult_gen_context *ctx
6464
secp256k1_gej_add_var(&sum, &sum, &u, NULL);
6565
secp256k1_gej_double_var(&u, &u, NULL);
6666
ds[tooth] = u;
67-
for (spacing = 1; spacing < COMB_SPACING; ++spacing) {
68-
secp256k1_gej_double_var(&u, &u, NULL);
67+
if (block + tooth != COMB_BLOCKS + COMB_TEETH - 2) {
68+
for (spacing = 1; spacing < COMB_SPACING; ++spacing) {
69+
secp256k1_gej_double_var(&u, &u, NULL);
70+
}
6971
}
7072
}
7173
secp256k1_gej_neg(&vs[vs_pos++], &sum);

0 commit comments

Comments
 (0)