From 075252c1b7948522455c907ddc97b26f861288eb Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Fri, 17 Dec 2021 11:28:48 -0500 Subject: [PATCH] Rename ecmult_static_pre_g -> precomputed_ecmult --- .gitattributes | 2 +- Makefile.am | 4 ++-- configure.ac | 2 +- src/ecmult_impl.h | 4 ++-- src/precompute_ecmult.c | 12 ++++++------ src/{ecmult_static_pre_g.h => precomputed_ecmult.h} | 8 ++++---- 6 files changed, 16 insertions(+), 16 deletions(-) rename src/{ecmult_static_pre_g.h => precomputed_ecmult.h} (99%) diff --git a/.gitattributes b/.gitattributes index c692c1668..728afae84 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,2 @@ -src/ecmult_static_pre_g.h linguist-generated +src/precomputed_ecmult.h linguist-generated src/precomputed_ecmult_gen.h linguist-generated diff --git a/Makefile.am b/Makefile.am index 68b258cad..09c6010d0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -147,14 +147,14 @@ precompute_ecmult_gen_LDADD = $(SECP_LIBS) $(COMMON_LIB) # build by a normal user) depends on mtimes, and thus is very fragile. # This means that rebuilds of the prebuilt files always need to be # forced by deleting them, e.g., by invoking `make clean-precomp`. -src/ecmult_static_pre_g.h: +src/precomputed_ecmult.h: $(MAKE) $(AM_MAKEFLAGS) precompute_ecmult$(EXEEXT) ./precompute_ecmult$(EXEEXT) src/precomputed_ecmult_gen.h: $(MAKE) $(AM_MAKEFLAGS) precompute_ecmult_gen$(EXEEXT) ./precompute_ecmult_gen$(EXEEXT) -PRECOMP = src/precomputed_ecmult_gen.h src/ecmult_static_pre_g.h +PRECOMP = src/precomputed_ecmult_gen.h src/precomputed_ecmult.h noinst_HEADERS += $(PRECOMP) precomp: $(PRECOMP) diff --git a/configure.ac b/configure.ac index 94feea7bb..5ea206fe6 100644 --- a/configure.ac +++ b/configure.ac @@ -152,7 +152,7 @@ AC_ARG_WITH([ecmult-window], [AS_HELP_STRING([--with-ecmult-window=SIZE|auto], [window size for ecmult precomputation for verification, specified as integer in range [2..24].] [Larger values result in possibly better performance at the cost of an exponentially larger precomputed table.] [The table will store 2^(SIZE-1) * 64 bytes of data but can be larger in memory due to platform-specific padding and alignment.] -[A window size larger than 15 will require you delete the prebuilt ecmult_static_pre_g.h file so that it can be rebuilt.] +[A window size larger than 15 will require you delete the prebuilt precomputed_ecmult.h file so that it can be rebuilt.] [For very large window sizes, use "make -j 1" to reduce memory use during compilation.] ["auto" is a reasonable setting for desktop machines (currently 15). [default=auto]] )], diff --git a/src/ecmult_impl.h b/src/ecmult_impl.h index 5bd4d4d23..07248f18c 100644 --- a/src/ecmult_impl.h +++ b/src/ecmult_impl.h @@ -14,7 +14,7 @@ #include "group.h" #include "scalar.h" #include "ecmult.h" -#include "ecmult_static_pre_g.h" +#include "precomputed_ecmult.h" #if defined(EXHAUSTIVE_TEST_ORDER) /* We need to lower these values for exhaustive tests because @@ -103,7 +103,7 @@ static void secp256k1_ecmult_odd_multiples_table(int n, secp256k1_gej *prej, sec * It only operates on tables sized for WINDOW_A wnaf multiples. * * To compute a*P + b*G, we compute a table for P using this function, - * and use the precomputed table in for G. + * and use the precomputed table in for G. */ static void secp256k1_ecmult_odd_multiples_table_globalz_windowa(secp256k1_ge *pre, secp256k1_fe *globalz, const secp256k1_gej *a) { secp256k1_gej prej[ECMULT_TABLE_SIZE(WINDOW_A)]; diff --git a/src/precompute_ecmult.c b/src/precompute_ecmult.c index 7c667aeb8..d87298841 100644 --- a/src/precompute_ecmult.c +++ b/src/precompute_ecmult.c @@ -81,9 +81,9 @@ int main(void) { const int window_g_199 = 8; FILE* fp; - fp = fopen("src/ecmult_static_pre_g.h","w"); + fp = fopen("src/precomputed_ecmult.h","w"); if (fp == NULL) { - fprintf(stderr, "Could not open src/ecmult_static_pre_g.h for writing!\n"); + fprintf(stderr, "Could not open src/precomputed_ecmult.h for writing!\n"); return -1; } @@ -91,8 +91,8 @@ int main(void) { fprintf(fp, "/* This file contains an array secp256k1_pre_g with odd multiples of the base point G and\n"); fprintf(fp, " * an array secp256k1_pre_g_128 with odd multiples of 2^128*G for accelerating the computation of a*P + b*G.\n"); fprintf(fp, " */\n"); - fprintf(fp, "#ifndef SECP256K1_ECMULT_STATIC_PRE_G_H\n"); - fprintf(fp, "#define SECP256K1_ECMULT_STATIC_PRE_G_H\n"); + fprintf(fp, "#ifndef SECP256K1_PRECOMPUTED_ECMULT_H\n"); + fprintf(fp, "#define SECP256K1_PRECOMPUTED_ECMULT_H\n"); fprintf(fp, "#include \"group.h\"\n"); fprintf(fp, "#ifdef S\n"); fprintf(fp, " #error macro identifier S already in use.\n"); @@ -101,7 +101,7 @@ int main(void) { "SECP256K1_GE_STORAGE_CONST(0x##a##u,0x##b##u,0x##c##u,0x##d##u,0x##e##u,0x##f##u,0x##g##u," "0x##h##u,0x##i##u,0x##j##u,0x##k##u,0x##l##u,0x##m##u,0x##n##u,0x##o##u,0x##p##u)\n"); fprintf(fp, "#if ECMULT_TABLE_SIZE(ECMULT_WINDOW_SIZE) > %ld\n", ECMULT_TABLE_SIZE(ECMULT_WINDOW_SIZE)); - fprintf(fp, " #error configuration mismatch, invalid ECMULT_WINDOW_SIZE. Try deleting ecmult_static_pre_g.h before the build.\n"); + fprintf(fp, " #error configuration mismatch, invalid ECMULT_WINDOW_SIZE. Try deleting precomputed_ecmult.h before the build.\n"); fprintf(fp, "#endif\n"); fprintf(fp, "#if defined(EXHAUSTIVE_TEST_ORDER)\n"); fprintf(fp, "#if EXHAUSTIVE_TEST_ORDER == 13\n"); @@ -124,7 +124,7 @@ int main(void) { fprintf(fp, "#endif\n"); fprintf(fp, "#undef S\n"); - fprintf(fp, "#endif\n"); + fprintf(fp, "#endif /* SECP256K1_PRECOMPUTED_ECMULT_H */\n"); fclose(fp); return 0; diff --git a/src/ecmult_static_pre_g.h b/src/precomputed_ecmult.h similarity index 99% rename from src/ecmult_static_pre_g.h rename to src/precomputed_ecmult.h index 7e254ac71..511c77f4f 100644 --- a/src/ecmult_static_pre_g.h +++ b/src/precomputed_ecmult.h @@ -2,15 +2,15 @@ /* This file contains an array secp256k1_pre_g with odd multiples of the base point G and * an array secp256k1_pre_g_128 with odd multiples of 2^128*G for accelerating the computation of a*P + b*G. */ -#ifndef SECP256K1_ECMULT_STATIC_PRE_G_H -#define SECP256K1_ECMULT_STATIC_PRE_G_H +#ifndef SECP256K1_PRECOMPUTED_ECMULT_H +#define SECP256K1_PRECOMPUTED_ECMULT_H #include "group.h" #ifdef S #error macro identifier S already in use. #endif #define S(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) SECP256K1_GE_STORAGE_CONST(0x##a##u,0x##b##u,0x##c##u,0x##d##u,0x##e##u,0x##f##u,0x##g##u,0x##h##u,0x##i##u,0x##j##u,0x##k##u,0x##l##u,0x##m##u,0x##n##u,0x##o##u,0x##p##u) #if ECMULT_TABLE_SIZE(ECMULT_WINDOW_SIZE) > 8192 - #error configuration mismatch, invalid ECMULT_WINDOW_SIZE. Try deleting ecmult_static_pre_g.h before the build. + #error configuration mismatch, invalid ECMULT_WINDOW_SIZE. Try deleting precomputed_ecmult.h before the build. #endif #if defined(EXHAUSTIVE_TEST_ORDER) #if EXHAUSTIVE_TEST_ORDER == 13 @@ -16608,4 +16608,4 @@ static const secp256k1_ge_storage secp256k1_pre_g_128[ECMULT_TABLE_SIZE(WINDOW_G }; #endif #undef S -#endif +#endif /* SECP256K1_PRECOMPUTED_ECMULT_H */