From 11ab562203280ea3ed5976ba2fce7a2c05706c48 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Fri, 7 Mar 2014 01:11:01 +0100 Subject: [PATCH] Move implementations from impl/*.h to *_impl.h --- Makefile.am | 26 +++++++++---------- src/bench.c | 12 ++++----- src/{impl/ecdsa.h => ecdsa_impl.h} | 10 +++---- src/{impl/ecmult.h => ecmult_impl.h} | 6 ++--- .../field_10x26.h => field_10x26_impl.h} | 4 +-- ...field_5x52_asm.h => field_5x52_asm_impl.h} | 0 src/{impl/field_5x52.h => field_5x52_impl.h} | 8 +++--- ...5x52_int128.h => field_5x52_int128_impl.h} | 0 src/{impl/field_gmp.h => field_gmp_impl.h} | 4 +-- src/{impl/field.h => field_impl.h} | 6 ++--- src/{impl/group.h => group_impl.h} | 6 ++--- src/{impl/num_gmp.h => num_gmp_impl.h} | 0 src/{impl/num.h => num_impl.h} | 6 ++--- .../num_openssl.h => num_openssl_impl.h} | 2 +- src/secp256k1.c | 10 +++---- src/tests.c | 12 ++++----- src/util.h | 2 -- src/{impl/util.h => util_impl.h} | 2 +- 18 files changed, 57 insertions(+), 59 deletions(-) rename src/{impl/ecdsa.h => ecdsa_impl.h} (99%) rename src/{impl/ecmult.h => ecmult_impl.h} (99%) rename src/{impl/field_10x26.h => field_10x26_impl.h} (99%) rename src/{impl/field_5x52_asm.h => field_5x52_asm_impl.h} (100%) rename src/{impl/field_5x52.h => field_5x52_impl.h} (98%) rename src/{impl/field_5x52_int128.h => field_5x52_int128_impl.h} (100%) rename src/{impl/field_gmp.h => field_gmp_impl.h} (99%) rename src/{impl/field.h => field_impl.h} (98%) rename src/{impl/group.h => group_impl.h} (99%) rename src/{impl/num_gmp.h => num_gmp_impl.h} (100%) rename src/{impl/num.h => num_impl.h} (85%) rename src/{impl/num_openssl.h => num_openssl_impl.h} (99%) rename src/{impl/util.h => util_impl.h} (98%) diff --git a/Makefile.am b/Makefile.am index a0bf0b2..de9ad5f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,30 +7,30 @@ libsecp256k1_la_LIBADD = $(SECP_LIBS) include_HEADERS = include/secp256k1.h noinst_HEADERS = noinst_HEADERS += src/group.h +noinst_HEADERS += src/group_impl.h noinst_HEADERS += src/num_openssl.h +noinst_HEADERS += src/num_openssl_impl.h noinst_HEADERS += src/num_gmp.h +noinst_HEADERS += src/num_gmp_impl.h noinst_HEADERS += src/ecdsa.h +noinst_HEADERS += src/ecdsa_impl.h noinst_HEADERS += src/ecmult.h +noinst_HEADERS += src/ecmult_impl.h noinst_HEADERS += src/num.h +noinst_HEADERS += src/num_impl.h noinst_HEADERS += src/field_10x26.h +noinst_HEADERS += src/field_10x26_impl.h noinst_HEADERS += src/field_5x52.h +noinst_HEADERS += src/field_5x52_impl.h +noinst_HEADERS += src/field_5x52_int128_impl.h +noinst_HEADERS += src/field_5x52_asm_impl.h noinst_HEADERS += src/java/org_bitcoin_NativeSecp256k1.h noinst_HEADERS += src/util.h +noinst_HEADERS += src/util_impl.h noinst_HEADERS += src/field_gmp.h -noinst_HEADERS += src/impl/group.h -noinst_HEADERS += src/impl/num_openssl.h -noinst_HEADERS += src/impl/num_gmp.h -noinst_HEADERS += src/impl/ecdsa.h -noinst_HEADERS += src/impl/field_5x52_int128.h -noinst_HEADERS += src/impl/ecmult.h -noinst_HEADERS += src/impl/num.h -noinst_HEADERS += src/impl/field_10x26.h -noinst_HEADERS += src/impl/field_5x52.h -noinst_HEADERS += src/impl/util.h -noinst_HEADERS += src/impl/field_gmp.h -noinst_HEADERS += src/impl/field_5x52_asm.h -noinst_HEADERS += src/impl/field.h +noinst_HEADERS += src/field_gmp_impl.h noinst_HEADERS += src/field.h +noinst_HEADERS += src/field_impl.h if USE_ASM libsecp256k1_la_SOURCES += src/field_5x52_asm.asm diff --git a/src/bench.c b/src/bench.c index eeb7134..a7e2eed 100644 --- a/src/bench.c +++ b/src/bench.c @@ -4,12 +4,12 @@ #include -#include "impl/num.h" -#include "impl/field.h" -#include "impl/group.h" -#include "impl/ecmult.h" -#include "impl/ecdsa.h" -#include "impl/util.h" +#include "num_impl.h" +#include "field_impl.h" +#include "group_impl.h" +#include "ecmult_impl.h" +#include "ecdsa_impl.h" +#include "util_impl.h" void random_num_order(secp256k1_num_t *num) { do { diff --git a/src/impl/ecdsa.h b/src/ecdsa_impl.h similarity index 99% rename from src/impl/ecdsa.h rename to src/ecdsa_impl.h index b001e26..9dd0548 100644 --- a/src/impl/ecdsa.h +++ b/src/ecdsa_impl.h @@ -5,11 +5,11 @@ #ifndef _SECP256K1_ECDSA_IMPL_H_ #define _SECP256K1_ECDSA_IMPL_H_ -#include "../num.h" -#include "../field.h" -#include "../group.h" -#include "../ecmult.h" -#include "../ecdsa.h" +#include "num.h" +#include "field.h" +#include "group.h" +#include "ecmult.h" +#include "ecdsa.h" void static secp256k1_ecdsa_sig_init(secp256k1_ecdsa_sig_t *r) { secp256k1_num_init(&r->r); diff --git a/src/impl/ecmult.h b/src/ecmult_impl.h similarity index 99% rename from src/impl/ecmult.h rename to src/ecmult_impl.h index 9b1b2ac..cf87811 100644 --- a/src/impl/ecmult.h +++ b/src/ecmult_impl.h @@ -5,9 +5,9 @@ #ifndef _SECP256K1_ECMULT_IMPL_H_ #define _SECP256K1_ECMULT_IMPL_H_ -#include "../num.h" -#include "../group.h" -#include "../ecmult.h" +#include "num.h" +#include "group.h" +#include "ecmult.h" // optimal for 128-bit and 256-bit exponents. #define WINDOW_A 5 diff --git a/src/impl/field_10x26.h b/src/field_10x26_impl.h similarity index 99% rename from src/impl/field_10x26.h rename to src/field_10x26_impl.h index 4497692..2220e54 100644 --- a/src/impl/field_10x26.h +++ b/src/field_10x26_impl.h @@ -8,8 +8,8 @@ #include #include #include -#include "../num.h" -#include "../field.h" +#include "num.h" +#include "field.h" void static secp256k1_fe_inner_start(void) {} void static secp256k1_fe_inner_stop(void) {} diff --git a/src/impl/field_5x52_asm.h b/src/field_5x52_asm_impl.h similarity index 100% rename from src/impl/field_5x52_asm.h rename to src/field_5x52_asm_impl.h diff --git a/src/impl/field_5x52.h b/src/field_5x52_impl.h similarity index 98% rename from src/impl/field_5x52.h rename to src/field_5x52_impl.h index b9b2be2..a9064ee 100644 --- a/src/impl/field_5x52.h +++ b/src/field_5x52_impl.h @@ -11,13 +11,13 @@ #include #include -#include "../num.h" -#include "../field.h" +#include "num.h" +#include "field.h" #if defined(USE_FIELD_5X52_ASM) -#include "field_5x52_asm.h" +#include "field_5x52_asm_impl.h" #elif defined(USE_FIELD_5X52_INT128) -#include "field_5x52_int128.h" +#include "field_5x52_int128_impl.h" #else #error "Please select field_5x52 implementation" #endif diff --git a/src/impl/field_5x52_int128.h b/src/field_5x52_int128_impl.h similarity index 100% rename from src/impl/field_5x52_int128.h rename to src/field_5x52_int128_impl.h diff --git a/src/impl/field_gmp.h b/src/field_gmp_impl.h similarity index 99% rename from src/impl/field_gmp.h rename to src/field_gmp_impl.h index 6172ef4..880c5a7 100644 --- a/src/impl/field_gmp.h +++ b/src/field_gmp_impl.h @@ -8,8 +8,8 @@ #include #include #include -#include "../num.h" -#include "../field.h" +#include "num.h" +#include "field.h" static mp_limb_t secp256k1_field_p[FIELD_LIMBS]; static mp_limb_t secp256k1_field_pc[(33+GMP_NUMB_BITS-1)/GMP_NUMB_BITS]; diff --git a/src/impl/field.h b/src/field_impl.h similarity index 98% rename from src/impl/field.h rename to src/field_impl.h index 76cf730..11fdfd5 100644 --- a/src/impl/field.h +++ b/src/field_impl.h @@ -10,11 +10,11 @@ #endif #if defined(USE_FIELD_GMP) -#include "field_gmp.h" +#include "field_gmp_impl.h" #elif defined(USE_FIELD_10X26) -#include "field_10x26.h" +#include "field_10x26_impl.h" #elif defined(USE_FIELD_5X52) -#include "field_5x52.h" +#include "field_5x52_impl.h" #else #error "Please select field implementation" #endif diff --git a/src/impl/group.h b/src/group_impl.h similarity index 99% rename from src/impl/group.h rename to src/group_impl.h index cfbe800..927d25a 100644 --- a/src/impl/group.h +++ b/src/group_impl.h @@ -7,9 +7,9 @@ #include -#include "../num.h" -#include "../field.h" -#include "../group.h" +#include "num.h" +#include "field.h" +#include "group.h" void static secp256k1_ge_set_infinity(secp256k1_ge_t *r) { r->infinity = 1; diff --git a/src/impl/num_gmp.h b/src/num_gmp_impl.h similarity index 100% rename from src/impl/num_gmp.h rename to src/num_gmp_impl.h diff --git a/src/impl/num.h b/src/num_impl.h similarity index 85% rename from src/impl/num.h rename to src/num_impl.h index 95b1240..fda1270 100644 --- a/src/impl/num.h +++ b/src/num_impl.h @@ -9,12 +9,12 @@ #include "libsecp256k1-config.h" #endif -#include "../num.h" +#include "num.h" #if defined(USE_NUM_GMP) -#include "num_gmp.h" +#include "num_gmp_impl.h" #elif defined(USE_NUM_OPENSSL) -#include "num_openssl.h" +#include "num_openssl_impl.h" #else #error "Please select num implementation" #endif diff --git a/src/impl/num_openssl.h b/src/num_openssl_impl.h similarity index 99% rename from src/impl/num_openssl.h rename to src/num_openssl_impl.h index 0a54689..948b2e7 100644 --- a/src/impl/num_openssl.h +++ b/src/num_openssl_impl.h @@ -11,7 +11,7 @@ #include #include -#include "../num.h" +#include "num.h" void static secp256k1_num_init(secp256k1_num_t *r) { BN_init(&r->bn); diff --git a/src/secp256k1.c b/src/secp256k1.c index ed8bf2e..d38b665 100644 --- a/src/secp256k1.c +++ b/src/secp256k1.c @@ -2,11 +2,11 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include "impl/num.h" -#include "impl/field.h" -#include "impl/group.h" -#include "impl/ecmult.h" -#include "impl/ecdsa.h" +#include "num_impl.h" +#include "field_impl.h" +#include "group_impl.h" +#include "ecmult_impl.h" +#include "ecdsa_impl.h" void secp256k1_start(void) { secp256k1_fe_start(); diff --git a/src/tests.c b/src/tests.c index 26c894e..30baa5e 100644 --- a/src/tests.c +++ b/src/tests.c @@ -9,12 +9,12 @@ #include #include -#include "impl/num.h" -#include "impl/field.h" -#include "impl/group.h" -#include "impl/ecmult.h" -#include "impl/ecdsa.h" -#include "impl/util.h" +#include "num_impl.h" +#include "field_impl.h" +#include "group_impl.h" +#include "ecmult_impl.h" +#include "ecdsa_impl.h" +#include "util_impl.h" #ifdef ENABLE_OPENSSL_TESTS #include "openssl/bn.h" diff --git a/src/util.h b/src/util.h index 357c7e0..d047b0f 100644 --- a/src/util.h +++ b/src/util.h @@ -14,6 +14,4 @@ static void secp256k1_rand256(unsigned char *b32); /** Generate a pseudorandom 32-byte array with long sequences of zero and one bits. */ static void secp256k1_rand256_test(unsigned char *b32); -#include "impl/util.h" - #endif diff --git a/src/impl/util.h b/src/util_impl.h similarity index 98% rename from src/impl/util.h rename to src/util_impl.h index a59a00c..58750f8 100644 --- a/src/impl/util.h +++ b/src/util_impl.h @@ -8,7 +8,7 @@ #include #include -#include "../util.h" +#include "util.h" static inline uint32_t secp256k1_rand32(void) { static uint32_t Rz = 11, Rw = 11;