diff --git a/3rdparty/everest/library/Hacl_Curve25519_joined.c b/3rdparty/everest/library/Hacl_Curve25519_joined.c index 18b32d200..ee62be1ce 100644 --- a/3rdparty/everest/library/Hacl_Curve25519_joined.c +++ b/3rdparty/everest/library/Hacl_Curve25519_joined.c @@ -19,11 +19,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED) diff --git a/3rdparty/everest/library/everest.c b/3rdparty/everest/library/everest.c index 2e2422f3e..82c4e03ad 100644 --- a/3rdparty/everest/library/everest.c +++ b/3rdparty/everest/library/everest.c @@ -19,11 +19,7 @@ * This file is part of Mbed TLS (https://tls.mbed.org). */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #include diff --git a/3rdparty/everest/library/x25519.c b/3rdparty/everest/library/x25519.c index 990bb4d6d..9faa9ab7d 100644 --- a/3rdparty/everest/library/x25519.c +++ b/3rdparty/everest/library/x25519.c @@ -19,11 +19,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_ECDH_C) && defined(MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED) diff --git a/ChangeLog.d/cmake-install.txt b/ChangeLog.d/cmake-install.txt new file mode 100644 index 000000000..1bcec4aa9 --- /dev/null +++ b/ChangeLog.d/cmake-install.txt @@ -0,0 +1,3 @@ +Bugfix + * Library files installed after a CMake build no longer have execute + permission. diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index 698c81982..1bdc59ec1 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -148,10 +148,14 @@ if (NOT USE_STATIC_MBEDTLS_LIBRARY AND NOT USE_SHARED_MBEDTLS_LIBRARY) message(FATAL_ERROR "Need to choose static or shared mbedtls build!") endif(NOT USE_STATIC_MBEDTLS_LIBRARY AND NOT USE_SHARED_MBEDTLS_LIBRARY) +set(target_libraries "mbedcrypto" "mbedx509" "mbedtls") + if(USE_STATIC_MBEDTLS_LIBRARY AND USE_SHARED_MBEDTLS_LIBRARY) set(mbedtls_static_target "mbedtls_static") set(mbedx509_static_target "mbedx509_static") set(mbedcrypto_static_target "mbedcrypto_static") + list(APPEND target_libraries + "mbedcrypto_static" "mbedx509_static" "mbedtls_static") elseif(USE_STATIC_MBEDTLS_LIBRARY) set(mbedtls_static_target "mbedtls") set(mbedx509_static_target "mbedx509") @@ -162,59 +166,48 @@ if(USE_STATIC_MBEDTLS_LIBRARY) add_library(${mbedcrypto_static_target} STATIC ${src_crypto}) set_target_properties(${mbedcrypto_static_target} PROPERTIES OUTPUT_NAME mbedcrypto) target_link_libraries(${mbedcrypto_static_target} ${libs}) - target_include_directories(${mbedcrypto_static_target} - PUBLIC ${MBEDTLS_DIR}/include/ - PUBLIC ${thirdparty_inc_public} - PRIVATE ${thirdparty_inc}) - target_compile_definitions(${mbedcrypto_static_target} - PRIVATE ${thirdparty_def}) add_library(${mbedx509_static_target} STATIC ${src_x509}) set_target_properties(${mbedx509_static_target} PROPERTIES OUTPUT_NAME mbedx509) target_link_libraries(${mbedx509_static_target} ${libs} ${mbedcrypto_static_target}) - target_include_directories(${mbedx509_static_target} - PUBLIC ${MBEDTLS_DIR}/include/) add_library(${mbedtls_static_target} STATIC ${src_tls}) set_target_properties(${mbedtls_static_target} PROPERTIES OUTPUT_NAME mbedtls) target_link_libraries(${mbedtls_static_target} ${libs} ${mbedx509_static_target}) - target_include_directories(${mbedtls_static_target} - PUBLIC ${MBEDTLS_DIR}/include/) - - install(TARGETS ${mbedtls_static_target} ${mbedx509_static_target} ${mbedcrypto_static_target} - DESTINATION ${LIB_INSTALL_DIR} - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) endif(USE_STATIC_MBEDTLS_LIBRARY) if(USE_SHARED_MBEDTLS_LIBRARY) - add_library(mbedcrypto SHARED ${src_crypto}) set_target_properties(mbedcrypto PROPERTIES VERSION 2.23.0 SOVERSION 5) target_link_libraries(mbedcrypto ${libs}) - target_include_directories(mbedcrypto - PUBLIC ${MBEDTLS_DIR}/include/ - PUBLIC ${thirdparty_inc_public} - PRIVATE ${thirdparty_inc}) - target_compile_definitions(mbedcrypto - PRIVATE ${thirdparty_def}) add_library(mbedx509 SHARED ${src_x509}) set_target_properties(mbedx509 PROPERTIES VERSION 2.23.0 SOVERSION 1) target_link_libraries(mbedx509 ${libs} mbedcrypto) - target_include_directories(mbedx509 - PUBLIC ${MBEDTLS_DIR}/include/) add_library(mbedtls SHARED ${src_tls}) set_target_properties(mbedtls PROPERTIES VERSION 2.23.0 SOVERSION 13) target_link_libraries(mbedtls ${libs} mbedx509) - target_include_directories(mbedtls - PUBLIC ${MBEDTLS_DIR}/include/) - - install(TARGETS mbedtls mbedx509 mbedcrypto - DESTINATION ${LIB_INSTALL_DIR} - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) endif(USE_SHARED_MBEDTLS_LIBRARY) +foreach(target IN LISTS target_libraries) + # Include public header files from /include and other directories + # declared by /3rdparty/**/CMakeLists.txt. Include private header files + # from /library and others declared by /3rdparty/**/CMakeLists.txt. + # /library needs to be listed explicitly when building .c files outside + # of /library (which currently means: under /3rdparty). + target_include_directories(${target} + PUBLIC ${MBEDTLS_DIR}/include/ + PUBLIC ${thirdparty_inc_public} + PRIVATE ${MBEDTLS_DIR}/library/ + PRIVATE ${thirdparty_inc}) + target_compile_definitions(${target} + PRIVATE ${thirdparty_def}) + install(TARGETS ${target} + DESTINATION ${LIB_INSTALL_DIR} + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +endforeach(target) + add_custom_target(lib DEPENDS mbedcrypto mbedx509 mbedtls) if(USE_STATIC_MBEDTLS_LIBRARY AND USE_SHARED_MBEDTLS_LIBRARY) add_dependencies(lib mbedcrypto_static mbedx509_static mbedtls_static) diff --git a/library/Makefile b/library/Makefile index 87ea56d37..b76a84bdd 100644 --- a/library/Makefile +++ b/library/Makefile @@ -5,7 +5,11 @@ CFLAGS ?= -O2 WARNING_CFLAGS ?= -Wall -Wextra LDFLAGS ?= -LOCAL_CFLAGS = $(WARNING_CFLAGS) -I../include -D_FILE_OFFSET_BITS=64 +# Include ../include for public headers and . for private headers. +# Note that . needs to be included explicitly for the sake of library +# files that are not in the /library directory (which currently means +# under /3rdparty). +LOCAL_CFLAGS = $(WARNING_CFLAGS) -I. -I../include -D_FILE_OFFSET_BITS=64 LOCAL_LDFLAGS = ifdef DEBUG diff --git a/library/aes.c b/library/aes.c index 962b0b92a..80e8134ba 100644 --- a/library/aes.c +++ b/library/aes.c @@ -25,11 +25,7 @@ * http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_AES_C) diff --git a/library/aesni.c b/library/aesni.c index 062708b04..e0d8a69ec 100644 --- a/library/aesni.c +++ b/library/aesni.c @@ -24,11 +24,7 @@ * [CLMUL-WP] http://software.intel.com/en-us/articles/intel-carry-less-multiplication-instruction-and-its-usage-for-computing-the-gcm-mode/ */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_AESNI_C) diff --git a/library/arc4.c b/library/arc4.c index b8998ac6c..2109bb2c0 100644 --- a/library/arc4.c +++ b/library/arc4.c @@ -24,11 +24,7 @@ * http://groups.google.com/group/sci.crypt/msg/10a300c9d21afca0 */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_ARC4_C) diff --git a/library/aria.c b/library/aria.c index aff66d667..107be27cf 100644 --- a/library/aria.c +++ b/library/aria.c @@ -25,11 +25,7 @@ * [2] https://tools.ietf.org/html/rfc5794 */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_ARIA_C) diff --git a/library/asn1parse.c b/library/asn1parse.c index 34c660775..fe62bc683 100644 --- a/library/asn1parse.c +++ b/library/asn1parse.c @@ -19,11 +19,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_ASN1_PARSE_C) diff --git a/library/asn1write.c b/library/asn1write.c index 503db930b..3c411802e 100644 --- a/library/asn1write.c +++ b/library/asn1write.c @@ -19,11 +19,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_ASN1_WRITE_C) diff --git a/library/base64.c b/library/base64.c index f06b57b31..3921c4611 100644 --- a/library/base64.c +++ b/library/base64.c @@ -19,11 +19,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_BASE64_C) diff --git a/library/bignum.c b/library/bignum.c index d9ab6f68b..2ab71ca4e 100644 --- a/library/bignum.c +++ b/library/bignum.c @@ -35,11 +35,7 @@ * */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_BIGNUM_C) diff --git a/library/blowfish.c b/library/blowfish.c index cbf923824..7c9b1a65a 100644 --- a/library/blowfish.c +++ b/library/blowfish.c @@ -25,11 +25,7 @@ * */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_BLOWFISH_C) diff --git a/library/camellia.c b/library/camellia.c index 22262b89a..764e4f8a8 100644 --- a/library/camellia.c +++ b/library/camellia.c @@ -25,11 +25,7 @@ * http://info.isl.ntt.co.jp/crypt/eng/camellia/dl/01espec.pdf */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_CAMELLIA_C) diff --git a/library/ccm.c b/library/ccm.c index eaef106a1..25a627b0a 100644 --- a/library/ccm.c +++ b/library/ccm.c @@ -28,11 +28,7 @@ * RFC 5116 "An Interface and Algorithms for Authenticated Encryption" */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_CCM_C) diff --git a/library/certs.c b/library/certs.c index f152c283a..fa11d5c95 100644 --- a/library/certs.c +++ b/library/certs.c @@ -19,11 +19,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #include "mbedtls/certs.h" diff --git a/library/chacha20.c b/library/chacha20.c index 343b2167c..bda39b2ae 100644 --- a/library/chacha20.c +++ b/library/chacha20.c @@ -23,11 +23,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_CHACHA20_C) diff --git a/library/chachapoly.c b/library/chachapoly.c index f0af5ded2..d51227a55 100644 --- a/library/chachapoly.c +++ b/library/chachapoly.c @@ -20,11 +20,7 @@ * * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_CHACHAPOLY_C) diff --git a/library/cipher.c b/library/cipher.c index 409c3fe67..acbda26b7 100644 --- a/library/cipher.c +++ b/library/cipher.c @@ -23,11 +23,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_CIPHER_C) diff --git a/library/cipher_wrap.c b/library/cipher_wrap.c index a813426be..e5ee7ff63 100644 --- a/library/cipher_wrap.c +++ b/library/cipher_wrap.c @@ -23,11 +23,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_CIPHER_C) diff --git a/library/cmac.c b/library/cmac.c index 2d23be5ff..3a48a6204 100644 --- a/library/cmac.c +++ b/library/cmac.c @@ -40,11 +40,7 @@ * */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_CMAC_C) diff --git a/library/ctr_drbg.c b/library/ctr_drbg.c index 8a2920a32..7872e9b2d 100644 --- a/library/ctr_drbg.c +++ b/library/ctr_drbg.c @@ -24,11 +24,7 @@ * http://csrc.nist.gov/publications/nistpubs/800-90/SP800-90revised_March2007.pdf */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_CTR_DRBG_C) diff --git a/library/debug.c b/library/debug.c index 2b25e997c..6fb766b5f 100644 --- a/library/debug.c +++ b/library/debug.c @@ -19,11 +19,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_DEBUG_C) diff --git a/library/des.c b/library/des.c index 24e517ed9..e13521996 100644 --- a/library/des.c +++ b/library/des.c @@ -25,11 +25,7 @@ * http://csrc.nist.gov/publications/fips/fips46-3/fips46-3.pdf */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_DES_C) diff --git a/library/dhm.c b/library/dhm.c index 392ed0c15..387f5beda 100644 --- a/library/dhm.c +++ b/library/dhm.c @@ -27,11 +27,7 @@ * */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_DHM_C) diff --git a/library/ecdh.c b/library/ecdh.c index 3cf533371..987a6ceb3 100644 --- a/library/ecdh.c +++ b/library/ecdh.c @@ -26,11 +26,7 @@ * RFC 4492 */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_ECDH_C) diff --git a/library/ecdsa.c b/library/ecdsa.c index 5acd2d00e..3183a902e 100644 --- a/library/ecdsa.c +++ b/library/ecdsa.c @@ -25,11 +25,7 @@ * SEC1 http://www.secg.org/index.php?action=secg,docs_secg */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_ECDSA_C) diff --git a/library/ecjpake.c b/library/ecjpake.c index 79ea3cbec..a60785168 100644 --- a/library/ecjpake.c +++ b/library/ecjpake.c @@ -24,11 +24,7 @@ * available to members of the Thread Group http://threadgroup.org/ */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_ECJPAKE_C) diff --git a/library/ecp.c b/library/ecp.c index 7b205160a..c642037ca 100644 --- a/library/ecp.c +++ b/library/ecp.c @@ -41,11 +41,7 @@ * */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" /** * \brief Function level alternative implementation. diff --git a/library/ecp_curves.c b/library/ecp_curves.c index a24a50c03..92bbb896a 100644 --- a/library/ecp_curves.c +++ b/library/ecp_curves.c @@ -19,11 +19,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_ECP_C) diff --git a/library/entropy.c b/library/entropy.c index 102f9f1c4..4d4d6cebf 100644 --- a/library/entropy.c +++ b/library/entropy.c @@ -19,11 +19,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_ENTROPY_C) diff --git a/library/entropy_poll.c b/library/entropy_poll.c index dc621836e..62fb4afbf 100644 --- a/library/entropy_poll.c +++ b/library/entropy_poll.c @@ -24,11 +24,7 @@ #define _GNU_SOURCE #endif -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #include diff --git a/library/error.c b/library/error.c index 57171b311..68e1f171b 100644 --- a/library/error.c +++ b/library/error.c @@ -19,11 +19,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_ERROR_STRERROR_DUMMY) #include diff --git a/library/gcm.c b/library/gcm.c index e34f1dae4..eae9eed77 100644 --- a/library/gcm.c +++ b/library/gcm.c @@ -29,11 +29,7 @@ * [MGV] 4.1, pp. 12-13, to enhance speed without using too much memory. */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_GCM_C) diff --git a/library/havege.c b/library/havege.c index ca7dd17fb..75e0e84f7 100644 --- a/library/havege.c +++ b/library/havege.c @@ -26,11 +26,7 @@ * Contact: seznec(at)irisa_dot_fr - orocheco(at)irisa_dot_fr */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_HAVEGE_C) diff --git a/library/hkdf.c b/library/hkdf.c index 82df597a4..0e9da59a9 100644 --- a/library/hkdf.c +++ b/library/hkdf.c @@ -18,11 +18,7 @@ * * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_HKDF_C) diff --git a/library/hmac_drbg.c b/library/hmac_drbg.c index f811885c9..b25b6838f 100644 --- a/library/hmac_drbg.c +++ b/library/hmac_drbg.c @@ -25,11 +25,7 @@ * References below are based on rev. 1 (January 2012). */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_HMAC_DRBG_C) diff --git a/library/md.c b/library/md.c index 30a580b02..3eb0fe389 100644 --- a/library/md.c +++ b/library/md.c @@ -23,11 +23,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_MD_C) diff --git a/library/md2.c b/library/md2.c index 82aed8e73..afc6539e0 100644 --- a/library/md2.c +++ b/library/md2.c @@ -25,11 +25,7 @@ * http://www.ietf.org/rfc/rfc1319.txt */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_MD2_C) diff --git a/library/md4.c b/library/md4.c index 6a658e31d..beb42c954 100644 --- a/library/md4.c +++ b/library/md4.c @@ -25,11 +25,7 @@ * http://www.ietf.org/rfc/rfc1320.txt */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_MD4_C) diff --git a/library/md5.c b/library/md5.c index 2306855f4..c7b85d124 100644 --- a/library/md5.c +++ b/library/md5.c @@ -24,11 +24,7 @@ * http://www.ietf.org/rfc/rfc1321.txt */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_MD5_C) diff --git a/library/memory_buffer_alloc.c b/library/memory_buffer_alloc.c index 51ea7c41d..07bcce0db 100644 --- a/library/memory_buffer_alloc.c +++ b/library/memory_buffer_alloc.c @@ -19,11 +19,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) #include "mbedtls/memory_buffer_alloc.h" diff --git a/library/net_sockets.c b/library/net_sockets.c index b26e85818..3c6d29351 100644 --- a/library/net_sockets.c +++ b/library/net_sockets.c @@ -25,11 +25,7 @@ #define _POSIX_C_SOURCE 200112L #define _XOPEN_SOURCE 600 /* sockaddr_storage */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_NET_C) diff --git a/library/nist_kw.c b/library/nist_kw.c index 03e807202..f6ee486e7 100644 --- a/library/nist_kw.c +++ b/library/nist_kw.c @@ -29,11 +29,7 @@ * the wrapping and unwrapping operation than the definition in NIST SP 800-38F. */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_NIST_KW_C) diff --git a/library/oid.c b/library/oid.c index e0c074369..29ced43d3 100644 --- a/library/oid.c +++ b/library/oid.c @@ -21,11 +21,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_OID_C) diff --git a/library/padlock.c b/library/padlock.c index b85ff9cd2..887a386e8 100644 --- a/library/padlock.c +++ b/library/padlock.c @@ -25,11 +25,7 @@ * programming_guide.pdf */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_PADLOCK_C) diff --git a/library/pem.c b/library/pem.c index 31f4a9a25..544f7c41b 100644 --- a/library/pem.c +++ b/library/pem.c @@ -19,11 +19,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_PEM_PARSE_C) || defined(MBEDTLS_PEM_WRITE_C) diff --git a/library/pk.c b/library/pk.c index b83ba8e71..5858a4e82 100644 --- a/library/pk.c +++ b/library/pk.c @@ -19,11 +19,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_PK_C) #include "mbedtls/pk.h" diff --git a/library/pk_wrap.c b/library/pk_wrap.c index f73643149..46fd02c76 100644 --- a/library/pk_wrap.c +++ b/library/pk_wrap.c @@ -19,11 +19,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_PK_C) #include "mbedtls/pk_internal.h" diff --git a/library/pkcs12.c b/library/pkcs12.c index 96c64ad63..b26f5669f 100644 --- a/library/pkcs12.c +++ b/library/pkcs12.c @@ -25,11 +25,7 @@ * ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-12/pkcs-12v1-1.asn */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_PKCS12_C) diff --git a/library/pkcs5.c b/library/pkcs5.c index 883232225..fc5224883 100644 --- a/library/pkcs5.c +++ b/library/pkcs5.c @@ -29,11 +29,7 @@ * http://tools.ietf.org/html/rfc6070 (Test vectors) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_PKCS5_C) diff --git a/library/pkparse.c b/library/pkparse.c index 1cbb8cc33..03d597293 100644 --- a/library/pkparse.c +++ b/library/pkparse.c @@ -19,11 +19,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_PK_PARSE_C) diff --git a/library/pkwrite.c b/library/pkwrite.c index b1b5f4685..7ec84f3e8 100644 --- a/library/pkwrite.c +++ b/library/pkwrite.c @@ -19,11 +19,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_PK_WRITE_C) diff --git a/library/platform.c b/library/platform.c index 420d09ea1..cd0e85bbe 100644 --- a/library/platform.c +++ b/library/platform.c @@ -19,11 +19,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_PLATFORM_C) diff --git a/library/platform_util.c b/library/platform_util.c index b1f745097..f6882e2c0 100644 --- a/library/platform_util.c +++ b/library/platform_util.c @@ -28,11 +28,7 @@ #define _POSIX_C_SOURCE 200112L #endif -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #include "mbedtls/platform_util.h" #include "mbedtls/platform.h" diff --git a/library/poly1305.c b/library/poly1305.c index bc1e8a649..069b82d95 100644 --- a/library/poly1305.c +++ b/library/poly1305.c @@ -20,11 +20,7 @@ * * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_POLY1305_C) diff --git a/library/psa_crypto.c b/library/psa_crypto.c index 8cd80790a..4c3966ca7 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -20,11 +20,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_PSA_CRYPTO_C) diff --git a/library/psa_crypto_se.c b/library/psa_crypto_se.c index 53a260007..61e6c98d2 100644 --- a/library/psa_crypto_se.c +++ b/library/psa_crypto_se.c @@ -20,11 +20,7 @@ * This file is part of Mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_PSA_CRYPTO_SE_C) diff --git a/library/psa_crypto_slot_management.c b/library/psa_crypto_slot_management.c index 801caf0a2..5ceac846a 100644 --- a/library/psa_crypto_slot_management.c +++ b/library/psa_crypto_slot_management.c @@ -20,11 +20,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_PSA_CRYPTO_C) diff --git a/library/ripemd160.c b/library/ripemd160.c index a62f4b824..a2ad32c2f 100644 --- a/library/ripemd160.c +++ b/library/ripemd160.c @@ -25,11 +25,7 @@ * http://ehash.iaik.tugraz.at/wiki/RIPEMD-160 */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_RIPEMD160_C) diff --git a/library/rsa.c b/library/rsa.c index 6c457468e..83ed3c937 100644 --- a/library/rsa.c +++ b/library/rsa.c @@ -37,11 +37,7 @@ * */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_RSA_C) diff --git a/library/rsa_internal.c b/library/rsa_internal.c index 9a42d47ce..b4098f494 100644 --- a/library/rsa_internal.c +++ b/library/rsa_internal.c @@ -20,11 +20,7 @@ * */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_RSA_C) diff --git a/library/sha1.c b/library/sha1.c index 923394341..79bac6b24 100644 --- a/library/sha1.c +++ b/library/sha1.c @@ -24,11 +24,7 @@ * http://www.itl.nist.gov/fipspubs/fip180-1.htm */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_SHA1_C) diff --git a/library/sha256.c b/library/sha256.c index 087a8e349..d8ddda5be 100644 --- a/library/sha256.c +++ b/library/sha256.c @@ -24,11 +24,7 @@ * http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_SHA256_C) diff --git a/library/sha512.c b/library/sha512.c index 30dd71954..37fc96d05 100644 --- a/library/sha512.c +++ b/library/sha512.c @@ -24,11 +24,7 @@ * http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_SHA512_C) diff --git a/library/ssl_cache.c b/library/ssl_cache.c index 62a0a2987..3a2df0cc5 100644 --- a/library/ssl_cache.c +++ b/library/ssl_cache.c @@ -23,11 +23,7 @@ * to store and retrieve the session information. */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_SSL_CACHE_C) diff --git a/library/ssl_ciphersuites.c b/library/ssl_ciphersuites.c index 5da129412..726912e4b 100644 --- a/library/ssl_ciphersuites.c +++ b/library/ssl_ciphersuites.c @@ -21,11 +21,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_SSL_TLS_C) diff --git a/library/ssl_cli.c b/library/ssl_cli.c index 48ef30de2..361e6e6d2 100644 --- a/library/ssl_cli.c +++ b/library/ssl_cli.c @@ -19,11 +19,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_SSL_CLI_C) diff --git a/library/ssl_cookie.c b/library/ssl_cookie.c index 323784c26..151f0c50e 100644 --- a/library/ssl_cookie.c +++ b/library/ssl_cookie.c @@ -23,11 +23,7 @@ * to store and retrieve the session information. */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_SSL_COOKIE_C) diff --git a/library/ssl_msg.c b/library/ssl_msg.c index 7fc4bf01d..d32afac56 100644 --- a/library/ssl_msg.c +++ b/library/ssl_msg.c @@ -28,11 +28,7 @@ * http://www.ietf.org/rfc/rfc4346.txt */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_SSL_TLS_C) diff --git a/library/ssl_srv.c b/library/ssl_srv.c index 9bfda164a..91bd83aa2 100644 --- a/library/ssl_srv.c +++ b/library/ssl_srv.c @@ -19,11 +19,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_SSL_SRV_C) diff --git a/library/ssl_ticket.c b/library/ssl_ticket.c index 6b50b55ec..bfa254607 100644 --- a/library/ssl_ticket.c +++ b/library/ssl_ticket.c @@ -19,11 +19,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_SSL_TICKET_C) diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 250ef9835..834c632a1 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -27,11 +27,7 @@ * http://www.ietf.org/rfc/rfc4346.txt */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_SSL_TLS_C) diff --git a/library/threading.c b/library/threading.c index 7c90c7c59..cb9026d1f 100644 --- a/library/threading.c +++ b/library/threading.c @@ -27,11 +27,7 @@ #define _POSIX_C_SOURCE 200112L #endif -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_THREADING_C) diff --git a/library/timing.c b/library/timing.c index 4a654222a..90cfe88ed 100644 --- a/library/timing.c +++ b/library/timing.c @@ -19,11 +19,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_SELF_TEST) && defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" diff --git a/library/version.c b/library/version.c index fd9675088..1e17482e0 100644 --- a/library/version.c +++ b/library/version.c @@ -19,11 +19,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_VERSION_C) diff --git a/library/version_features.c b/library/version_features.c index 16a0cd0e8..64e9e86db 100644 --- a/library/version_features.c +++ b/library/version_features.c @@ -19,11 +19,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_VERSION_C) diff --git a/library/x509.c b/library/x509.c index e969b8da6..55afbab83 100644 --- a/library/x509.c +++ b/library/x509.c @@ -29,11 +29,7 @@ * http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_X509_USE_C) diff --git a/library/x509_create.c b/library/x509_create.c index 7df2f0ed5..8d5877535 100644 --- a/library/x509_create.c +++ b/library/x509_create.c @@ -19,11 +19,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_X509_CREATE_C) diff --git a/library/x509_crl.c b/library/x509_crl.c index 371c446be..d89faccad 100644 --- a/library/x509_crl.c +++ b/library/x509_crl.c @@ -29,11 +29,7 @@ * http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_X509_CRL_PARSE_C) diff --git a/library/x509_crt.c b/library/x509_crt.c index 04822e8ab..8fd8b865d 100644 --- a/library/x509_crt.c +++ b/library/x509_crt.c @@ -31,11 +31,7 @@ * [SIRO] https://cabforum.org/wp-content/uploads/Chunghwatelecom201503cabforumV4.pdf */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_X509_CRT_PARSE_C) diff --git a/library/x509_csr.c b/library/x509_csr.c index 7e2cfba2a..8385e50c4 100644 --- a/library/x509_csr.c +++ b/library/x509_csr.c @@ -29,11 +29,7 @@ * http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_X509_CSR_PARSE_C) diff --git a/library/x509write_crt.c b/library/x509write_crt.c index 5947e439d..2baff35e1 100644 --- a/library/x509write_crt.c +++ b/library/x509write_crt.c @@ -25,11 +25,7 @@ * - attributes: PKCS#9 v2.0 aka RFC 2985 */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_X509_CRT_WRITE_C) diff --git a/library/x509write_csr.c b/library/x509write_csr.c index 7c5179862..7dd3d45c7 100644 --- a/library/x509write_csr.c +++ b/library/x509write_csr.c @@ -24,11 +24,7 @@ * - attributes: PKCS#9 v2.0 aka RFC 2985 */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_X509_CSR_WRITE_C) diff --git a/library/xtea.c b/library/xtea.c index a33707bc1..dab6cd3ee 100644 --- a/library/xtea.c +++ b/library/xtea.c @@ -19,11 +19,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_XTEA_C) diff --git a/scripts/data_files/error.fmt b/scripts/data_files/error.fmt index f65881bc8..ddd1be7a6 100644 --- a/scripts/data_files/error.fmt +++ b/scripts/data_files/error.fmt @@ -19,11 +19,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_ERROR_STRERROR_DUMMY) #include diff --git a/scripts/data_files/version_features.fmt b/scripts/data_files/version_features.fmt index 63ae94cb6..79d220ebc 100644 --- a/scripts/data_files/version_features.fmt +++ b/scripts/data_files/version_features.fmt @@ -19,11 +19,7 @@ * This file is part of mbed TLS (https://tls.mbed.org) */ -#if !defined(MBEDTLS_CONFIG_FILE) -#include "mbedtls/config.h" -#else -#include MBEDTLS_CONFIG_FILE -#endif +#include "common.h" #if defined(MBEDTLS_VERSION_C) diff --git a/scripts/generate_visualc_files.pl b/scripts/generate_visualc_files.pl index 8bf8de99e..a3a2925da 100755 --- a/scripts/generate_visualc_files.pl +++ b/scripts/generate_visualc_files.pl @@ -64,6 +64,15 @@ my @include_directories = qw( ); my $include_directories = join(';', map {"../../$_"} @include_directories); +# Directories to add to the include path when building the library, but not +# when building tests or applications. +my @library_include_directories = qw( + library +); +my $library_include_directories = + join(';', map {"../../$_"} (@library_include_directories, + @include_directories)); + my @excluded_files = qw( 3rdparty/everest/library/Hacl_Curve25519.c ); @@ -202,7 +211,7 @@ sub gen_main_file { my $out = slurp_file( $main_tpl ); $out =~ s/SOURCE_ENTRIES\r\n/$source_entries/m; $out =~ s/HEADER_ENTRIES\r\n/$header_entries/m; - $out =~ s/INCLUDE_DIRECTORIES\r\n/$include_directories/g; + $out =~ s/INCLUDE_DIRECTORIES\r\n/$library_include_directories/g; content_to_file( $out, $main_out ); } diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 8a74c6bfb..cc6866309 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -48,6 +48,10 @@ function(add_test_suite suite_name) add_executable(test_suite_${data_name} test_suite_${data_name}.c $) target_link_libraries(test_suite_${data_name} ${libs}) + # Include test-specific header files from ./include and private header + # files (used by some invasive tests) from ../library. Public header + # files are automatically included because the library targets declare + # them as PUBLIC. target_include_directories(test_suite_${data_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../library) diff --git a/tests/Makefile b/tests/Makefile index 80c84fa19..ffa4812bd 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -6,6 +6,9 @@ CFLAGS ?= -O2 WARNING_CFLAGS ?= -Wall -Wextra LDFLAGS ?= +# Include public header files from ../include, test-specific header files +# from ./include, and private header files (used by some invasive tests) +# from ../library. LOCAL_CFLAGS = $(WARNING_CFLAGS) -I./include -I../include -I../library -D_FILE_OFFSET_BITS=64 LOCAL_LDFLAGS = -L../library \ -lmbedtls$(SHARED_SUFFIX) \ diff --git a/visualc/VS2010/mbedTLS.vcxproj b/visualc/VS2010/mbedTLS.vcxproj index 98b99138f..4422b7a2d 100644 --- a/visualc/VS2010/mbedTLS.vcxproj +++ b/visualc/VS2010/mbedTLS.vcxproj @@ -84,7 +84,7 @@ Disabled _USRDLL;MBEDTLS_EXPORTS;KRML_VERIFIED_UINT128;%(PreprocessorDefinitions) -../../include;../../3rdparty/everest/include/;../../3rdparty/everest/include/everest;../../3rdparty/everest/include/everest/vs2010;../../3rdparty/everest/include/everest/kremlib;../../tests/include +../../library;../../include;../../3rdparty/everest/include/;../../3rdparty/everest/include/everest;../../3rdparty/everest/include/everest/vs2010;../../3rdparty/everest/include/everest/kremlib;../../tests/include CompileAsC @@ -98,7 +98,7 @@ Disabled _USRDLL;MBEDTLS_EXPORTS;KRML_VERIFIED_UINT128;%(PreprocessorDefinitions) -../../include;../../3rdparty/everest/include/;../../3rdparty/everest/include/everest;../../3rdparty/everest/include/everest/vs2010;../../3rdparty/everest/include/everest/kremlib;../../tests/include +../../library;../../include;../../3rdparty/everest/include/;../../3rdparty/everest/include/everest;../../3rdparty/everest/include/everest/vs2010;../../3rdparty/everest/include/everest/kremlib;../../tests/include CompileAsC @@ -114,7 +114,7 @@ true NDEBUG;_USRDLL;MBEDTLS_EXPORTS;KRML_VERIFIED_UINT128;%(PreprocessorDefinitions) -../../include;../../3rdparty/everest/include/;../../3rdparty/everest/include/everest;../../3rdparty/everest/include/everest/vs2010;../../3rdparty/everest/include/everest/kremlib;../../tests/include +../../library;../../include;../../3rdparty/everest/include/;../../3rdparty/everest/include/everest;../../3rdparty/everest/include/everest/vs2010;../../3rdparty/everest/include/everest/kremlib;../../tests/include Windows @@ -131,7 +131,7 @@ true WIN64;NDEBUG;_WINDOWS;_USRDLL;MBEDTLS_EXPORTS;KRML_VERIFIED_UINT128;%(PreprocessorDefinitions) -../../include;../../3rdparty/everest/include/;../../3rdparty/everest/include/everest;../../3rdparty/everest/include/everest/vs2010;../../3rdparty/everest/include/everest/kremlib;../../tests/include +../../library;../../include;../../3rdparty/everest/include/;../../3rdparty/everest/include/everest;../../3rdparty/everest/include/everest/vs2010;../../3rdparty/everest/include/everest/kremlib;../../tests/include Windows