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 committed May 5, 2021
1 parent 5f83730 commit ebdb8f4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -3103,8 +3103,13 @@ void test_ge(void) {
for (i = 0; i < 4 * runs + 1; i++) {
random_group_element_test(&ge[i]);
/* randomly set half the points to infinity */
if(secp256k1_fe_is_odd(&ge[i].x)) {
secp256k1_ge_set_infinity(&ge[i]);
if (secp256k1_fe_is_odd(&ge[i].x) == i % 2) {
secp256k1_ge_set_infinity(&ge[i]);
}
int odd = secp256k1_fe_is_odd(&ge[i].x);
CHECK(odd == 0 || odd == 1);
if (!!secp256k1_fe_is_odd(&ge[i].x) == i % 2) {
secp256k1_ge_set_infinity(&ge[i]);
}
secp256k1_gej_set_ge(&gej[i], &ge[i]);
}
Expand Down

0 comments on commit ebdb8f4

Please sign in to comment.