Merge pull request #9153 from gilles-peskine-arm/oid-limits-2.28
2.28 only: Fix the build without check_config.h (inclusion of limits.h)
diff --git a/ChangeLog.d/build_without_check_config.txt b/ChangeLog.d/build_without_check_config.txt
new file mode 100644
index 0000000..b7f4766
--- /dev/null
+++ b/ChangeLog.d/build_without_check_config.txt
@@ -0,0 +1,3 @@
+Bugfix
+ * Fix the build in some configurations when check_config.h is not included.
+ Fix #9152.
diff --git a/library/oid.c b/library/oid.c
index 7d7f1bf..2868ef9 100644
--- a/library/oid.c
+++ b/library/oid.c
@@ -15,6 +15,7 @@
#include "mbedtls/rsa.h"
#include "mbedtls/error.h"
+#include <limits.h>
#include <stdio.h>
#include <string.h>
diff --git a/library/psa_crypto_rsa.c b/library/psa_crypto_rsa.c
index cc3ceca..3c569b1 100644
--- a/library/psa_crypto_rsa.c
+++ b/library/psa_crypto_rsa.c
@@ -16,6 +16,7 @@
#include "psa_crypto_rsa.h"
#include "psa_crypto_hash.h"
+#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include "mbedtls/platform.h"
diff --git a/library/ssl_msg.c b/library/ssl_msg.c
index 5e85679..1613a1e 100644
--- a/library/ssl_msg.c
+++ b/library/ssl_msg.c
@@ -29,6 +29,7 @@
#include "constant_time_internal.h"
#include "mbedtls/constant_time.h"
+#include <limits.h>
#include <string.h>
#if defined(MBEDTLS_USE_PSA_CRYPTO)
diff --git a/library/x509_crt.c b/library/x509_crt.c
index a3a4525..6728fa0 100644
--- a/library/x509_crt.c
+++ b/library/x509_crt.c
@@ -26,6 +26,7 @@
#include "mbedtls/oid.h"
#include "mbedtls/platform_util.h"
+#include <limits.h>
#include <string.h>
#if defined(MBEDTLS_PEM_PARSE_C)
diff --git a/programs/test/udp_proxy.c b/programs/test/udp_proxy.c
index e5b8217..c6e6658 100644
--- a/programs/test/udp_proxy.c
+++ b/programs/test/udp_proxy.c
@@ -35,6 +35,8 @@
#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE
#endif /* MBEDTLS_PLATFORM_C */
+#include <limits.h>
+
#if !defined(MBEDTLS_NET_C)
int main(void)
{
diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh
index 7608b55..1e57ac7 100755
--- a/tests/scripts/all.sh
+++ b/tests/scripts/all.sh
@@ -886,6 +886,13 @@
tests/scripts/run_demos.py
}
+component_build_without_check_config () {
+ msg "build: full without check_config.h"
+ scripts/config.py full
+ sed -i '/#include.*check_config\.h/ s!^!//!' "$CONFIG_H"
+ make
+}
+
component_test_default_cmake_gcc_asan () {
msg "build: cmake, gcc, ASan" # ~ 1 min 50s
CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
diff --git a/tests/src/test_helpers/ssl_helpers.c b/tests/src/test_helpers/ssl_helpers.c
index 2359615..f919db0 100644
--- a/tests/src/test_helpers/ssl_helpers.c
+++ b/tests/src/test_helpers/ssl_helpers.c
@@ -10,6 +10,8 @@
#include <test/ssl_helpers.h>
+#include <limits.h>
+
#if defined(MBEDTLS_SSL_TLS_C)
void mbedtls_test_ssl_log_analyzer(void *ctx, int level,