Skip to content

Commit

Permalink
gen_context: Don't include basic-config.h
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
real-or-random committed Apr 15, 2021
1 parent 1e5d50f commit a3aa262
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
9 changes: 0 additions & 9 deletions src/basic-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
5 changes: 3 additions & 2 deletions src/gen_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit a3aa262

Please sign in to comment.