Let ssl-opt.sh gracefully fail is SSL_MAX_CONTENT_LEN is not 16384

Some tests in ssl-opt.sh require MBEDTLS_SSL_MAX_CONTENT_LEN to be set to its
default value of 16384 to succeed. While ideally such a dependency should not
exist, as a short-term remedy this commit adds a small check that will at least
lead to graceful exit if that assumption is violated.
This commit is contained in:
Hanno Becker 2017-09-22 16:58:50 +01:00
parent b658ee63c2
commit 64691dc3fc

View File

@ -1218,6 +1218,21 @@ run_test "Session resume using cache: openssl server" \
# Tests for Max Fragment Length extension # Tests for Max Fragment Length extension
MAX_CONTENT_LEN_EXPECT='16384'
MAX_CONTENT_LEN_CONFIG=$( ../scripts/config.pl get MBEDTLS_SSL_MAX_CONTENT_LEN)
if [ -n "$MAX_CONTENT_LEN_CONFIG" ] && [ "$MAX_CONTENT_LEN_CONFIG" -ne "$MAX_CONTENT_LEN_EXPECT" ]; then
printf "The ${CONFIG_H} file contains a value for the configuration of\n"
printf "MBEDTLS_SSL_MAX_CONTENT_LEN that is different from the scripts\n"
printf "test value of ${MAX_CONTENT_LEN_EXPECT}. \n"
printf "\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"
exit 1
fi
requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
run_test "Max fragment length: enabled, default" \ run_test "Max fragment length: enabled, default" \
"$P_SRV debug_level=3" \ "$P_SRV debug_level=3" \