tests: Improve secp256k1_ge_set_all_gej_var for some infinity inputs

This commit is contained in:
Tim Ruffing 2021-05-05 09:38:22 +02:00 committed by roconnor-blockstream
parent 4a19668c37
commit 14c9739a1f
1 changed files with 5 additions and 2 deletions

View File

@ -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++) {