Skip to content

Commit

Permalink
Rename ecmult_static_pre_g -> precomputed_ecmult
Browse files Browse the repository at this point in the history
  • Loading branch information
sipa committed Dec 17, 2021
1 parent 7cf47f7 commit 075252c
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
)],
Expand Down
4 changes: 2 additions & 2 deletions src/ecmult_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 <ecmult_static_pre_g.h> for G.
* and use the precomputed table in <precomputed_ecmult.h> 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)];
Expand Down
12 changes: 6 additions & 6 deletions src/precompute_ecmult.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,18 @@ 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;
}

fprintf(fp, "/* This file was automatically generated by precompute_ecmult. */\n");
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");
Expand All @@ -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");
Expand All @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/ecmult_static_pre_g.h → src/precomputed_ecmult.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 075252c

Please sign in to comment.