Skip to content

Commit

Permalink
add secp256k1_ge_set_all_gej_var test which deals with many infinit…
Browse files Browse the repository at this point in the history
…e points
  • Loading branch information
apoelstra committed Nov 9, 2018
1 parent 84740ac commit ffd3b34
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -2113,6 +2113,22 @@ void test_ge(void) {
free(zr);
}

/* Test batch gej -> ge conversion with many infinities. */
for (i = 0; i < 4 * runs + 1; i++) {
random_group_element_test(&ge[i]);
/* randomly set half the points to infinitiy */
if(secp256k1_fe_is_odd(&ge[i].x)) {
secp256k1_ge_set_infinity(&ge[i]);
}
secp256k1_gej_set_ge(&gej[i], &ge[i]);
}
/* batch invert */
secp256k1_ge_set_all_gej_var(ge, gej, 4 * runs + 1);
/* check result */
for (i = 0; i < 4 * runs + 1; i++) {
ge_equals_gej(&ge[i], &gej[i]);
}

free(ge);
free(gej);
free(zinv);
Expand Down

0 comments on commit ffd3b34

Please sign in to comment.