tests: Improve secp256k1_ge_set_all_gej_var for some infinity inputs
This commit is contained in:
parent
4a19668c37
commit
14c9739a1f
@ -3101,14 +3101,17 @@ void test_ge(void) {
|
|||||||
|
|
||||||
/* Test batch gej -> ge conversion with many infinities. */
|
/* Test batch gej -> ge conversion with many infinities. */
|
||||||
for (i = 0; i < 4 * runs + 1; i++) {
|
for (i = 0; i < 4 * runs + 1; i++) {
|
||||||
|
int odd;
|
||||||
random_group_element_test(&ge[i]);
|
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 */
|
/* 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_ge_set_infinity(&ge[i]);
|
||||||
}
|
}
|
||||||
secp256k1_gej_set_ge(&gej[i], &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);
|
secp256k1_ge_set_all_gej_var(ge, gej, 4 * runs + 1);
|
||||||
/* check result */
|
/* check result */
|
||||||
for (i = 0; i < 4 * runs + 1; i++) {
|
for (i = 0; i < 4 * runs + 1; i++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user