diff --git a/src/field_5x52_int128_impl.h b/src/field_5x52_int128_impl.h index 970e401..18567b9 100644 --- a/src/field_5x52_int128_impl.h +++ b/src/field_5x52_int128_impl.h @@ -9,6 +9,8 @@ #include +#include "int128.h" + #ifdef VERIFY #define VERIFY_BITS(x, n) VERIFY_CHECK(((x) >> (n)) == 0) #define VERIFY_BITS_128(x, n) VERIFY_CHECK(secp256k1_u128_check_bits((x), (n))) diff --git a/src/int128.h b/src/int128.h index 174d3d6..732458e 100644 --- a/src/int128.h +++ b/src/int128.h @@ -1,19 +1,16 @@ #ifndef SECP256K1_INT128_H #define SECP256K1_INT128_H -#if defined HAVE_CONFIG_H -#include "libsecp256k1-config.h" -#endif - #include "util.h" -#if defined(SECP256K1_INT128_NATIVE) -#include "int128_native.h" -#elif defined(SECP256K1_INT128_STRUCT) -#include "int128_struct.h" -#else -#error "Please select int128 implementation" -#endif +#if defined(SECP256K1_WIDEMUL_INT128) +# if defined(SECP256K1_INT128_NATIVE) +# include "int128_native.h" +# elif defined(SECP256K1_INT128_STRUCT) +# include "int128_struct.h" +# else +# error "Please select int128 implementation" +# endif /* Multiply two unsigned 64-bit values a and b and write the result to r. */ static SECP256K1_INLINE void secp256k1_u128_mul(secp256k1_uint128 *r, uint64_t a, uint64_t b); @@ -78,3 +75,5 @@ static SECP256K1_INLINE int secp256k1_i128_eq_var(const secp256k1_int128 *a, con static SECP256K1_INLINE int secp256k1_i128_check_pow2(const secp256k1_int128 *r, unsigned int n); #endif + +#endif diff --git a/src/int128_impl.h b/src/int128_impl.h index 3387fea..cfc5734 100644 --- a/src/int128_impl.h +++ b/src/int128_impl.h @@ -1,19 +1,18 @@ #ifndef SECP256K1_INT128_IMPL_H #define SECP256K1_INT128_IMPL_H -#include "int128.h" #include "util.h" -#if defined HAVE_CONFIG_H -#include "libsecp256k1-config.h" -#endif +#include "int128.h" -#if defined(SECP256K1_INT128_NATIVE) -#include "int128_native_impl.h" -#elif defined(SECP256K1_INT128_STRUCT) -#include "int128_struct_impl.h" -#else -#error "Please select int128 implementation" +#if defined(SECP256K1_WIDEMUL_INT128) +# if defined(SECP256K1_INT128_NATIVE) +# include "int128_native_impl.h" +# elif defined(SECP256K1_INT128_STRUCT) +# include "int128_struct_impl.h" +# else +# error "Please select int128 implementation" +# endif #endif #endif diff --git a/src/modinv64_impl.h b/src/modinv64_impl.h index 807ace2..50be2e5 100644 --- a/src/modinv64_impl.h +++ b/src/modinv64_impl.h @@ -7,10 +7,9 @@ #ifndef SECP256K1_MODINV64_IMPL_H #define SECP256K1_MODINV64_IMPL_H +#include "int128.h" #include "modinv64.h" -#include "int128_impl.h" - /* This file implements modular inversion based on the paper "Fast constant-time gcd computation and * modular inversion" by Daniel J. Bernstein and Bo-Yin Yang. * diff --git a/src/precompute_ecmult.c b/src/precompute_ecmult.c index 5ccbcb3..2aa37b8 100644 --- a/src/precompute_ecmult.c +++ b/src/precompute_ecmult.c @@ -14,10 +14,13 @@ #endif #include "../include/secp256k1.h" + #include "assumptions.h" #include "util.h" + #include "field_impl.h" #include "group_impl.h" +#include "int128_impl.h" #include "ecmult.h" #include "ecmult_compute_table_impl.h" diff --git a/src/precompute_ecmult_gen.c b/src/precompute_ecmult_gen.c index 7c6359c..a4ec8e0 100644 --- a/src/precompute_ecmult_gen.c +++ b/src/precompute_ecmult_gen.c @@ -8,9 +8,12 @@ #include #include "../include/secp256k1.h" + #include "assumptions.h" #include "util.h" + #include "group.h" +#include "int128_impl.h" #include "ecmult_gen.h" #include "ecmult_gen_compute_table_impl.h" diff --git a/src/scalar_4x64_impl.h b/src/scalar_4x64_impl.h index 4adbd31..4588219 100644 --- a/src/scalar_4x64_impl.h +++ b/src/scalar_4x64_impl.h @@ -7,6 +7,7 @@ #ifndef SECP256K1_SCALAR_REPR_IMPL_H #define SECP256K1_SCALAR_REPR_IMPL_H +#include "int128.h" #include "modinv64_impl.h" /* Limbs of the secp256k1 order. */ diff --git a/src/secp256k1.c b/src/secp256k1.c index 96102d3..05daad2 100644 --- a/src/secp256k1.c +++ b/src/secp256k1.c @@ -22,6 +22,7 @@ #include "assumptions.h" #include "util.h" + #include "field_impl.h" #include "scalar_impl.h" #include "group_impl.h" @@ -31,6 +32,7 @@ #include "ecdsa_impl.h" #include "eckey_impl.h" #include "hash_impl.h" +#include "int128_impl.h" #include "scratch_impl.h" #include "selftest.h"