Skip to content

Commit

Permalink
ecmult_static_context.h: add compile time config assertion (bitcoin-c…
Browse files Browse the repository at this point in the history
…ore#3)

Prevents accidentally using a file which was generated with a
different configuration.
  • Loading branch information
benma authored and douglasbakkum committed Jul 4, 2019
1 parent df3224d commit 7abe39b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/gen_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ int main(int argc, char **argv) {
fprintf(fp, "#define _SECP256K1_ECMULT_STATIC_CONTEXT_\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\n");
fprintf(fp, "#endif\n");
fprintf(fp, "static const secp256k1_ge_storage secp256k1_ecmult_static_context[ECMULT_GEN_PREC_N][ECMULT_GEN_PREC_G] = {\n");

base = checked_malloc(&default_error_callback, SECP256K1_ECMULT_GEN_CONTEXT_PREALLOCATED_SIZE);
Expand Down

0 comments on commit 7abe39b

Please sign in to comment.