|
|
@ -1733,18 +1733,18 @@ void run_field_inv_all_var(void) {
|
|
|
|
secp256k1_fe x[16], xi[16], xii[16];
|
|
|
|
secp256k1_fe x[16], xi[16], xii[16];
|
|
|
|
int i;
|
|
|
|
int i;
|
|
|
|
/* Check it's safe to call for 0 elements */
|
|
|
|
/* Check it's safe to call for 0 elements */
|
|
|
|
secp256k1_fe_inv_all_var(0, xi, x);
|
|
|
|
secp256k1_fe_inv_all_var(xi, x, 0);
|
|
|
|
for (i = 0; i < count; i++) {
|
|
|
|
for (i = 0; i < count; i++) {
|
|
|
|
size_t j;
|
|
|
|
size_t j;
|
|
|
|
size_t len = secp256k1_rand_int(15) + 1;
|
|
|
|
size_t len = secp256k1_rand_int(15) + 1;
|
|
|
|
for (j = 0; j < len; j++) {
|
|
|
|
for (j = 0; j < len; j++) {
|
|
|
|
random_fe_non_zero(&x[j]);
|
|
|
|
random_fe_non_zero(&x[j]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
secp256k1_fe_inv_all_var(len, xi, x);
|
|
|
|
secp256k1_fe_inv_all_var(xi, x, len);
|
|
|
|
for (j = 0; j < len; j++) {
|
|
|
|
for (j = 0; j < len; j++) {
|
|
|
|
CHECK(check_fe_inverse(&x[j], &xi[j]));
|
|
|
|
CHECK(check_fe_inverse(&x[j], &xi[j]));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
secp256k1_fe_inv_all_var(len, xii, xi);
|
|
|
|
secp256k1_fe_inv_all_var(xii, xi, len);
|
|
|
|
for (j = 0; j < len; j++) {
|
|
|
|
for (j = 0; j < len; j++) {
|
|
|
|
CHECK(check_fe_equal(&x[j], &xii[j]));
|
|
|
|
CHECK(check_fe_equal(&x[j], &xii[j]));
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1930,7 +1930,7 @@ void test_ge(void) {
|
|
|
|
zs[i] = gej[i].z;
|
|
|
|
zs[i] = gej[i].z;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
secp256k1_fe_inv_all_var(4 * runs + 1, zinv, zs);
|
|
|
|
secp256k1_fe_inv_all_var(zinv, zs, 4 * runs + 1);
|
|
|
|
free(zs);
|
|
|
|
free(zs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|