mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-27 00:05:44 +01:00
Remove hard exit in ssh-opt.sh, replace with requires
functions
- Replace calls to config.py for MAX_IN_LEN and MAX_OUT_LEN with `get_config_value_or_default` - Remove hard exit when MAX_IN/OUT_LEN < 4096, replace with `requires_config_value_at_least` Signed-off-by: Yuto Takano <yuto.takano@arm.com>
This commit is contained in:
parent
8de3633c65
commit
18ddccc417
@ -374,10 +374,11 @@ requires_not_i686() {
|
||||
}
|
||||
|
||||
# Calculate the input & output maximum content lengths set in the config
|
||||
MAX_CONTENT_LEN=$( ../scripts/config.py get MBEDTLS_SSL_MAX_CONTENT_LEN || echo "16384")
|
||||
MAX_IN_LEN=$( ../scripts/config.py get MBEDTLS_SSL_IN_CONTENT_LEN || echo "$MAX_CONTENT_LEN")
|
||||
MAX_OUT_LEN=$( ../scripts/config.py get MBEDTLS_SSL_OUT_CONTENT_LEN || echo "$MAX_CONTENT_LEN")
|
||||
MAX_CONTENT_LEN=$(get_config_value_or_default "MBEDTLS_SSL_MAX_CONTENT_LEN")
|
||||
MAX_IN_LEN=$(get_config_value_or_default "MBEDTLS_SSL_IN_CONTENT_LEN")
|
||||
MAX_OUT_LEN=$(get_config_value_or_default "MBEDTLS_SSL_OUT_CONTENT_LEN")
|
||||
|
||||
# Calculate the maximum content length that fits both
|
||||
if [ "$MAX_IN_LEN" -lt "$MAX_CONTENT_LEN" ]; then
|
||||
MAX_CONTENT_LEN="$MAX_IN_LEN"
|
||||
fi
|
||||
@ -3151,13 +3152,8 @@ run_test "Session resume using cache, DTLS: openssl server" \
|
||||
|
||||
# Tests for Max Fragment Length extension
|
||||
|
||||
if [ "$MAX_CONTENT_LEN" -lt "4096" ]; then
|
||||
printf '%s defines MBEDTLS_SSL_MAX_CONTENT_LEN to be less than 4096. Fragment length tests will fail.\n' "${CONFIG_H}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $MAX_CONTENT_LEN -ne 16384 ]; then
|
||||
echo "Using non-default maximum content length $MAX_CONTENT_LEN"
|
||||
echo "Using non-default maximum content length $MAX_CONTENT_LEN instead of 16384 "
|
||||
fi
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
@ -3224,7 +3220,7 @@ run_test "Max fragment length: disabled, larger message" \
|
||||
-s "1 bytes read"
|
||||
|
||||
requires_config_disabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
run_test "Max fragment length DTLS: disabled, larger message" \
|
||||
run_test "Max fragment length, DTLS: disabled, larger message" \
|
||||
"$P_SRV debug_level=3 dtls=1" \
|
||||
"$P_CLI debug_level=3 dtls=1 request_size=$(( $MAX_CONTENT_LEN + 1))" \
|
||||
1 \
|
||||
@ -3234,6 +3230,9 @@ run_test "Max fragment length DTLS: disabled, larger message" \
|
||||
-S "Maximum output fragment length is 16384" \
|
||||
-c "fragment larger than.*maximum "
|
||||
|
||||
# Make sure it was compiled with lengths over 4096
|
||||
requires_config_value_at_least "MBEDTLS_SSL_IN_CONTENT_LEN" 4096
|
||||
requires_config_value_at_least "MBEDTLS_SSL_OUT_CONTENT_LEN" 4096
|
||||
requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
run_test "Max fragment length: used by client" \
|
||||
"$P_SRV debug_level=3" \
|
||||
@ -3248,6 +3247,8 @@ run_test "Max fragment length: used by client" \
|
||||
-s "server hello, max_fragment_length extension" \
|
||||
-c "found max_fragment_length extension"
|
||||
|
||||
requires_config_value_at_least "MBEDTLS_SSL_IN_CONTENT_LEN" 1024
|
||||
requires_config_value_at_least "MBEDTLS_SSL_OUT_CONTENT_LEN" 1024
|
||||
requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
run_test "Max fragment length: client 512, server 1024" \
|
||||
"$P_SRV debug_level=3 max_frag_len=1024" \
|
||||
@ -3262,6 +3263,8 @@ run_test "Max fragment length: client 512, server 1024" \
|
||||
-s "server hello, max_fragment_length extension" \
|
||||
-c "found max_fragment_length extension"
|
||||
|
||||
requires_config_value_at_least "MBEDTLS_SSL_IN_CONTENT_LEN" 2048
|
||||
requires_config_value_at_least "MBEDTLS_SSL_OUT_CONTENT_LEN" 2048
|
||||
requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
run_test "Max fragment length: client 512, server 2048" \
|
||||
"$P_SRV debug_level=3 max_frag_len=2048" \
|
||||
@ -3276,6 +3279,8 @@ run_test "Max fragment length: client 512, server 2048" \
|
||||
-s "server hello, max_fragment_length extension" \
|
||||
-c "found max_fragment_length extension"
|
||||
|
||||
requires_config_value_at_least "MBEDTLS_SSL_IN_CONTENT_LEN" 4096
|
||||
requires_config_value_at_least "MBEDTLS_SSL_OUT_CONTENT_LEN" 4096
|
||||
requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
run_test "Max fragment length: client 512, server 4096" \
|
||||
"$P_SRV debug_level=3 max_frag_len=4096" \
|
||||
@ -3290,6 +3295,8 @@ run_test "Max fragment length: client 512, server 4096" \
|
||||
-s "server hello, max_fragment_length extension" \
|
||||
-c "found max_fragment_length extension"
|
||||
|
||||
requires_config_value_at_least "MBEDTLS_SSL_IN_CONTENT_LEN" 1024
|
||||
requires_config_value_at_least "MBEDTLS_SSL_OUT_CONTENT_LEN" 1024
|
||||
requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
run_test "Max fragment length: client 1024, server 512" \
|
||||
"$P_SRV debug_level=3 max_frag_len=512" \
|
||||
@ -3304,6 +3311,8 @@ run_test "Max fragment length: client 1024, server 512" \
|
||||
-s "server hello, max_fragment_length extension" \
|
||||
-c "found max_fragment_length extension"
|
||||
|
||||
requires_config_value_at_least "MBEDTLS_SSL_IN_CONTENT_LEN" 2048
|
||||
requires_config_value_at_least "MBEDTLS_SSL_OUT_CONTENT_LEN" 2048
|
||||
requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
run_test "Max fragment length: client 1024, server 2048" \
|
||||
"$P_SRV debug_level=3 max_frag_len=2048" \
|
||||
@ -3318,6 +3327,8 @@ run_test "Max fragment length: client 1024, server 2048" \
|
||||
-s "server hello, max_fragment_length extension" \
|
||||
-c "found max_fragment_length extension"
|
||||
|
||||
requires_config_value_at_least "MBEDTLS_SSL_IN_CONTENT_LEN" 4096
|
||||
requires_config_value_at_least "MBEDTLS_SSL_OUT_CONTENT_LEN" 4096
|
||||
requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
run_test "Max fragment length: client 1024, server 4096" \
|
||||
"$P_SRV debug_level=3 max_frag_len=4096" \
|
||||
@ -3332,6 +3343,8 @@ run_test "Max fragment length: client 1024, server 4096" \
|
||||
-s "server hello, max_fragment_length extension" \
|
||||
-c "found max_fragment_length extension"
|
||||
|
||||
requires_config_value_at_least "MBEDTLS_SSL_IN_CONTENT_LEN" 2048
|
||||
requires_config_value_at_least "MBEDTLS_SSL_OUT_CONTENT_LEN" 2048
|
||||
requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
run_test "Max fragment length: client 2048, server 512" \
|
||||
"$P_SRV debug_level=3 max_frag_len=512" \
|
||||
@ -3346,6 +3359,8 @@ run_test "Max fragment length: client 2048, server 512" \
|
||||
-s "server hello, max_fragment_length extension" \
|
||||
-c "found max_fragment_length extension"
|
||||
|
||||
requires_config_value_at_least "MBEDTLS_SSL_IN_CONTENT_LEN" 2048
|
||||
requires_config_value_at_least "MBEDTLS_SSL_OUT_CONTENT_LEN" 2048
|
||||
requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
run_test "Max fragment length: client 2048, server 1024" \
|
||||
"$P_SRV debug_level=3 max_frag_len=1024" \
|
||||
@ -3360,6 +3375,8 @@ run_test "Max fragment length: client 2048, server 1024" \
|
||||
-s "server hello, max_fragment_length extension" \
|
||||
-c "found max_fragment_length extension"
|
||||
|
||||
requires_config_value_at_least "MBEDTLS_SSL_IN_CONTENT_LEN" 4096
|
||||
requires_config_value_at_least "MBEDTLS_SSL_OUT_CONTENT_LEN" 4096
|
||||
requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
run_test "Max fragment length: client 2048, server 4096" \
|
||||
"$P_SRV debug_level=3 max_frag_len=4096" \
|
||||
@ -3374,6 +3391,8 @@ run_test "Max fragment length: client 2048, server 4096" \
|
||||
-s "server hello, max_fragment_length extension" \
|
||||
-c "found max_fragment_length extension"
|
||||
|
||||
requires_config_value_at_least "MBEDTLS_SSL_IN_CONTENT_LEN" 4096
|
||||
requires_config_value_at_least "MBEDTLS_SSL_OUT_CONTENT_LEN" 4096
|
||||
requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
run_test "Max fragment length: client 4096, server 512" \
|
||||
"$P_SRV debug_level=3 max_frag_len=512" \
|
||||
@ -3388,6 +3407,8 @@ run_test "Max fragment length: client 4096, server 512" \
|
||||
-s "server hello, max_fragment_length extension" \
|
||||
-c "found max_fragment_length extension"
|
||||
|
||||
requires_config_value_at_least "MBEDTLS_SSL_IN_CONTENT_LEN" 4096
|
||||
requires_config_value_at_least "MBEDTLS_SSL_OUT_CONTENT_LEN" 4096
|
||||
requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
run_test "Max fragment length: client 4096, server 1024" \
|
||||
"$P_SRV debug_level=3 max_frag_len=1024" \
|
||||
@ -3402,6 +3423,8 @@ run_test "Max fragment length: client 4096, server 1024" \
|
||||
-s "server hello, max_fragment_length extension" \
|
||||
-c "found max_fragment_length extension"
|
||||
|
||||
requires_config_value_at_least "MBEDTLS_SSL_IN_CONTENT_LEN" 4096
|
||||
requires_config_value_at_least "MBEDTLS_SSL_OUT_CONTENT_LEN" 4096
|
||||
requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
run_test "Max fragment length: client 4096, server 2048" \
|
||||
"$P_SRV debug_level=3 max_frag_len=2048" \
|
||||
@ -3416,6 +3439,8 @@ run_test "Max fragment length: client 4096, server 2048" \
|
||||
-s "server hello, max_fragment_length extension" \
|
||||
-c "found max_fragment_length extension"
|
||||
|
||||
requires_config_value_at_least "MBEDTLS_SSL_IN_CONTENT_LEN" 4096
|
||||
requires_config_value_at_least "MBEDTLS_SSL_OUT_CONTENT_LEN" 4096
|
||||
requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
run_test "Max fragment length: used by server" \
|
||||
"$P_SRV debug_level=3 max_frag_len=4096" \
|
||||
@ -3430,6 +3455,8 @@ run_test "Max fragment length: used by server" \
|
||||
-S "server hello, max_fragment_length extension" \
|
||||
-C "found max_fragment_length extension"
|
||||
|
||||
requires_config_value_at_least "MBEDTLS_SSL_IN_CONTENT_LEN" 4096
|
||||
requires_config_value_at_least "MBEDTLS_SSL_OUT_CONTENT_LEN" 4096
|
||||
requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
requires_gnutls
|
||||
run_test "Max fragment length: gnutls server" \
|
||||
@ -3441,6 +3468,8 @@ run_test "Max fragment length: gnutls server" \
|
||||
-c "client hello, adding max_fragment_length extension" \
|
||||
-c "found max_fragment_length extension"
|
||||
|
||||
requires_config_value_at_least "MBEDTLS_SSL_IN_CONTENT_LEN" 2048
|
||||
requires_config_value_at_least "MBEDTLS_SSL_OUT_CONTENT_LEN" 2048
|
||||
requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
run_test "Max fragment length: client, message just fits" \
|
||||
"$P_SRV debug_level=3" \
|
||||
@ -3457,6 +3486,8 @@ run_test "Max fragment length: client, message just fits" \
|
||||
-c "2048 bytes written in 1 fragments" \
|
||||
-s "2048 bytes read"
|
||||
|
||||
requires_config_value_at_least "MBEDTLS_SSL_IN_CONTENT_LEN" 2048
|
||||
requires_config_value_at_least "MBEDTLS_SSL_OUT_CONTENT_LEN" 2048
|
||||
requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
run_test "Max fragment length: client, larger message" \
|
||||
"$P_SRV debug_level=3" \
|
||||
@ -3474,6 +3505,8 @@ run_test "Max fragment length: client, larger message" \
|
||||
-s "2048 bytes read" \
|
||||
-s "297 bytes read"
|
||||
|
||||
requires_config_value_at_least "MBEDTLS_SSL_IN_CONTENT_LEN" 2048
|
||||
requires_config_value_at_least "MBEDTLS_SSL_OUT_CONTENT_LEN" 2048
|
||||
requires_config_enabled MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
run_test "Max fragment length: DTLS client, larger message" \
|
||||
"$P_SRV debug_level=3 dtls=1" \
|
||||
|
Loading…
Reference in New Issue
Block a user