From a6bca9f19e7dae82e672842987e2c592fe845c7a Mon Sep 17 00:00:00 2001 From: Hanno Becker Date: Wed, 26 Jul 2017 13:35:11 +0100 Subject: [PATCH] Check value of MBEDTLS_X509_MAX_INTERMEDIATE_CA in ssl-opt.sh Some tests in ssl-opt.sh assumes the value 8 for the maximal number MBEDTLS_X509_MAX_INTERMEDIATE_CA of intermediate CA's. This commit adds a check before conducting the respective tests. --- tests/ssl-opt.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/ssl-opt.sh b/tests/ssl-opt.sh index 98d55f51ce..b4d36a94c4 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -2105,6 +2105,21 @@ run_test "Authentication: client no cert, ssl3" \ # The "max_int chain" tests assume that MAX_INTERMEDIATE_CA is set to its # default value (8) + +MAX_IM_CA=8 +MAX_IM_CA_REGEX="#define[[:blank:]]\+MBEDTLS_X509_MAX_INTERMEDIATE_CA" +MAX_IM_CA_REGEX="${MAX_IM_CA_REGEX}[[:blank:]]\+${MAX_IM_CA}[[:blank:]]*$" + +if grep "${MAX_IM_CA_REGEX}" ../include/mbedtls/x509.h > /dev/null; +then :; +else + echo "$(echo 'The tests for long intermediate chains assume the value' \ + ${MAX_IM_CA} 'for MBEDTLS_X509_MAX_INTERMEDIATE_CA.' \ + 'To test other values, please manually adapt the max_int' \ + 'tests in ssl-opt.sh.')" + return +fi + run_test "Authentication: server max_int chain, client default" \ "$P_SRV crt_file=data_files/dir-maxpath/c09.pem \ key_file=data_files/dir-maxpath/09.key" \