From a3aa2628c7b675814157556d774872755c9f1aba Mon Sep 17 00:00:00 2001 From: Tim Ruffing Date: Thu, 15 Apr 2021 16:17:53 +0200 Subject: [PATCH] gen_context: Don't include basic-config.h Before this commit, gen_context.c both included libsecp256k1-config.h and basic-config.h: The former only to obtain ECMULT_GEN_PREC_BITS and the latter to obtain a basic working configuration to be able to use the library. This was inelegant and confusing: It meant that basic-config.h needs to #undef all the macros defined in libsecp256k1-config.h. Moreover, it meant that basic-config.h cannot define ECMULT_GEN_PREC_BITS, essentially making this file specific for use in gen_context.c. After this commit, gen_context.c include only libsecp256k1-config.h. basic-config.h is not necessary anymore for the modules used in gen_context.c because 79f1f7a made the preprocessor detect all the relevant config options. On the way, we remove an unused #define in basic-config.h. --- src/basic-config.h | 9 --------- src/gen_context.c | 5 +++-- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/basic-config.h b/src/basic-config.h index e4b1b8b056ffb..1326bf7c0e6c1 100644 --- a/src/basic-config.h +++ b/src/basic-config.h @@ -9,15 +9,6 @@ #ifdef USE_BASIC_CONFIG -#undef USE_ASM_X86_64 -#undef USE_ECMULT_STATIC_PRECOMPUTATION -#undef USE_EXTERNAL_ASM -#undef USE_EXTERNAL_DEFAULT_CALLBACKS -#undef USE_FORCE_WIDEMUL_INT64 -#undef USE_FORCE_WIDEMUL_INT128 -#undef ECMULT_WINDOW_SIZE - -#define USE_WIDEMUL_64 1 #define ECMULT_WINDOW_SIZE 15 #endif /* USE_BASIC_CONFIG */ diff --git a/src/gen_context.c b/src/gen_context.c index 05e7dee17531a..024c55726170f 100644 --- a/src/gen_context.c +++ b/src/gen_context.c @@ -9,8 +9,9 @@ #if !defined(ECMULT_GEN_PREC_BITS) #include "libsecp256k1-config.h" #endif -#define USE_BASIC_CONFIG 1 -#include "basic-config.h" + +/* We can't require the precomputed tables when creating them. */ +#undef USE_ECMULT_STATIC_PRECOMPUTATION #include "include/secp256k1.h" #include "assumptions.h"