From 3b1422e55ed0ddd3d11f6e2b7573e2930deca91b Mon Sep 17 00:00:00 2001 From: Hanno Becker Date: Wed, 26 Jul 2017 13:38:02 +0100 Subject: [PATCH] Check threshold for MBEDTLS_X509_MAX_INTERMEDIATE_CA in X509 tests The X509 test suite assumes that MBEDTLS_X509_MAX_INTERMEDIATE_CA is below the hardcoded threshold 20 used in the long certificate chain generating script tests/data_files/dir-max/long.sh. This commit adds a compile-time check for that. --- tests/suites/test_suite_x509parse.function | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/suites/test_suite_x509parse.function b/tests/suites/test_suite_x509parse.function index a7baec66de..34164a83fc 100644 --- a/tests/suites/test_suite_x509parse.function +++ b/tests/suites/test_suite_x509parse.function @@ -7,6 +7,12 @@ #include "mbedtls/oid.h" #include "mbedtls/base64.h" +#if MBEDTLS_X509_MAX_INTERMEDIATE_CA >= 19 +#error "The value of MBEDTLS_X509_MAX_INTERMEDIATE_C is larger \ +than the current threshold 19. To test larger values, please \ +adapt the script tests/data_files/dir-max/long.sh." +#endif + /* Profile for backward compatibility. Allows SHA-1, unlike the default profile. */ const mbedtls_x509_crt_profile compat_profile =