From 8ae18f1ab3dce4c487bab75c2f0cdf4fe311b318 Mon Sep 17 00:00:00 2001 From: Tim Ruffing Date: Thu, 7 Oct 2021 18:27:11 +0200 Subject: [PATCH] refactor: Rename file that contains static ecmult_gen table --- Makefile.am | 14 +++++++------- src/ecmult_gen_impl.h | 2 +- src/gen_context.c | 11 ++++++----- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Makefile.am b/Makefile.am index d07e7bc..457d564 100644 --- a/Makefile.am +++ b/Makefile.am @@ -143,16 +143,16 @@ $(gen_context_OBJECTS): src/gen_context.c src/libsecp256k1-config.h $(gen_context_BIN): $(gen_context_OBJECTS) $(CC_FOR_BUILD) $(SECP_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $^ -o $@ -$(libsecp256k1_la_OBJECTS): src/ecmult_static_context.h -$(tests_OBJECTS): src/ecmult_static_context.h -$(exhaustive_tests_OBJECTS): src/ecmult_static_context.h -$(bench_internal_OBJECTS): src/ecmult_static_context.h -$(bench_ecmult_OBJECTS): src/ecmult_static_context.h +$(libsecp256k1_la_OBJECTS): src/ecmult_gen_static_prec_table.h +$(tests_OBJECTS): src/ecmult_gen_static_prec_table.h +$(exhaustive_tests_OBJECTS): src/ecmult_gen_static_prec_table.h +$(bench_internal_OBJECTS): src/ecmult_gen_static_prec_table.h +$(bench_ecmult_OBJECTS): src/ecmult_gen_static_prec_table.h -src/ecmult_static_context.h: $(gen_context_BIN) +src/ecmult_gen_static_prec_table.h: $(gen_context_BIN) ./$(gen_context_BIN) -CLEANFILES = $(gen_context_BIN) src/ecmult_static_context.h +CLEANFILES = $(gen_context_BIN) src/ecmult_gen_static_prec_table.h endif EXTRA_DIST = autogen.sh src/gen_context.c src/ecmult_static_pre_g.h src/basic-config.h diff --git a/src/ecmult_gen_impl.h b/src/ecmult_gen_impl.h index bce9d18..22b7aca 100644 --- a/src/ecmult_gen_impl.h +++ b/src/ecmult_gen_impl.h @@ -12,7 +12,7 @@ #include "group.h" #include "ecmult_gen.h" #include "hash_impl.h" -#include "ecmult_static_context.h" +#include "ecmult_gen_static_prec_table.h" static void secp256k1_ecmult_gen_context_build(secp256k1_ecmult_gen_context *ctx) { secp256k1_ecmult_gen_blind(ctx, NULL); diff --git a/src/gen_context.c b/src/gen_context.c index 9b770bb..4d5ba95 100644 --- a/src/gen_context.c +++ b/src/gen_context.c @@ -38,23 +38,24 @@ int main(int argc, char **argv) { secp256k1_ge_storage* table; int inner; int outer; + const char outfile[] = "src/ecmult_gen_static_prec_table.h"; FILE* fp; (void)argc; (void)argv; - fp = fopen("src/ecmult_static_context.h","w"); + fp = fopen(outfile, "w"); if (fp == NULL) { - fprintf(stderr, "Could not open src/ecmult_static_context.h for writing!\n"); + fprintf(stderr, "Could not open %s for writing!\n", outfile); return -1; } - fprintf(fp, "#ifndef SECP256K1_ECMULT_STATIC_CONTEXT_H\n"); - fprintf(fp, "#define SECP256K1_ECMULT_STATIC_CONTEXT_H\n"); + 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 ecmult_static_context.h before the build.\n"); + 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, "static const secp256k1_ge_storage secp256k1_ecmult_gen_prec_table[ECMULT_GEN_PREC_N][ECMULT_GEN_PREC_G] = {\n");