exhaustive_tests: Fix with ecmult_gen table with custom generator
This commit is contained in:
parent
e1a76530db
commit
5106226991
@ -52,11 +52,18 @@ int main(int argc, char **argv) {
|
||||
|
||||
fprintf(fp, "#ifndef SECP256K1_ECMULT_GEN_STATIC_PREC_TABLE_H\n");
|
||||
fprintf(fp, "#define SECP256K1_ECMULT_GEN_STATIC_PREC_TABLE_H\n");
|
||||
|
||||
fprintf(fp, "#include \"src/group.h\"\n");
|
||||
|
||||
fprintf(fp, "#define SC SECP256K1_GE_STORAGE_CONST\n");
|
||||
|
||||
fprintf(fp, "#if ECMULT_GEN_PREC_N != %d || ECMULT_GEN_PREC_G != %d\n", ECMULT_GEN_PREC_N, ECMULT_GEN_PREC_G);
|
||||
fprintf(fp, " #error configuration mismatch, invalid ECMULT_GEN_PREC_N, ECMULT_GEN_PREC_G. Try deleting %s before the build.\n", outfile);
|
||||
fprintf(fp, "#endif\n");
|
||||
|
||||
fprintf(fp, "#ifdef EXHAUSTIVE_TEST_ORDER\n");
|
||||
fprintf(fp, "static secp256k1_ge_storage secp256k1_ecmult_gen_prec_table[ECMULT_GEN_PREC_N][ECMULT_GEN_PREC_G];\n");
|
||||
fprintf(fp, "#else\n");
|
||||
fprintf(fp, "static const secp256k1_ge_storage secp256k1_ecmult_gen_prec_table[ECMULT_GEN_PREC_N][ECMULT_GEN_PREC_G] = {\n");
|
||||
|
||||
table = checked_malloc(&default_error_callback, ECMULT_GEN_PREC_TABLE_SIZE);
|
||||
@ -80,8 +87,9 @@ int main(int argc, char **argv) {
|
||||
fprintf(fp,"};\n");
|
||||
free(table);
|
||||
|
||||
fprintf(fp, "#endif /* EXHAUSTIVE_TEST_ORDER */\n");
|
||||
fprintf(fp, "#undef SC\n");
|
||||
fprintf(fp, "#endif\n");
|
||||
fprintf(fp, "#endif /* SECP256K1_ECMULT_GEN_STATIC_PREC_TABLE_H */\n");
|
||||
fclose(fp);
|
||||
|
||||
return 0;
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "assumptions.h"
|
||||
#include "group.h"
|
||||
#include "testrand_impl.h"
|
||||
#include "ecmult_gen_prec_impl.h"
|
||||
|
||||
static int count = 2;
|
||||
|
||||
@ -388,6 +389,9 @@ int main(int argc, char** argv) {
|
||||
printf("running tests for core %lu (out of [0..%lu])\n", (unsigned long)this_core, (unsigned long)num_cores - 1);
|
||||
}
|
||||
|
||||
/* Recreate the ecmult_gen table using the right generator (as selected via EXHAUSTIVE_TEST_ORDER) */
|
||||
secp256k1_ecmult_gen_create_prec_table(&secp256k1_ecmult_gen_prec_table[0][0], &secp256k1_ge_const_g);
|
||||
|
||||
while (count--) {
|
||||
/* Build context */
|
||||
ctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN | SECP256K1_CONTEXT_VERIFY);
|
||||
|
Loading…
x
Reference in New Issue
Block a user