refactor: Rename file that contains static ecmult_gen table
This commit is contained in:
parent
00d2fa116e
commit
8ae18f1ab3
14
Makefile.am
14
Makefile.am
|
@ -143,16 +143,16 @@ $(gen_context_OBJECTS): src/gen_context.c src/libsecp256k1-config.h
|
||||||
$(gen_context_BIN): $(gen_context_OBJECTS)
|
$(gen_context_BIN): $(gen_context_OBJECTS)
|
||||||
$(CC_FOR_BUILD) $(SECP_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $^ -o $@
|
$(CC_FOR_BUILD) $(SECP_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $^ -o $@
|
||||||
|
|
||||||
$(libsecp256k1_la_OBJECTS): src/ecmult_static_context.h
|
$(libsecp256k1_la_OBJECTS): src/ecmult_gen_static_prec_table.h
|
||||||
$(tests_OBJECTS): src/ecmult_static_context.h
|
$(tests_OBJECTS): src/ecmult_gen_static_prec_table.h
|
||||||
$(exhaustive_tests_OBJECTS): src/ecmult_static_context.h
|
$(exhaustive_tests_OBJECTS): src/ecmult_gen_static_prec_table.h
|
||||||
$(bench_internal_OBJECTS): src/ecmult_static_context.h
|
$(bench_internal_OBJECTS): src/ecmult_gen_static_prec_table.h
|
||||||
$(bench_ecmult_OBJECTS): src/ecmult_static_context.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)
|
./$(gen_context_BIN)
|
||||||
|
|
||||||
CLEANFILES = $(gen_context_BIN) src/ecmult_static_context.h
|
CLEANFILES = $(gen_context_BIN) src/ecmult_gen_static_prec_table.h
|
||||||
endif
|
endif
|
||||||
|
|
||||||
EXTRA_DIST = autogen.sh src/gen_context.c src/ecmult_static_pre_g.h src/basic-config.h
|
EXTRA_DIST = autogen.sh src/gen_context.c src/ecmult_static_pre_g.h src/basic-config.h
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include "group.h"
|
#include "group.h"
|
||||||
#include "ecmult_gen.h"
|
#include "ecmult_gen.h"
|
||||||
#include "hash_impl.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) {
|
static void secp256k1_ecmult_gen_context_build(secp256k1_ecmult_gen_context *ctx) {
|
||||||
secp256k1_ecmult_gen_blind(ctx, NULL);
|
secp256k1_ecmult_gen_blind(ctx, NULL);
|
||||||
|
|
|
@ -38,23 +38,24 @@ int main(int argc, char **argv) {
|
||||||
secp256k1_ge_storage* table;
|
secp256k1_ge_storage* table;
|
||||||
int inner;
|
int inner;
|
||||||
int outer;
|
int outer;
|
||||||
|
const char outfile[] = "src/ecmult_gen_static_prec_table.h";
|
||||||
FILE* fp;
|
FILE* fp;
|
||||||
|
|
||||||
(void)argc;
|
(void)argc;
|
||||||
(void)argv;
|
(void)argv;
|
||||||
|
|
||||||
fp = fopen("src/ecmult_static_context.h","w");
|
fp = fopen(outfile, "w");
|
||||||
if (fp == NULL) {
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(fp, "#ifndef SECP256K1_ECMULT_STATIC_CONTEXT_H\n");
|
fprintf(fp, "#ifndef SECP256K1_ECMULT_GEN_STATIC_PREC_TABLE_H\n");
|
||||||
fprintf(fp, "#define SECP256K1_ECMULT_STATIC_CONTEXT_H\n");
|
fprintf(fp, "#define SECP256K1_ECMULT_GEN_STATIC_PREC_TABLE_H\n");
|
||||||
fprintf(fp, "#include \"src/group.h\"\n");
|
fprintf(fp, "#include \"src/group.h\"\n");
|
||||||
fprintf(fp, "#define SC SECP256K1_GE_STORAGE_CONST\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, "#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, "#endif\n");
|
||||||
fprintf(fp, "static const secp256k1_ge_storage secp256k1_ecmult_gen_prec_table[ECMULT_GEN_PREC_N][ECMULT_GEN_PREC_G] = {\n");
|
fprintf(fp, "static const secp256k1_ge_storage secp256k1_ecmult_gen_prec_table[ECMULT_GEN_PREC_N][ECMULT_GEN_PREC_G] = {\n");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue