Fix the check for max CA intermediates in ssl-opt.sh

The tests only work for a specific number for MBEDTLS_X509_MAX_INTERMEDIATE_CA
so the check has been changed to confirm the default value, and to show an error
otherwise.
This commit is contained in:
Simon Butcher 2017-07-28 15:59:35 +01:00
parent 9e24b5184c
commit f145a9dac2

View file

@ -2106,22 +2106,17 @@ 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:='19'}
MAX_IM_CA='8'
MAX_IM_CA_CONFIG=$( ../scripts/config.pl get MBEDTLS_X509_MAX_INTERMEDIATE_CA)
if [ -n "$MAX_IM_CA_CONFIG" ] && [ "$MAX_IM_CA_CONFIG" -gt "$MAX_IM_CA" ]; then
if [ -n "$MAX_IM_CA_CONFIG" ] && [ "$MAX_IM_CA_CONFIG" -ne "$MAX_IM_CA" ]; then
printf "The ${CONFIG_H} file contains a value for the configuration of\n"
printf "MBEDTLS_X509_MAX_INTERMEDIATE_CA that is greater than the scripts\n"
printf "MBEDTLS_X509_MAX_INTERMEDIATE_CA that is different from the scripts\n"
printf "test value of ${MAX_IM_CA}. \n"
printf "\n"
printf "By default, this value cannot be higher as there are insufficient\n"
printf "test certificate files available to test with.\n"
printf "The tests assume this value and if it changes, the tests in this\n"
printf "script should also be adjusted.\n"
printf "\n"
printf "To generate additional test certificates use the script:\n"
printf " tests/data_files/dir-maxpath/long.sh\n"
printf "\n"
printf "To test using an alternative value, please set the environment variable\n"
printf "MAX_IM_CA or change the default value in the script tests/ssl-opt.sh.\n"
exit 1
fi