|
|
@ -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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -2050,8 +2050,8 @@ void test_ge(void) {
|
|
|
|
secp256k1_fe_mul(&zr[i + 1], &zinv[i], &gej[i + 1].z);
|
|
|
|
secp256k1_fe_mul(&zr[i + 1], &zinv[i], &gej[i + 1].z);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
secp256k1_ge_set_table_gej_var(4 * runs + 1, ge_set_table, gej, zr);
|
|
|
|
secp256k1_ge_set_table_gej_var(ge_set_table, gej, zr, 4 * runs + 1);
|
|
|
|
secp256k1_ge_set_all_gej_var(4 * runs + 1, ge_set_all, gej, &ctx->error_callback);
|
|
|
|
secp256k1_ge_set_all_gej_var(ge_set_all, gej, 4 * runs + 1, &ctx->error_callback);
|
|
|
|
for (i = 0; i < 4 * runs + 1; i++) {
|
|
|
|
for (i = 0; i < 4 * runs + 1; i++) {
|
|
|
|
secp256k1_fe s;
|
|
|
|
secp256k1_fe s;
|
|
|
|
random_fe_non_zero(&s);
|
|
|
|
random_fe_non_zero(&s);
|
|
|
|