From 945b23c46f5e462e476490e1bf24494c5495729b Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Thu, 15 Sep 2022 19:29:40 +0200 Subject: [PATCH] Include platform.h unconditionally: automatic part We used to include platform.h only when MBEDTLS_PLATFORM_C was enabled, and to define ad hoc replacements for mbedtls_xxx functions on a case-by-case basis when MBEDTLS_PLATFORM_C was disabled. The only reason for this complication was to allow building individual source modules without copying platform.h. This is not something we support or recommend anymore, so get rid of the complication: include platform.h unconditionally. There should be no change in behavior since just including the header should not change the behavior of a program. This commit replaces most occurrences of conditional inclusion of platform.h, using the following code: ``` perl -i -0777 -pe 's!#if.*\n#include "mbedtls/platform.h"\n(#else.*\n(#define (mbedtls|MBEDTLS)_.*\n|#include <(stdarg|stddef|stdio|stdlib|string|time)\.h>\n)*)?#endif.*!#include "mbedtls/platform.h"!mg' $(git grep -l '#include "mbedtls/platform.h"') ``` Signed-off-by: Gilles Peskine --- 3rdparty/everest/library/everest.c | 5 ----- library/aes.c | 5 ----- library/aria.c | 5 ----- library/asn1parse.c | 6 ------ library/asn1write.c | 6 ------ library/base64.c | 5 ----- library/bignum.c | 8 -------- library/bignum_core.c | 8 -------- library/bignum_mod.c | 8 -------- library/bignum_mod_raw.c | 8 -------- library/camellia.c | 5 ----- library/chacha20.c | 5 ----- library/chachapoly.c | 5 ----- library/cipher.c | 5 ----- library/cipher_wrap.c | 6 ------ library/ctr_drbg.c | 5 ----- library/debug.c | 9 --------- library/des.c | 5 ----- library/dhm.c | 8 -------- library/ecdsa.c | 6 ------ library/ecjpake.c | 5 ----- library/ecp.c | 8 -------- library/entropy.c | 7 ------- library/entropy_poll.c | 2 -- library/hmac_drbg.c | 5 ----- library/md.c | 6 ------ library/md5.c | 5 ----- library/mps_trace.h | 6 ------ library/net_sockets.c | 4 ---- library/nist_kw.c | 5 ----- library/oid.c | 4 ---- library/pem.c | 6 ------ library/pk_wrap.c | 6 ------ library/pkcs5.c | 5 ----- library/pkparse.c | 6 ------ library/pkwrite.c | 6 ------ library/poly1305.c | 5 ----- library/psa_crypto_slot_management.c | 5 ----- library/psa_crypto_storage.c | 6 ------ library/psa_its_file.c | 4 ---- library/ripemd160.c | 5 ----- library/rsa.c | 7 ------- library/sha1.c | 5 ----- library/sha256.c | 8 -------- library/sha512.c | 8 -------- library/ssl_cache.c | 6 ------ library/ssl_ciphersuites.c | 4 ---- library/ssl_client.c | 6 ------ library/ssl_cookie.c | 5 ----- library/ssl_msg.c | 6 ------ library/ssl_ticket.c | 6 ------ library/ssl_tls.c | 8 -------- library/ssl_tls12_client.c | 6 ------ library/ssl_tls12_server.c | 6 ------ library/ssl_tls13_server.c | 6 ------ library/x509.c | 9 --------- library/x509_crl.c | 8 -------- library/x509_crt.c | 8 -------- library/x509_csr.c | 8 -------- library/x509write_csr.c | 6 ------ programs/aes/crypt_and_hash.c | 10 ---------- programs/hash/generic_sum.c | 10 ---------- programs/hash/hello.c | 9 --------- programs/pkey/dh_client.c | 10 ---------- programs/pkey/dh_genprime.c | 10 ---------- programs/pkey/dh_server.c | 10 ---------- programs/pkey/ecdh_curve25519.c | 9 --------- programs/pkey/ecdsa.c | 9 --------- programs/pkey/gen_key.c | 9 --------- programs/pkey/key_app.c | 9 --------- programs/pkey/key_app_writer.c | 9 --------- programs/pkey/mpi_demo.c | 9 --------- programs/pkey/pk_decrypt.c | 9 --------- programs/pkey/pk_encrypt.c | 10 ---------- programs/pkey/pk_sign.c | 10 ---------- programs/pkey/pk_verify.c | 10 ---------- programs/pkey/rsa_decrypt.c | 9 --------- programs/pkey/rsa_encrypt.c | 10 ---------- programs/pkey/rsa_genkey.c | 9 --------- programs/pkey/rsa_sign.c | 11 ----------- programs/pkey/rsa_sign_pss.c | 10 ---------- programs/pkey/rsa_verify.c | 10 ---------- programs/pkey/rsa_verify_pss.c | 10 ---------- programs/random/gen_entropy.c | 10 ---------- programs/random/gen_random_ctr_drbg.c | 10 ---------- programs/ssl/dtls_client.c | 10 ---------- programs/ssl/dtls_server.c | 11 ----------- programs/ssl/mini_client.c | 9 --------- programs/ssl/ssl_client1.c | 12 ------------ programs/ssl/ssl_fork_server.c | 11 ----------- programs/ssl/ssl_mail_client.c | 12 ------------ programs/ssl/ssl_pthread_server.c | 11 ----------- programs/ssl/ssl_server.c | 12 ------------ programs/ssl/ssl_test_lib.h | 16 ---------------- programs/test/cmake_package/cmake_package.c | 10 ---------- .../cmake_package_install.c | 10 ---------- .../test/cmake_subproject/cmake_subproject.c | 10 ---------- programs/test/dlopen.c | 10 ---------- programs/test/query_compile_time_config.c | 7 ------- programs/test/selftest.c | 12 ------------ programs/test/zeroize.c | 8 -------- programs/util/pem2der.c | 11 ----------- programs/util/strerror.c | 7 ------- programs/x509/cert_app.c | 12 ------------ programs/x509/cert_req.c | 9 --------- programs/x509/cert_write.c | 9 --------- programs/x509/crl_app.c | 9 --------- programs/x509/load_roots.c | 12 ------------ programs/x509/req_app.c | 9 --------- scripts/data_files/error.fmt | 4 ---- scripts/data_files/query_config.fmt | 5 ----- tests/include/test/helpers.h | 13 ------------- tests/include/test/macros.h | 13 ------------- tests/suites/helpers.function | 13 ------------- 114 files changed, 898 deletions(-) diff --git a/3rdparty/everest/library/everest.c b/3rdparty/everest/library/everest.c index 82c4e03ad..fefc6a2ce 100644 --- a/3rdparty/everest/library/everest.c +++ b/3rdparty/everest/library/everest.c @@ -28,12 +28,7 @@ #include "everest/x25519.h" #include "everest/everest.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif #if defined(MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED) diff --git a/library/aes.c b/library/aes.c index ca94e0a16..872930f2a 100644 --- a/library/aes.c +++ b/library/aes.c @@ -41,12 +41,7 @@ #endif #if defined(MBEDTLS_SELF_TEST) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_printf printf -#endif /* MBEDTLS_PLATFORM_C */ #endif /* MBEDTLS_SELF_TEST */ #if !defined(MBEDTLS_AES_ALT) diff --git a/library/aria.c b/library/aria.c index bc05c4a31..cfa69c2ad 100644 --- a/library/aria.c +++ b/library/aria.c @@ -32,12 +32,7 @@ #include #if defined(MBEDTLS_SELF_TEST) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_printf printf -#endif /* MBEDTLS_PLATFORM_C */ #endif /* MBEDTLS_SELF_TEST */ #if !defined(MBEDTLS_ARIA_ALT) diff --git a/library/asn1parse.c b/library/asn1parse.c index 83c7c58a1..d874fff46 100644 --- a/library/asn1parse.c +++ b/library/asn1parse.c @@ -31,13 +31,7 @@ #include "mbedtls/bignum.h" #endif -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif /* * ASN.1 DER decoding routines diff --git a/library/asn1write.c b/library/asn1write.c index 053dbb669..f1adcb55f 100644 --- a/library/asn1write.c +++ b/library/asn1write.c @@ -26,13 +26,7 @@ #include -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif int mbedtls_asn1_write_len( unsigned char **p, const unsigned char *start, size_t len ) { diff --git a/library/base64.c b/library/base64.c index 83daa0bcc..9021a041b 100644 --- a/library/base64.c +++ b/library/base64.c @@ -28,12 +28,7 @@ #if defined(MBEDTLS_SELF_TEST) #include -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_printf printf -#endif /* MBEDTLS_PLATFORM_C */ #endif /* MBEDTLS_SELF_TEST */ #define BASE64_SIZE_T_MAX ( (size_t) -1 ) /* SIZE_T_MAX is not standard */ diff --git a/library/bignum.c b/library/bignum.c index acf620f9a..24b6abe63 100644 --- a/library/bignum.c +++ b/library/bignum.c @@ -48,15 +48,7 @@ #include #include -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif #define MPI_VALIDATE_RET( cond ) \ MBEDTLS_INTERNAL_VALIDATE_RET( cond, MBEDTLS_ERR_MPI_BAD_INPUT_DATA ) diff --git a/library/bignum_core.c b/library/bignum_core.c index 8e89766a7..4471a4db7 100644 --- a/library/bignum_core.c +++ b/library/bignum_core.c @@ -26,15 +26,7 @@ #include "mbedtls/error.h" #include "mbedtls/platform_util.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif #include "bignum_core.h" diff --git a/library/bignum_mod.c b/library/bignum_mod.c index de2809372..f2c11a582 100644 --- a/library/bignum_mod.c +++ b/library/bignum_mod.c @@ -27,15 +27,7 @@ #include "mbedtls/error.h" #include "mbedtls/bignum.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif #include "bignum_core.h" #include "bignum_mod.h" diff --git a/library/bignum_mod_raw.c b/library/bignum_mod_raw.c index 8c89b2cdf..e1c96d612 100644 --- a/library/bignum_mod_raw.c +++ b/library/bignum_mod_raw.c @@ -26,15 +26,7 @@ #include "mbedtls/error.h" #include "mbedtls/platform_util.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif #include "bignum_core.h" #include "bignum_mod_raw.h" diff --git a/library/camellia.c b/library/camellia.c index 29d730ab5..24651a9a8 100644 --- a/library/camellia.c +++ b/library/camellia.c @@ -33,12 +33,7 @@ #include #if defined(MBEDTLS_SELF_TEST) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_printf printf -#endif /* MBEDTLS_PLATFORM_C */ #endif /* MBEDTLS_SELF_TEST */ #if !defined(MBEDTLS_CAMELLIA_ALT) diff --git a/library/chacha20.c b/library/chacha20.c index 658f04690..f92e5074a 100644 --- a/library/chacha20.c +++ b/library/chacha20.c @@ -33,12 +33,7 @@ #include #if defined(MBEDTLS_SELF_TEST) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_printf printf -#endif /* MBEDTLS_PLATFORM_C */ #endif /* MBEDTLS_SELF_TEST */ #if !defined(MBEDTLS_CHACHA20_ALT) diff --git a/library/chachapoly.c b/library/chachapoly.c index dc75b2030..9ae043b3b 100644 --- a/library/chachapoly.c +++ b/library/chachapoly.c @@ -29,12 +29,7 @@ #include #if defined(MBEDTLS_SELF_TEST) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_printf printf -#endif /* MBEDTLS_PLATFORM_C */ #endif /* MBEDTLS_SELF_TEST */ #if !defined(MBEDTLS_CHACHAPOLY_ALT) diff --git a/library/cipher.c b/library/cipher.c index 0bac4ee99..4de290a46 100644 --- a/library/cipher.c +++ b/library/cipher.c @@ -63,12 +63,7 @@ #include "mbedtls/nist_kw.h" #endif -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif #define CIPHER_VALIDATE_RET( cond ) \ MBEDTLS_INTERNAL_VALIDATE_RET( cond, MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ) diff --git a/library/cipher_wrap.c b/library/cipher_wrap.c index 7da7d9d52..8e395b301 100644 --- a/library/cipher_wrap.c +++ b/library/cipher_wrap.c @@ -68,13 +68,7 @@ #include #endif -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif #if defined(MBEDTLS_GCM_C) /* shared by all GCM ciphers */ diff --git a/library/ctr_drbg.c b/library/ctr_drbg.c index 8919c78a1..d55f9a479 100644 --- a/library/ctr_drbg.c +++ b/library/ctr_drbg.c @@ -37,12 +37,7 @@ #endif #if defined(MBEDTLS_SELF_TEST) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_printf printf -#endif /* MBEDTLS_PLATFORM_C */ #endif /* MBEDTLS_SELF_TEST */ /* diff --git a/library/debug.c b/library/debug.c index fa60d13f3..bdbf6dd11 100644 --- a/library/debug.c +++ b/library/debug.c @@ -21,16 +21,7 @@ #if defined(MBEDTLS_DEBUG_C) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_calloc calloc -#define mbedtls_free free -#define mbedtls_time_t time_t -#define mbedtls_snprintf snprintf -#define mbedtls_vsnprintf vsnprintf -#endif #include "mbedtls/debug.h" #include "mbedtls/error.h" diff --git a/library/des.c b/library/des.c index 91d22b5d9..0576099ce 100644 --- a/library/des.c +++ b/library/des.c @@ -34,12 +34,7 @@ #include #if defined(MBEDTLS_SELF_TEST) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_printf printf -#endif /* MBEDTLS_PLATFORM_C */ #endif /* MBEDTLS_SELF_TEST */ #if !defined(MBEDTLS_DES_ALT) diff --git a/library/dhm.c b/library/dhm.c index 1e95bdab0..c01388e71 100644 --- a/library/dhm.c +++ b/library/dhm.c @@ -43,15 +43,7 @@ #include "mbedtls/asn1.h" #endif -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif #if !defined(MBEDTLS_DHM_ALT) diff --git a/library/ecdsa.c b/library/ecdsa.c index dcdf83c7a..c58e33155 100644 --- a/library/ecdsa.c +++ b/library/ecdsa.c @@ -36,13 +36,7 @@ #include "mbedtls/hmac_drbg.h" #endif -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif #include "mbedtls/platform_util.h" #include "mbedtls/error.h" diff --git a/library/ecjpake.c b/library/ecjpake.c index 308c1af3e..6cb70c022 100644 --- a/library/ecjpake.c +++ b/library/ecjpake.c @@ -815,12 +815,7 @@ cleanup: #if defined(MBEDTLS_SELF_TEST) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_printf printf -#endif #if !defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) || \ !defined(MBEDTLS_SHA256_C) diff --git a/library/ecp.c b/library/ecp.c index 009be61fc..ee6c24a46 100644 --- a/library/ecp.c +++ b/library/ecp.c @@ -84,15 +84,7 @@ #if !defined(MBEDTLS_ECP_ALT) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif #include "ecp_internal_alt.h" diff --git a/library/entropy.c b/library/entropy.c index 08c5bd7d1..12184d670 100644 --- a/library/entropy.c +++ b/library/entropy.c @@ -32,17 +32,10 @@ #include #endif -#if defined(MBEDTLS_ENTROPY_NV_SEED) #include "mbedtls/platform.h" -#endif #if defined(MBEDTLS_SELF_TEST) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_printf printf -#endif /* MBEDTLS_PLATFORM_C */ #endif /* MBEDTLS_SELF_TEST */ diff --git a/library/entropy_poll.c b/library/entropy_poll.c index 2ae57fdc0..2df9bbec9 100644 --- a/library/entropy_poll.c +++ b/library/entropy_poll.c @@ -35,9 +35,7 @@ #if defined(MBEDTLS_TIMING_C) #include "mbedtls/timing.h" #endif -#if defined(MBEDTLS_ENTROPY_NV_SEED) || !defined(HAVE_SYSCTL_ARND) #include "mbedtls/platform.h" -#endif #if !defined(MBEDTLS_NO_PLATFORM_ENTROPY) diff --git a/library/hmac_drbg.c b/library/hmac_drbg.c index 8b13a860f..3c89f5749 100644 --- a/library/hmac_drbg.c +++ b/library/hmac_drbg.c @@ -38,12 +38,7 @@ #endif #if defined(MBEDTLS_SELF_TEST) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_printf printf -#endif /* MBEDTLS_SELF_TEST */ #endif /* MBEDTLS_PLATFORM_C */ /* diff --git a/library/md.c b/library/md.c index a387da50a..8efcf105b 100644 --- a/library/md.c +++ b/library/md.c @@ -36,13 +36,7 @@ #include "mbedtls/sha256.h" #include "mbedtls/sha512.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif #include diff --git a/library/md5.c b/library/md5.c index a9bbcb488..a01b6dd29 100644 --- a/library/md5.c +++ b/library/md5.c @@ -33,12 +33,7 @@ #include #if defined(MBEDTLS_SELF_TEST) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_printf printf -#endif /* MBEDTLS_PLATFORM_C */ #endif /* MBEDTLS_SELF_TEST */ #if !defined(MBEDTLS_MD5_ALT) diff --git a/library/mps_trace.h b/library/mps_trace.h index 7c2360118..820a1b66c 100644 --- a/library/mps_trace.h +++ b/library/mps_trace.h @@ -30,13 +30,7 @@ #include "mps_common.h" #include "mps_trace.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_printf printf -#define mbedtls_vsnprintf vsnprintf -#endif /* MBEDTLS_PLATFORM_C */ #if defined(MBEDTLS_MPS_ENABLE_TRACE) diff --git a/library/net_sockets.c b/library/net_sockets.c index d1700f3bb..637b9f8d8 100644 --- a/library/net_sockets.c +++ b/library/net_sockets.c @@ -37,11 +37,7 @@ #error "This module only works on Unix and Windows, see MBEDTLS_NET_C in mbedtls_config.h" #endif -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#endif #include "mbedtls/net_sockets.h" #include "mbedtls/error.h" diff --git a/library/nist_kw.c b/library/nist_kw.c index 1aea0b634..6be6998dc 100644 --- a/library/nist_kw.c +++ b/library/nist_kw.c @@ -40,12 +40,7 @@ #include #if defined(MBEDTLS_SELF_TEST) && defined(MBEDTLS_AES_C) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_printf printf -#endif /* MBEDTLS_PLATFORM_C */ #endif /* MBEDTLS_SELF_TEST && MBEDTLS_AES_C */ #if !defined(MBEDTLS_NIST_KW_ALT) diff --git a/library/oid.c b/library/oid.c index 4ecf62184..9a20a2782 100644 --- a/library/oid.c +++ b/library/oid.c @@ -32,11 +32,7 @@ #include #include -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#define mbedtls_snprintf snprintf -#endif /* * Macro to automatically add the size of #define'd OIDs diff --git a/library/pem.c b/library/pem.c index f2ee5ca35..1e2e2c13d 100644 --- a/library/pem.c +++ b/library/pem.c @@ -33,13 +33,7 @@ #include -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif #if defined(MBEDTLS_USE_PSA_CRYPTO) #include "psa/crypto.h" diff --git a/library/pk_wrap.c b/library/pk_wrap.c index 2d4f4f221..5de8fa65f 100644 --- a/library/pk_wrap.c +++ b/library/pk_wrap.c @@ -55,13 +55,7 @@ #include "hash_info.h" #endif -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif #include #include diff --git a/library/pkcs5.c b/library/pkcs5.c index 847496d18..ac5945a11 100644 --- a/library/pkcs5.c +++ b/library/pkcs5.c @@ -42,12 +42,7 @@ #include -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_printf printf -#endif #include "hash_info.h" #include "mbedtls/psa_util.h" diff --git a/library/pkparse.c b/library/pkparse.c index 73d59a6bb..9b6516511 100644 --- a/library/pkparse.c +++ b/library/pkparse.c @@ -48,13 +48,7 @@ #include "mbedtls/pkcs12.h" #endif -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif /* Parameter validation macros based on platform_util.h */ #define PK_VALIDATE_RET( cond ) \ diff --git a/library/pkwrite.c b/library/pkwrite.c index 8b9934050..c198e6c32 100644 --- a/library/pkwrite.c +++ b/library/pkwrite.c @@ -51,13 +51,7 @@ #include "psa/crypto.h" #include "mbedtls/psa_util.h" #endif -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif /* Parameter validation macros based on platform_util.h */ #define PK_VALIDATE_RET( cond ) \ diff --git a/library/poly1305.c b/library/poly1305.c index 7375a0c57..a2b223303 100644 --- a/library/poly1305.c +++ b/library/poly1305.c @@ -29,12 +29,7 @@ #include #if defined(MBEDTLS_SELF_TEST) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_printf printf -#endif /* MBEDTLS_PLATFORM_C */ #endif /* MBEDTLS_SELF_TEST */ #if !defined(MBEDTLS_POLY1305_ALT) diff --git a/library/psa_crypto_slot_management.c b/library/psa_crypto_slot_management.c index a18350ee1..9dceaac6d 100644 --- a/library/psa_crypto_slot_management.c +++ b/library/psa_crypto_slot_management.c @@ -34,12 +34,7 @@ #include #include -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif #define ARRAY_LENGTH( array ) ( sizeof( array ) / sizeof( *( array ) ) ) diff --git a/library/psa_crypto_storage.c b/library/psa_crypto_storage.c index db7786d6c..3186a3685 100644 --- a/library/psa_crypto_storage.c +++ b/library/psa_crypto_storage.c @@ -36,13 +36,7 @@ #include "psa/internal_trusted_storage.h" #endif -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif diff --git a/library/psa_its_file.c b/library/psa_its_file.c index b7c2e6b04..a35ac2494 100644 --- a/library/psa_its_file.c +++ b/library/psa_its_file.c @@ -22,11 +22,7 @@ #if defined(MBEDTLS_PSA_ITS_FILE_C) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#define mbedtls_snprintf snprintf -#endif #if defined(_WIN32) #include diff --git a/library/ripemd160.c b/library/ripemd160.c index 41d838722..1c7e17ff3 100644 --- a/library/ripemd160.c +++ b/library/ripemd160.c @@ -34,12 +34,7 @@ #include #if defined(MBEDTLS_SELF_TEST) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_printf printf -#endif /* MBEDTLS_PLATFORM_C */ #endif /* MBEDTLS_SELF_TEST */ #if !defined(MBEDTLS_RIPEMD160_ALT) diff --git a/library/rsa.c b/library/rsa.c index e59755534..df6d59c1b 100644 --- a/library/rsa.c +++ b/library/rsa.c @@ -63,14 +63,7 @@ #endif /* MBEDTLS_MD_C */ #endif /* MBEDTLS_PKCS1_V21 */ -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_printf printf -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif #if !defined(MBEDTLS_RSA_ALT) diff --git a/library/sha1.c b/library/sha1.c index 6fc937123..4f65e23fd 100644 --- a/library/sha1.c +++ b/library/sha1.c @@ -33,12 +33,7 @@ #include #if defined(MBEDTLS_SELF_TEST) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_printf printf -#endif /* MBEDTLS_PLATFORM_C */ #endif /* MBEDTLS_SELF_TEST */ #define SHA1_VALIDATE_RET(cond) \ diff --git a/library/sha256.c b/library/sha256.c index ac15ef8d1..2e65e6fd8 100644 --- a/library/sha256.c +++ b/library/sha256.c @@ -33,15 +33,7 @@ #include #if defined(MBEDTLS_SELF_TEST) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif /* MBEDTLS_PLATFORM_C */ #endif /* MBEDTLS_SELF_TEST */ #if defined(__aarch64__) diff --git a/library/sha512.c b/library/sha512.c index be03ec331..beb548ace 100644 --- a/library/sha512.c +++ b/library/sha512.c @@ -39,15 +39,7 @@ #include #if defined(MBEDTLS_SELF_TEST) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif /* MBEDTLS_PLATFORM_C */ #endif /* MBEDTLS_SELF_TEST */ #if defined(__aarch64__) diff --git a/library/ssl_cache.c b/library/ssl_cache.c index 6505e1140..8405d2798 100644 --- a/library/ssl_cache.c +++ b/library/ssl_cache.c @@ -25,13 +25,7 @@ #if defined(MBEDTLS_SSL_CACHE_C) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif #include "mbedtls/ssl_cache.h" #include "ssl_misc.h" diff --git a/library/ssl_ciphersuites.c b/library/ssl_ciphersuites.c index dc5044963..591beb866 100644 --- a/library/ssl_ciphersuites.c +++ b/library/ssl_ciphersuites.c @@ -23,11 +23,7 @@ #if defined(MBEDTLS_SSL_TLS_C) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#endif #include "mbedtls/ssl_ciphersuites.h" #include "mbedtls/ssl.h" diff --git a/library/ssl_client.c b/library/ssl_client.c index e7453d573..b4c645a16 100644 --- a/library/ssl_client.c +++ b/library/ssl_client.c @@ -24,13 +24,7 @@ #if defined(MBEDTLS_SSL_CLI_C) #if defined(MBEDTLS_SSL_PROTO_TLS1_3) || defined(MBEDTLS_SSL_PROTO_TLS1_2) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif #include diff --git a/library/ssl_cookie.c b/library/ssl_cookie.c index 8777833b9..1c0cbe0c8 100644 --- a/library/ssl_cookie.c +++ b/library/ssl_cookie.c @@ -25,12 +25,7 @@ #if defined(MBEDTLS_SSL_COOKIE_C) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif #include "mbedtls/ssl_cookie.h" #include "ssl_misc.h" diff --git a/library/ssl_msg.c b/library/ssl_msg.c index dbef29b3f..5ceb145c9 100644 --- a/library/ssl_msg.c +++ b/library/ssl_msg.c @@ -26,13 +26,7 @@ #if defined(MBEDTLS_SSL_TLS_C) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif #include "mbedtls/ssl.h" #include "ssl_misc.h" diff --git a/library/ssl_ticket.c b/library/ssl_ticket.c index 359686afa..e39563bc4 100644 --- a/library/ssl_ticket.c +++ b/library/ssl_ticket.c @@ -21,13 +21,7 @@ #if defined(MBEDTLS_SSL_TICKET_C) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif #include "ssl_misc.h" #include "mbedtls/ssl_ticket.h" diff --git a/library/ssl_tls.c b/library/ssl_tls.c index af65e6d86..173ae2591 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -27,15 +27,7 @@ #include -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_calloc calloc -#define mbedtls_free free -#define mbedtls_printf printf -#endif /* !MBEDTLS_PLATFORM_C */ #include "mbedtls/ssl.h" #include "ssl_client.h" diff --git a/library/ssl_tls12_client.c b/library/ssl_tls12_client.c index d1ec55cfc..7b62e71a5 100644 --- a/library/ssl_tls12_client.c +++ b/library/ssl_tls12_client.c @@ -21,13 +21,7 @@ #if defined(MBEDTLS_SSL_CLI_C) && defined(MBEDTLS_SSL_PROTO_TLS1_2) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif #include "mbedtls/ssl.h" #include "ssl_client.h" diff --git a/library/ssl_tls12_server.c b/library/ssl_tls12_server.c index 997f5848e..66c61a3aa 100644 --- a/library/ssl_tls12_server.c +++ b/library/ssl_tls12_server.c @@ -21,13 +21,7 @@ #if defined(MBEDTLS_SSL_SRV_C) && defined(MBEDTLS_SSL_PROTO_TLS1_2) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif #include "mbedtls/ssl.h" #include "ssl_misc.h" diff --git a/library/ssl_tls13_server.c b/library/ssl_tls13_server.c index a10e59bbc..ee0ffab19 100644 --- a/library/ssl_tls13_server.c +++ b/library/ssl_tls13_server.c @@ -34,13 +34,7 @@ #include "mbedtls/ecp.h" #endif /* MBEDTLS_ECP_C */ -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif /* MBEDTLS_PLATFORM_C */ #include "ssl_misc.h" #include "ssl_tls13_keys.h" diff --git a/library/x509.c b/library/x509.c index aa3951799..6fe0410a3 100644 --- a/library/x509.c +++ b/library/x509.c @@ -43,16 +43,7 @@ #include "mbedtls/pem.h" #endif -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_free free -#define mbedtls_calloc calloc -#define mbedtls_printf printf -#define mbedtls_snprintf snprintf -#endif #if defined(MBEDTLS_HAVE_TIME) #include "mbedtls/platform_time.h" diff --git a/library/x509_crl.c b/library/x509_crl.c index 0cd996dab..2a3fac790 100644 --- a/library/x509_crl.c +++ b/library/x509_crl.c @@ -42,15 +42,7 @@ #include "mbedtls/pem.h" #endif -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_free free -#define mbedtls_calloc calloc -#define mbedtls_snprintf snprintf -#endif #if defined(MBEDTLS_HAVE_TIME) #if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32) diff --git a/library/x509_crt.c b/library/x509_crt.c index af1e487db..c4f97bbe2 100644 --- a/library/x509_crt.c +++ b/library/x509_crt.c @@ -50,15 +50,7 @@ #endif /* MBEDTLS_USE_PSA_CRYPTO */ #include "hash_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_free free -#define mbedtls_calloc calloc -#define mbedtls_snprintf snprintf -#endif #if defined(MBEDTLS_THREADING_C) #include "mbedtls/threading.h" diff --git a/library/x509_csr.c b/library/x509_csr.c index 25069b2a4..dee0ea62d 100644 --- a/library/x509_csr.c +++ b/library/x509_csr.c @@ -42,15 +42,7 @@ #include "mbedtls/pem.h" #endif -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_free free -#define mbedtls_calloc calloc -#define mbedtls_snprintf snprintf -#endif #if defined(MBEDTLS_FS_IO) || defined(EFIX64) || defined(EFI32) #include diff --git a/library/x509write_csr.c b/library/x509write_csr.c index c4dd1b7c8..976f6e6df 100644 --- a/library/x509write_csr.c +++ b/library/x509write_csr.c @@ -45,13 +45,7 @@ #include "mbedtls/pem.h" #endif -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_calloc calloc -#define mbedtls_free free -#endif void mbedtls_x509write_csr_init( mbedtls_x509write_csr *ctx ) { diff --git a/programs/aes/crypt_and_hash.c b/programs/aes/crypt_and_hash.c index 136e25ba4..476c20e22 100644 --- a/programs/aes/crypt_and_hash.c +++ b/programs/aes/crypt_and_hash.c @@ -25,17 +25,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_fprintf fprintf -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if defined(MBEDTLS_CIPHER_C) && defined(MBEDTLS_MD_C) && \ defined(MBEDTLS_FS_IO) diff --git a/programs/hash/generic_sum.c b/programs/hash/generic_sum.c index f38a9769d..6f49e79be 100644 --- a/programs/hash/generic_sum.c +++ b/programs/hash/generic_sum.c @@ -19,17 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_fprintf fprintf -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if defined(MBEDTLS_MD_C) && defined(MBEDTLS_FS_IO) #include "mbedtls/md.h" diff --git a/programs/hash/hello.c b/programs/hash/hello.c index cb8de8b71..3ef065263 100644 --- a/programs/hash/hello.c +++ b/programs/hash/hello.c @@ -19,16 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif #if defined(MBEDTLS_MD5_C) #include "mbedtls/md5.h" diff --git a/programs/pkey/dh_client.c b/programs/pkey/dh_client.c index 45de57b46..3619cb216 100644 --- a/programs/pkey/dh_client.c +++ b/programs/pkey/dh_client.c @@ -19,17 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_time_t time_t -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if defined(MBEDTLS_AES_C) && defined(MBEDTLS_DHM_C) && \ defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_NET_C) && \ diff --git a/programs/pkey/dh_genprime.c b/programs/pkey/dh_genprime.c index 9ada4eae1..2e696e574 100644 --- a/programs/pkey/dh_genprime.c +++ b/programs/pkey/dh_genprime.c @@ -19,17 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_time_t time_t -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if !defined(MBEDTLS_BIGNUM_C) || !defined(MBEDTLS_ENTROPY_C) || \ !defined(MBEDTLS_FS_IO) || !defined(MBEDTLS_CTR_DRBG_C) || \ diff --git a/programs/pkey/dh_server.c b/programs/pkey/dh_server.c index 29563088f..e6f53ed62 100644 --- a/programs/pkey/dh_server.c +++ b/programs/pkey/dh_server.c @@ -19,17 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_time_t time_t -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if defined(MBEDTLS_AES_C) && defined(MBEDTLS_DHM_C) && \ defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_NET_C) && \ diff --git a/programs/pkey/ecdh_curve25519.c b/programs/pkey/ecdh_curve25519.c index 281a26b0d..5dd6bddb4 100644 --- a/programs/pkey/ecdh_curve25519.c +++ b/programs/pkey/ecdh_curve25519.c @@ -19,16 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if !defined(MBEDTLS_ECDH_C) || \ !defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED) || \ diff --git a/programs/pkey/ecdsa.c b/programs/pkey/ecdsa.c index c1c50702b..1035bb273 100644 --- a/programs/pkey/ecdsa.c +++ b/programs/pkey/ecdsa.c @@ -19,16 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if defined(MBEDTLS_ECDSA_C) && \ defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_CTR_DRBG_C) diff --git a/programs/pkey/gen_key.c b/programs/pkey/gen_key.c index 8779519b6..9e5329fb8 100644 --- a/programs/pkey/gen_key.c +++ b/programs/pkey/gen_key.c @@ -19,16 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if defined(MBEDTLS_PK_WRITE_C) && defined(MBEDTLS_FS_IO) && \ defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_CTR_DRBG_C) diff --git a/programs/pkey/key_app.c b/programs/pkey/key_app.c index bd16b24b9..02a19e95a 100644 --- a/programs/pkey/key_app.c +++ b/programs/pkey/key_app.c @@ -19,16 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if defined(MBEDTLS_BIGNUM_C) && \ defined(MBEDTLS_PK_PARSE_C) && defined(MBEDTLS_FS_IO) && \ diff --git a/programs/pkey/key_app_writer.c b/programs/pkey/key_app_writer.c index df1e50248..589bee9ae 100644 --- a/programs/pkey/key_app_writer.c +++ b/programs/pkey/key_app_writer.c @@ -19,16 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if defined(MBEDTLS_PK_PARSE_C) && defined(MBEDTLS_PK_WRITE_C) && \ defined(MBEDTLS_FS_IO) && \ diff --git a/programs/pkey/mpi_demo.c b/programs/pkey/mpi_demo.c index eed8dfcfc..4c34b99e7 100644 --- a/programs/pkey/mpi_demo.c +++ b/programs/pkey/mpi_demo.c @@ -19,16 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if defined(MBEDTLS_BIGNUM_C) && defined(MBEDTLS_FS_IO) #include "mbedtls/bignum.h" diff --git a/programs/pkey/pk_decrypt.c b/programs/pkey/pk_decrypt.c index b09b6b889..0d8388f2b 100644 --- a/programs/pkey/pk_decrypt.c +++ b/programs/pkey/pk_decrypt.c @@ -19,16 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if defined(MBEDTLS_BIGNUM_C) && defined(MBEDTLS_PK_PARSE_C) && \ defined(MBEDTLS_FS_IO) && defined(MBEDTLS_ENTROPY_C) && \ diff --git a/programs/pkey/pk_encrypt.c b/programs/pkey/pk_encrypt.c index 3df11f7fd..5d45738dd 100644 --- a/programs/pkey/pk_encrypt.c +++ b/programs/pkey/pk_encrypt.c @@ -19,17 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_fprintf fprintf -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if defined(MBEDTLS_BIGNUM_C) && defined(MBEDTLS_PK_PARSE_C) && \ defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_FS_IO) && \ diff --git a/programs/pkey/pk_sign.c b/programs/pkey/pk_sign.c index 7b5d8e171..301edb875 100644 --- a/programs/pkey/pk_sign.c +++ b/programs/pkey/pk_sign.c @@ -19,17 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_snprintf snprintf -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if !defined(MBEDTLS_BIGNUM_C) || !defined(MBEDTLS_ENTROPY_C) || \ !defined(MBEDTLS_SHA256_C) || !defined(MBEDTLS_MD_C) || \ diff --git a/programs/pkey/pk_verify.c b/programs/pkey/pk_verify.c index e82653b51..6b9645221 100644 --- a/programs/pkey/pk_verify.c +++ b/programs/pkey/pk_verify.c @@ -19,17 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_snprintf snprintf -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if !defined(MBEDTLS_BIGNUM_C) || !defined(MBEDTLS_MD_C) || \ !defined(MBEDTLS_SHA256_C) || !defined(MBEDTLS_PK_PARSE_C) || \ diff --git a/programs/pkey/rsa_decrypt.c b/programs/pkey/rsa_decrypt.c index c01a5cf63..783f3ca54 100644 --- a/programs/pkey/rsa_decrypt.c +++ b/programs/pkey/rsa_decrypt.c @@ -19,16 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if defined(MBEDTLS_BIGNUM_C) && defined(MBEDTLS_RSA_C) && \ defined(MBEDTLS_FS_IO) && defined(MBEDTLS_ENTROPY_C) && \ diff --git a/programs/pkey/rsa_encrypt.c b/programs/pkey/rsa_encrypt.c index 25a42d323..777b22e79 100644 --- a/programs/pkey/rsa_encrypt.c +++ b/programs/pkey/rsa_encrypt.c @@ -19,17 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_fprintf fprintf -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if defined(MBEDTLS_BIGNUM_C) && defined(MBEDTLS_RSA_C) && \ defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_FS_IO) && \ diff --git a/programs/pkey/rsa_genkey.c b/programs/pkey/rsa_genkey.c index 67711bd66..7acda8139 100644 --- a/programs/pkey/rsa_genkey.c +++ b/programs/pkey/rsa_genkey.c @@ -19,16 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if defined(MBEDTLS_BIGNUM_C) && defined(MBEDTLS_ENTROPY_C) && \ defined(MBEDTLS_RSA_C) && defined(MBEDTLS_GENPRIME) && \ diff --git a/programs/pkey/rsa_sign.c b/programs/pkey/rsa_sign.c index 1df9b13b1..f4deab029 100644 --- a/programs/pkey/rsa_sign.c +++ b/programs/pkey/rsa_sign.c @@ -19,18 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_fprintf fprintf -#define mbedtls_printf printf -#define mbedtls_snprintf snprintf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if !defined(MBEDTLS_BIGNUM_C) || !defined(MBEDTLS_RSA_C) || \ !defined(MBEDTLS_SHA256_C) || !defined(MBEDTLS_MD_C) || \ diff --git a/programs/pkey/rsa_sign_pss.c b/programs/pkey/rsa_sign_pss.c index 8078ab624..0cbde0224 100644 --- a/programs/pkey/rsa_sign_pss.c +++ b/programs/pkey/rsa_sign_pss.c @@ -19,17 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_snprintf snprintf -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if !defined(MBEDTLS_MD_C) || !defined(MBEDTLS_ENTROPY_C) || \ !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_SHA256_C) || \ diff --git a/programs/pkey/rsa_verify.c b/programs/pkey/rsa_verify.c index a8b1abb84..a3fa6d7d1 100644 --- a/programs/pkey/rsa_verify.c +++ b/programs/pkey/rsa_verify.c @@ -19,17 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_snprintf snprintf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if !defined(MBEDTLS_BIGNUM_C) || !defined(MBEDTLS_RSA_C) || \ !defined(MBEDTLS_SHA256_C) || !defined(MBEDTLS_MD_C) || \ diff --git a/programs/pkey/rsa_verify_pss.c b/programs/pkey/rsa_verify_pss.c index 3a207785c..7dcccda9f 100644 --- a/programs/pkey/rsa_verify_pss.c +++ b/programs/pkey/rsa_verify_pss.c @@ -19,17 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_snprintf snprintf -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if !defined(MBEDTLS_MD_C) || !defined(MBEDTLS_ENTROPY_C) || \ !defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_SHA256_C) || \ diff --git a/programs/random/gen_entropy.c b/programs/random/gen_entropy.c index 4deb92435..f0ffea2ce 100644 --- a/programs/random/gen_entropy.c +++ b/programs/random/gen_entropy.c @@ -19,17 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_fprintf fprintf -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_FS_IO) #include "mbedtls/entropy.h" diff --git a/programs/random/gen_random_ctr_drbg.c b/programs/random/gen_random_ctr_drbg.c index 0a9e2dd3b..2a3dd54e8 100644 --- a/programs/random/gen_random_ctr_drbg.c +++ b/programs/random/gen_random_ctr_drbg.c @@ -19,17 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_fprintf fprintf -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if defined(MBEDTLS_CTR_DRBG_C) && defined(MBEDTLS_ENTROPY_C) && \ defined(MBEDTLS_FS_IO) diff --git a/programs/ssl/dtls_client.c b/programs/ssl/dtls_client.c index e06d535ee..23a34e049 100644 --- a/programs/ssl/dtls_client.c +++ b/programs/ssl/dtls_client.c @@ -19,17 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_fprintf fprintf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif #if !defined(MBEDTLS_SSL_CLI_C) || !defined(MBEDTLS_SSL_PROTO_DTLS) || \ !defined(MBEDTLS_NET_C) || !defined(MBEDTLS_TIMING_C) || \ diff --git a/programs/ssl/dtls_server.c b/programs/ssl/dtls_server.c index 931744937..10d82ba87 100644 --- a/programs/ssl/dtls_server.c +++ b/programs/ssl/dtls_server.c @@ -19,18 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_fprintf fprintf -#define mbedtls_time_t time_t -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* Uncomment out the following line to default to IPv4 and disable IPv6 */ //#define FORCE_IPV4 diff --git a/programs/ssl/mini_client.c b/programs/ssl/mini_client.c index 8f2fed82a..efcf65016 100644 --- a/programs/ssl/mini_client.c +++ b/programs/ssl/mini_client.c @@ -20,16 +20,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* * We're creating and connecting the socket "manually" rather than using the diff --git a/programs/ssl/ssl_client1.c b/programs/ssl/ssl_client1.c index a80ff713c..5025698a8 100644 --- a/programs/ssl/ssl_client1.c +++ b/programs/ssl/ssl_client1.c @@ -19,19 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_time time -#define mbedtls_time_t time_t -#define mbedtls_fprintf fprintf -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if !defined(MBEDTLS_BIGNUM_C) || !defined(MBEDTLS_ENTROPY_C) || \ !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_CLI_C) || \ diff --git a/programs/ssl/ssl_fork_server.c b/programs/ssl/ssl_fork_server.c index 07b3e6fb5..49de984d8 100644 --- a/programs/ssl/ssl_fork_server.c +++ b/programs/ssl/ssl_fork_server.c @@ -19,18 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_fprintf fprintf -#define mbedtls_printf printf -#define mbedtls_time_t time_t -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if !defined(MBEDTLS_BIGNUM_C) || !defined(MBEDTLS_ENTROPY_C) || \ !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_SRV_C) || \ diff --git a/programs/ssl/ssl_mail_client.c b/programs/ssl/ssl_mail_client.c index 664a38490..9fb65079e 100644 --- a/programs/ssl/ssl_mail_client.c +++ b/programs/ssl/ssl_mail_client.c @@ -26,19 +26,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_time time -#define mbedtls_time_t time_t -#define mbedtls_fprintf fprintf -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if !defined(MBEDTLS_BIGNUM_C) || !defined(MBEDTLS_ENTROPY_C) || \ !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_CLI_C) || \ diff --git a/programs/ssl/ssl_pthread_server.c b/programs/ssl/ssl_pthread_server.c index ac14789d3..b3ec7d699 100644 --- a/programs/ssl/ssl_pthread_server.c +++ b/programs/ssl/ssl_pthread_server.c @@ -20,18 +20,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_fprintf fprintf -#define mbedtls_printf printf -#define mbedtls_snprintf snprintf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif #if !defined(MBEDTLS_BIGNUM_C) || !defined(MBEDTLS_ENTROPY_C) || \ !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_SRV_C) || \ diff --git a/programs/ssl/ssl_server.c b/programs/ssl/ssl_server.c index 3b663726c..c9d9df2ef 100644 --- a/programs/ssl/ssl_server.c +++ b/programs/ssl/ssl_server.c @@ -19,19 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_time time -#define mbedtls_time_t time_t -#define mbedtls_fprintf fprintf -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif #if !defined(MBEDTLS_BIGNUM_C) || !defined(MBEDTLS_PEM_PARSE_C) || \ !defined(MBEDTLS_ENTROPY_C) || !defined(MBEDTLS_SSL_TLS_C) || \ diff --git a/programs/ssl/ssl_test_lib.h b/programs/ssl/ssl_test_lib.h index c368f573a..659b3ab2c 100644 --- a/programs/ssl/ssl_test_lib.h +++ b/programs/ssl/ssl_test_lib.h @@ -22,23 +22,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_calloc calloc -#define mbedtls_free free -#define mbedtls_time time -#define mbedtls_time_t time_t -#define mbedtls_printf printf -#define mbedtls_fprintf fprintf -#define mbedtls_snprintf snprintf -#define mbedtls_setbuf setbuf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif #undef HAVE_RNG #if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG) && \ diff --git a/programs/test/cmake_package/cmake_package.c b/programs/test/cmake_package/cmake_package.c index 1ae627d42..4105d2b35 100644 --- a/programs/test/cmake_package/cmake_package.c +++ b/programs/test/cmake_package/cmake_package.c @@ -19,17 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_fprintf fprintf -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #include "mbedtls/version.h" diff --git a/programs/test/cmake_package_install/cmake_package_install.c b/programs/test/cmake_package_install/cmake_package_install.c index 9d5d3e4c7..48fb559f6 100644 --- a/programs/test/cmake_package_install/cmake_package_install.c +++ b/programs/test/cmake_package_install/cmake_package_install.c @@ -20,17 +20,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_fprintf fprintf -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #include "mbedtls/version.h" diff --git a/programs/test/cmake_subproject/cmake_subproject.c b/programs/test/cmake_subproject/cmake_subproject.c index ff6ebf02e..b1d005cd7 100644 --- a/programs/test/cmake_subproject/cmake_subproject.c +++ b/programs/test/cmake_subproject/cmake_subproject.c @@ -20,17 +20,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_fprintf fprintf -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #include "mbedtls/version.h" diff --git a/programs/test/dlopen.c b/programs/test/dlopen.c index c0836046a..ff61fcde0 100644 --- a/programs/test/dlopen.c +++ b/programs/test/dlopen.c @@ -19,17 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_fprintf fprintf -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif #if defined(MBEDTLS_X509_CRT_PARSE_C) #include "mbedtls/x509_crt.h" diff --git a/programs/test/query_compile_time_config.c b/programs/test/query_compile_time_config.c index 5aa023348..f37973cb2 100644 --- a/programs/test/query_compile_time_config.c +++ b/programs/test/query_compile_time_config.c @@ -19,14 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif #define USAGE \ "usage: %s [ -all | -any | -l ] ...\n\n" \ diff --git a/programs/test/selftest.c b/programs/test/selftest.c index ab337a21f..2d6103c31 100644 --- a/programs/test/selftest.c +++ b/programs/test/selftest.c @@ -54,19 +54,7 @@ #include #include -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_calloc calloc -#define mbedtls_free free -#define mbedtls_printf printf -#define mbedtls_snprintf snprintf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif #if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) #include "mbedtls/memory_buffer_alloc.h" diff --git a/programs/test/zeroize.c b/programs/test/zeroize.c index d6e55614f..979b5515f 100644 --- a/programs/test/zeroize.c +++ b/programs/test/zeroize.c @@ -29,15 +29,7 @@ #include -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif #include "mbedtls/platform_util.h" diff --git a/programs/util/pem2der.c b/programs/util/pem2der.c index cf6a56c6c..7138fa854 100644 --- a/programs/util/pem2der.c +++ b/programs/util/pem2der.c @@ -19,18 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_free free -#define mbedtls_calloc calloc -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if defined(MBEDTLS_BASE64_C) && defined(MBEDTLS_FS_IO) #include "mbedtls/error.h" diff --git a/programs/util/strerror.c b/programs/util/strerror.c index f91da1307..66052fdab 100644 --- a/programs/util/strerror.c +++ b/programs/util/strerror.c @@ -19,14 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_exit exit -#endif #if defined(MBEDTLS_ERROR_C) || defined(MBEDTLS_ERROR_STRERROR_DUMMY) #include "mbedtls/error.h" diff --git a/programs/x509/cert_app.c b/programs/x509/cert_app.c index 985b9704c..00d563fc7 100644 --- a/programs/x509/cert_app.c +++ b/programs/x509/cert_app.c @@ -19,19 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_time time -#define mbedtls_time_t time_t -#define mbedtls_fprintf fprintf -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if !defined(MBEDTLS_BIGNUM_C) || !defined(MBEDTLS_ENTROPY_C) || \ !defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_CLI_C) || \ diff --git a/programs/x509/cert_req.c b/programs/x509/cert_req.c index 7460bbf1c..30b389ab4 100644 --- a/programs/x509/cert_req.c +++ b/programs/x509/cert_req.c @@ -19,16 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if !defined(MBEDTLS_X509_CSR_WRITE_C) || !defined(MBEDTLS_FS_IO) || \ !defined(MBEDTLS_PK_PARSE_C) || !defined(MBEDTLS_SHA256_C) || \ diff --git a/programs/x509/cert_write.c b/programs/x509/cert_write.c index 793982d5a..c93ff1e98 100644 --- a/programs/x509/cert_write.c +++ b/programs/x509/cert_write.c @@ -19,16 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if !defined(MBEDTLS_X509_CRT_WRITE_C) || \ !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_FS_IO) || \ diff --git a/programs/x509/crl_app.c b/programs/x509/crl_app.c index aa353be0a..28cb99e6e 100644 --- a/programs/x509/crl_app.c +++ b/programs/x509/crl_app.c @@ -19,16 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if !defined(MBEDTLS_BIGNUM_C) || !defined(MBEDTLS_RSA_C) || \ !defined(MBEDTLS_X509_CRL_PARSE_C) || !defined(MBEDTLS_FS_IO) || \ diff --git a/programs/x509/load_roots.c b/programs/x509/load_roots.c index e07bed721..b8b0ecdee 100644 --- a/programs/x509/load_roots.c +++ b/programs/x509/load_roots.c @@ -46,19 +46,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_time time -#define mbedtls_time_t time_t -#define mbedtls_fprintf fprintf -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if !defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_FS_IO) || \ !defined(MBEDTLS_TIMING_C) diff --git a/programs/x509/req_app.c b/programs/x509/req_app.c index 24324ff3d..dda14e1e3 100644 --- a/programs/x509/req_app.c +++ b/programs/x509/req_app.c @@ -19,16 +19,7 @@ #include "mbedtls/build_info.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#include -#define mbedtls_printf printf -#define mbedtls_exit exit -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif /* MBEDTLS_PLATFORM_C */ #if !defined(MBEDTLS_BIGNUM_C) || !defined(MBEDTLS_RSA_C) || \ !defined(MBEDTLS_X509_CSR_PARSE_C) || !defined(MBEDTLS_FS_IO) || \ diff --git a/scripts/data_files/error.fmt b/scripts/data_files/error.fmt index c42d2ffef..fc210b908 100644 --- a/scripts/data_files/error.fmt +++ b/scripts/data_files/error.fmt @@ -25,11 +25,7 @@ #if defined(MBEDTLS_ERROR_C) -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#define mbedtls_snprintf snprintf -#endif #include #include diff --git a/scripts/data_files/query_config.fmt b/scripts/data_files/query_config.fmt index 59eb16897..b5d3eec95 100644 --- a/scripts/data_files/query_config.fmt +++ b/scripts/data_files/query_config.fmt @@ -21,12 +21,7 @@ #include "query_config.h" -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_printf printf -#endif /* MBEDTLS_PLATFORM_C */ /* * Include all the headers with public APIs in case they define a macro to its diff --git a/tests/include/test/helpers.h b/tests/include/test/helpers.h index 93a3e1132..13c87fd59 100644 --- a/tests/include/test/helpers.h +++ b/tests/include/test/helpers.h @@ -37,20 +37,7 @@ #define MBEDTLS_TEST_MUTEX_USAGE #endif -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_fprintf fprintf -#define mbedtls_snprintf snprintf -#define mbedtls_calloc calloc -#define mbedtls_free free -#define mbedtls_exit exit -#define mbedtls_time time -#define mbedtls_time_t time_t -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif #include #include diff --git a/tests/include/test/macros.h b/tests/include/test/macros.h index 8535b9307..695a2433a 100644 --- a/tests/include/test/macros.h +++ b/tests/include/test/macros.h @@ -28,20 +28,7 @@ #include -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_fprintf fprintf -#define mbedtls_snprintf snprintf -#define mbedtls_calloc calloc -#define mbedtls_free free -#define mbedtls_exit exit -#define mbedtls_time time -#define mbedtls_time_t time_t -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif #if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) #include "mbedtls/memory_buffer_alloc.h" diff --git a/tests/suites/helpers.function b/tests/suites/helpers.function index a620178f6..0af4ca9f8 100644 --- a/tests/suites/helpers.function +++ b/tests/suites/helpers.function @@ -12,20 +12,7 @@ #if defined (MBEDTLS_ERROR_C) #include "mbedtls/error.h" #endif -#if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" -#else -#include -#define mbedtls_fprintf fprintf -#define mbedtls_snprintf snprintf -#define mbedtls_calloc calloc -#define mbedtls_free free -#define mbedtls_exit exit -#define mbedtls_time time -#define mbedtls_time_t time_t -#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS -#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE -#endif #if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) #include "mbedtls/memory_buffer_alloc.h"