Skip to content

Commit

Permalink
tests: Improve secp256k1_ge_set_all_gej_var for some infinity inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
real-or-random authored and roconnor-blockstream committed May 5, 2021
1 parent 4a19668 commit 14c9739
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -3101,14 +3101,17 @@ void test_ge(void) {

/* Test batch gej -> ge conversion with many infinities. */
for (i = 0; i < 4 * runs + 1; i++) {
int odd;
random_group_element_test(&ge[i]);
odd = secp256k1_fe_is_odd(&ge[i].x);
CHECK(odd == 0 || odd == 1);
/* randomly set half the points to infinity */
if(secp256k1_fe_is_odd(&ge[i].x)) {
if (odd == i % 2) {
secp256k1_ge_set_infinity(&ge[i]);
}
secp256k1_gej_set_ge(&gej[i], &ge[i]);
}
/* batch invert */
/* batch convert */
secp256k1_ge_set_all_gej_var(ge, gej, 4 * runs + 1);
/* check result */
for (i = 0; i < 4 * runs + 1; i++) {
Expand Down

0 comments on commit 14c9739

Please sign in to comment.