aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGilles Peskine <Gilles.Peskine@arm.com>2024-05-16 14:54:04 +0200
committerGilles Peskine <Gilles.Peskine@arm.com>2024-05-29 09:44:20 +0200
commit690fb5e0b0ee0921ccfe7d5e8c5bb96b06a8106b (patch)
tree8384a1c787d0a5c8ca121570a827db8e79f05385 /include
parent0b8ece6beb97b6b82783bce2da7a0a3c50b5fb2a (diff)
downloadmbedtls-690fb5e0b0ee0921ccfe7d5e8c5bb96b06a8106b.zip
mbedtls-690fb5e0b0ee0921ccfe7d5e8c5bb96b06a8106b.tar.gz
mbedtls-690fb5e0b0ee0921ccfe7d5e8c5bb96b06a8106b.tar.bz2
Warn if mbedtls_config.h is included manually
Some projects using Mbed TLS have migrated their configuration file (config.h -> mbedtls_config.h, or MBEDTLS_CONFIG_FILE) from Mbed TLS 2.x, and kept including check_config.h. This is unnecessary since Mbed TLS 3.0, and increasingly in 3.x it may report spurious errors because the configuration adjustments have not been done yet. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Diffstat (limited to 'include')
-rw-r--r--include/mbedtls/check_config.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/mbedtls/check_config.h b/include/mbedtls/check_config.h
index 9c33fae..67a05f8 100644
--- a/include/mbedtls/check_config.h
+++ b/include/mbedtls/check_config.h
@@ -19,6 +19,13 @@
#define MBEDTLS_CHECK_CONFIG_H
/* *INDENT-OFF* */
+
+#if !defined(MBEDTLS_CONFIG_IS_FINALIZED)
+#warning "Do not include mbedtls/check_config.h manually! " \
+ "This may cause spurious errors. " \
+ "It is included automatically at the right point since Mbed TLS 3.0."
+#endif /* !MBEDTLS_CONFIG_IS_FINALIZED */
+
/*
* We assume CHAR_BIT is 8 in many places. In practice, this is true on our
* target platforms, so not an issue, but let's just be extra sure.