From 3c90bdda95aa4e79ff33bfbbbe91872417650ae9 Mon Sep 17 00:00:00 2001 From: William Bright Date: Tue, 4 May 2021 13:19:33 -0400 Subject: [PATCH] change local lib headers to be relative for those pointing at "include/" dir added relative paths to header files imported from src directory added include guards for contrib/ files when referring to secp256k1.h --- contrib/lax_der_parsing.c | 1 - contrib/lax_der_parsing.h | 2 ++ contrib/lax_der_privatekey_parsing.c | 1 - contrib/lax_der_privatekey_parsing.h | 2 ++ src/bench_ecdh.c | 4 ++-- src/bench_ecmult.c | 2 +- src/bench_internal.c | 2 +- src/bench_recover.c | 4 ++-- src/bench_schnorrsig.c | 4 ++-- src/bench_sign.c | 2 +- src/bench_verify.c | 2 +- src/gen_context.c | 2 +- src/modules/ecdh/main_impl.h | 4 ++-- src/modules/extrakeys/main_impl.h | 4 ++-- src/modules/extrakeys/tests_exhaustive_impl.h | 2 +- src/modules/extrakeys/tests_impl.h | 2 +- src/modules/recovery/main_impl.h | 2 +- src/modules/recovery/tests_exhaustive_impl.h | 2 +- src/modules/schnorrsig/main_impl.h | 6 +++--- src/modules/schnorrsig/tests_exhaustive_impl.h | 2 +- src/modules/schnorrsig/tests_impl.h | 2 +- src/secp256k1.c | 4 ++-- src/tests.c | 8 ++++---- src/tests_exhaustive.c | 3 +-- src/valgrind_ctime_test.c | 10 +++++----- 25 files changed, 40 insertions(+), 39 deletions(-) diff --git a/contrib/lax_der_parsing.c b/contrib/lax_der_parsing.c index c1627e37e9e11..885a817169a5d 100644 --- a/contrib/lax_der_parsing.c +++ b/contrib/lax_der_parsing.c @@ -5,7 +5,6 @@ ***********************************************************************/ #include -#include #include "lax_der_parsing.h" diff --git a/contrib/lax_der_parsing.h b/contrib/lax_der_parsing.h index 6b7255e28f5bc..5cb3222a5b1c4 100644 --- a/contrib/lax_der_parsing.h +++ b/contrib/lax_der_parsing.h @@ -51,7 +51,9 @@ #ifndef SECP256K1_CONTRIB_LAX_DER_PARSING_H #define SECP256K1_CONTRIB_LAX_DER_PARSING_H +#ifndef SECP256K1_H #include +#endif #ifdef __cplusplus extern "C" { diff --git a/contrib/lax_der_privatekey_parsing.c b/contrib/lax_der_privatekey_parsing.c index 429760fbb6d19..372e84ea4eb04 100644 --- a/contrib/lax_der_privatekey_parsing.c +++ b/contrib/lax_der_privatekey_parsing.c @@ -5,7 +5,6 @@ ***********************************************************************/ #include -#include #include "lax_der_privatekey_parsing.h" diff --git a/contrib/lax_der_privatekey_parsing.h b/contrib/lax_der_privatekey_parsing.h index 602c7c556ad15..a397f0f5046e9 100644 --- a/contrib/lax_der_privatekey_parsing.h +++ b/contrib/lax_der_privatekey_parsing.h @@ -28,7 +28,9 @@ #ifndef SECP256K1_CONTRIB_BER_PRIVATEKEY_H #define SECP256K1_CONTRIB_BER_PRIVATEKEY_H +#ifndef SECP256K1_H #include +#endif #ifdef __cplusplus extern "C" { diff --git a/src/bench_ecdh.c b/src/bench_ecdh.c index ab4b8f4244f2b..cb020d26b4d99 100644 --- a/src/bench_ecdh.c +++ b/src/bench_ecdh.c @@ -6,8 +6,8 @@ #include -#include "include/secp256k1.h" -#include "include/secp256k1_ecdh.h" +#include "../include/secp256k1.h" +#include "../include/secp256k1_ecdh.h" #include "util.h" #include "bench.h" diff --git a/src/bench_ecmult.c b/src/bench_ecmult.c index a536ab2aec4de..68eff676edacc 100644 --- a/src/bench_ecmult.c +++ b/src/bench_ecmult.c @@ -6,8 +6,8 @@ #include #include "secp256k1.c" +#include "../include/secp256k1.h" -#include "include/secp256k1.h" #include "util.h" #include "hash_impl.h" #include "field_impl.h" diff --git a/src/bench_internal.c b/src/bench_internal.c index dfe99cf3a77a3..161b1c4a47666 100644 --- a/src/bench_internal.c +++ b/src/bench_internal.c @@ -6,8 +6,8 @@ #include #include "secp256k1.c" +#include "../include/secp256k1.h" -#include "include/secp256k1.h" #include "assumptions.h" #include "util.h" #include "hash_impl.h" diff --git a/src/bench_recover.c b/src/bench_recover.c index 3f6270ce84fd5..4bcac19dc0a39 100644 --- a/src/bench_recover.c +++ b/src/bench_recover.c @@ -4,8 +4,8 @@ * file COPYING or https://www.opensource.org/licenses/mit-license.php.* ***********************************************************************/ -#include "include/secp256k1.h" -#include "include/secp256k1_recovery.h" +#include "../include/secp256k1.h" +#include "../include/secp256k1_recovery.h" #include "util.h" #include "bench.h" diff --git a/src/bench_schnorrsig.c b/src/bench_schnorrsig.c index f7f591c41dcea..dfea1441484eb 100644 --- a/src/bench_schnorrsig.c +++ b/src/bench_schnorrsig.c @@ -8,8 +8,8 @@ #include -#include "include/secp256k1.h" -#include "include/secp256k1_schnorrsig.h" +#include "../include/secp256k1.h" +#include "../include/secp256k1_schnorrsig.h" #include "util.h" #include "bench.h" diff --git a/src/bench_sign.c b/src/bench_sign.c index 933f367c4b6a6..f659c18c92d0b 100644 --- a/src/bench_sign.c +++ b/src/bench_sign.c @@ -4,7 +4,7 @@ * file COPYING or https://www.opensource.org/licenses/mit-license.php.* ***********************************************************************/ -#include "include/secp256k1.h" +#include "../include/secp256k1.h" #include "util.h" #include "bench.h" diff --git a/src/bench_verify.c b/src/bench_verify.c index c56aefd3699c0..565ae4beec8a5 100644 --- a/src/bench_verify.c +++ b/src/bench_verify.c @@ -7,7 +7,7 @@ #include #include -#include "include/secp256k1.h" +#include "../include/secp256k1.h" #include "util.h" #include "bench.h" diff --git a/src/gen_context.c b/src/gen_context.c index 0fb361fb92618..8fab7aa49d80c 100644 --- a/src/gen_context.c +++ b/src/gen_context.c @@ -18,7 +18,7 @@ need to build the external ASM for the build and the host machine. */ #undef USE_EXTERNAL_ASM -#include "include/secp256k1.h" +#include "../include/secp256k1.h" #include "assumptions.h" #include "util.h" #include "field_impl.h" diff --git a/src/modules/ecdh/main_impl.h b/src/modules/ecdh/main_impl.h index 1ac67086becca..5408c9de70710 100644 --- a/src/modules/ecdh/main_impl.h +++ b/src/modules/ecdh/main_impl.h @@ -7,8 +7,8 @@ #ifndef SECP256K1_MODULE_ECDH_MAIN_H #define SECP256K1_MODULE_ECDH_MAIN_H -#include "include/secp256k1_ecdh.h" -#include "ecmult_const_impl.h" +#include "../../../include/secp256k1_ecdh.h" +#include "../../ecmult_const_impl.h" static int ecdh_hash_function_sha256(unsigned char *output, const unsigned char *x32, const unsigned char *y32, void *data) { unsigned char version = (y32[31] & 0x01) | 0x02; diff --git a/src/modules/extrakeys/main_impl.h b/src/modules/extrakeys/main_impl.h index 7390b227182fe..ac3932e4ad50c 100644 --- a/src/modules/extrakeys/main_impl.h +++ b/src/modules/extrakeys/main_impl.h @@ -7,8 +7,8 @@ #ifndef SECP256K1_MODULE_EXTRAKEYS_MAIN_H #define SECP256K1_MODULE_EXTRAKEYS_MAIN_H -#include "include/secp256k1.h" -#include "include/secp256k1_extrakeys.h" +#include "../../../include/secp256k1.h" +#include "../../../include/secp256k1_extrakeys.h" static SECP256K1_INLINE int secp256k1_xonly_pubkey_load(const secp256k1_context* ctx, secp256k1_ge *ge, const secp256k1_xonly_pubkey *pubkey) { return secp256k1_pubkey_load(ctx, ge, (const secp256k1_pubkey *) pubkey); diff --git a/src/modules/extrakeys/tests_exhaustive_impl.h b/src/modules/extrakeys/tests_exhaustive_impl.h index 0aca4fb72d781..d4a2f5bdf4050 100644 --- a/src/modules/extrakeys/tests_exhaustive_impl.h +++ b/src/modules/extrakeys/tests_exhaustive_impl.h @@ -8,7 +8,7 @@ #define SECP256K1_MODULE_EXTRAKEYS_TESTS_EXHAUSTIVE_H #include "src/modules/extrakeys/main_impl.h" -#include "include/secp256k1_extrakeys.h" +#include "../../../include/secp256k1_extrakeys.h" static void test_exhaustive_extrakeys(const secp256k1_context *ctx, const secp256k1_ge* group) { secp256k1_keypair keypair[EXHAUSTIVE_TEST_ORDER - 1]; diff --git a/src/modules/extrakeys/tests_impl.h b/src/modules/extrakeys/tests_impl.h index 9473a7dd4852e..fcc16300bb81b 100644 --- a/src/modules/extrakeys/tests_impl.h +++ b/src/modules/extrakeys/tests_impl.h @@ -7,7 +7,7 @@ #ifndef SECP256K1_MODULE_EXTRAKEYS_TESTS_H #define SECP256K1_MODULE_EXTRAKEYS_TESTS_H -#include "secp256k1_extrakeys.h" +#include "../../../include/secp256k1_extrakeys.h" static secp256k1_context* api_test_context(int flags, int *ecount) { secp256k1_context *ctx0 = secp256k1_context_create(flags); diff --git a/src/modules/recovery/main_impl.h b/src/modules/recovery/main_impl.h index 7a440a729bf96..9e19f2a2dc9c8 100644 --- a/src/modules/recovery/main_impl.h +++ b/src/modules/recovery/main_impl.h @@ -7,7 +7,7 @@ #ifndef SECP256K1_MODULE_RECOVERY_MAIN_H #define SECP256K1_MODULE_RECOVERY_MAIN_H -#include "include/secp256k1_recovery.h" +#include "../../../include/secp256k1_recovery.h" static void secp256k1_ecdsa_recoverable_signature_load(const secp256k1_context* ctx, secp256k1_scalar* r, secp256k1_scalar* s, int* recid, const secp256k1_ecdsa_recoverable_signature* sig) { (void)ctx; diff --git a/src/modules/recovery/tests_exhaustive_impl.h b/src/modules/recovery/tests_exhaustive_impl.h index 0ba9409c691d0..590a972ed3f74 100644 --- a/src/modules/recovery/tests_exhaustive_impl.h +++ b/src/modules/recovery/tests_exhaustive_impl.h @@ -8,7 +8,7 @@ #define SECP256K1_MODULE_RECOVERY_EXHAUSTIVE_TESTS_H #include "src/modules/recovery/main_impl.h" -#include "include/secp256k1_recovery.h" +#include "../../../include/secp256k1_recovery.h" void test_exhaustive_recovery_sign(const secp256k1_context *ctx, const secp256k1_ge *group) { int i, j, k; diff --git a/src/modules/schnorrsig/main_impl.h b/src/modules/schnorrsig/main_impl.h index 22e1b33a5a48e..af503bf5ebed1 100644 --- a/src/modules/schnorrsig/main_impl.h +++ b/src/modules/schnorrsig/main_impl.h @@ -7,9 +7,9 @@ #ifndef SECP256K1_MODULE_SCHNORRSIG_MAIN_H #define SECP256K1_MODULE_SCHNORRSIG_MAIN_H -#include "include/secp256k1.h" -#include "include/secp256k1_schnorrsig.h" -#include "hash.h" +#include "../../../include/secp256k1.h" +#include "../../../include/secp256k1_schnorrsig.h" +#include "../../hash.h" /* Initializes SHA256 with fixed midstate. This midstate was computed by applying * SHA256 to SHA256("BIP0340/nonce")||SHA256("BIP0340/nonce"). */ diff --git a/src/modules/schnorrsig/tests_exhaustive_impl.h b/src/modules/schnorrsig/tests_exhaustive_impl.h index b4a428729f9a0..affabd23a67e7 100644 --- a/src/modules/schnorrsig/tests_exhaustive_impl.h +++ b/src/modules/schnorrsig/tests_exhaustive_impl.h @@ -7,7 +7,7 @@ #ifndef SECP256K1_MODULE_SCHNORRSIG_TESTS_EXHAUSTIVE_H #define SECP256K1_MODULE_SCHNORRSIG_TESTS_EXHAUSTIVE_H -#include "include/secp256k1_schnorrsig.h" +#include "../../../include/secp256k1_schnorrsig.h" #include "src/modules/schnorrsig/main_impl.h" static const unsigned char invalid_pubkey_bytes[][32] = { diff --git a/src/modules/schnorrsig/tests_impl.h b/src/modules/schnorrsig/tests_impl.h index 6f960cf6a86ae..f4fa5b4d846db 100644 --- a/src/modules/schnorrsig/tests_impl.h +++ b/src/modules/schnorrsig/tests_impl.h @@ -7,7 +7,7 @@ #ifndef SECP256K1_MODULE_SCHNORRSIG_TESTS_H #define SECP256K1_MODULE_SCHNORRSIG_TESTS_H -#include "secp256k1_schnorrsig.h" +#include "../../../include/secp256k1_schnorrsig.h" /* Checks that a bit flip in the n_flip-th argument (that has n_bytes many * bytes) changes the hash function diff --git a/src/secp256k1.c b/src/secp256k1.c index 8d2d08722fa3d..dddd1c90388f2 100644 --- a/src/secp256k1.c +++ b/src/secp256k1.c @@ -6,8 +6,8 @@ #define SECP256K1_BUILD -#include "include/secp256k1.h" -#include "include/secp256k1_preallocated.h" +#include "../include/secp256k1.h" +#include "../include/secp256k1_preallocated.h" #include "assumptions.h" #include "util.h" diff --git a/src/tests.c b/src/tests.c index a146394305cb6..ee34d9b3af8a6 100644 --- a/src/tests.c +++ b/src/tests.c @@ -15,8 +15,8 @@ #include #include "secp256k1.c" -#include "include/secp256k1.h" -#include "include/secp256k1_preallocated.h" +#include "../include/secp256k1.h" +#include "../include/secp256k1_preallocated.h" #include "testrand_impl.h" #include "util.h" @@ -30,8 +30,8 @@ void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps) # endif #endif -#include "contrib/lax_der_parsing.c" -#include "contrib/lax_der_privatekey_parsing.c" +#include "../contrib/lax_der_parsing.c" +#include "../contrib/lax_der_privatekey_parsing.c" #include "modinv32_impl.h" #ifdef SECP256K1_WIDEMUL_INT128 diff --git a/src/tests_exhaustive.c b/src/tests_exhaustive.c index a8074d44fc2e5..b7c7828995f2e 100644 --- a/src/tests_exhaustive.c +++ b/src/tests_exhaustive.c @@ -10,7 +10,6 @@ #include #include - #include #undef USE_ECMULT_STATIC_PRECOMPUTATION @@ -21,7 +20,7 @@ #endif #include "secp256k1.c" -#include "include/secp256k1.h" +#include "../include/secp256k1.h" #include "assumptions.h" #include "group.h" #include "testrand_impl.h" diff --git a/src/valgrind_ctime_test.c b/src/valgrind_ctime_test.c index cfca5a196e0ca..4ac0f011bd3ad 100644 --- a/src/valgrind_ctime_test.c +++ b/src/valgrind_ctime_test.c @@ -7,24 +7,24 @@ #include #include -#include "include/secp256k1.h" +#include "../include/secp256k1.h" #include "assumptions.h" #include "util.h" #ifdef ENABLE_MODULE_ECDH -# include "include/secp256k1_ecdh.h" +# include "../include/secp256k1_ecdh.h" #endif #ifdef ENABLE_MODULE_RECOVERY -# include "include/secp256k1_recovery.h" +# include "../include/secp256k1_recovery.h" #endif #ifdef ENABLE_MODULE_EXTRAKEYS -# include "include/secp256k1_extrakeys.h" +# include "../include/secp256k1_extrakeys.h" #endif #ifdef ENABLE_MODULE_SCHNORRSIG -#include "include/secp256k1_schnorrsig.h" +#include "../include/secp256k1_schnorrsig.h" #endif void run_tests(secp256k1_context *ctx, unsigned char *key);