mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-11-10 07:10:12 +08:00
Move repetitive equality check to requires_config_value_equals
Signed-off-by: Yuto Takano <yuto.takano@arm.com>
This commit is contained in:
parent
8df2d25ebc
commit
bc632c23f0
@ -248,6 +248,17 @@ requires_config_value_at_most() {
|
||||
fi
|
||||
}
|
||||
|
||||
requires_config_value_equals() {
|
||||
VAL=$( get_config_value_or_default "$1" )
|
||||
if [ -z "$VAL" ]; then
|
||||
# Should never happen
|
||||
echo "Mbed TLS configuration $1 is not defined"
|
||||
exit 1
|
||||
elif [ "$VAL" -ne "$2" ]; then
|
||||
SKIP_NEXT="YES"
|
||||
fi
|
||||
}
|
||||
|
||||
# skip next test if OpenSSL doesn't support FALLBACK_SCSV
|
||||
requires_openssl_with_fallback_scsv() {
|
||||
if [ -z "${OPENSSL_HAS_FBSCSV:-}" ]; then
|
||||
@ -2885,8 +2896,7 @@ MAX_IM_CA='8'
|
||||
# because only a chain of MAX_IM_CA length is tested. Equally, the max_int+1
|
||||
# tests can pass with any number less than MAX_IM_CA. However, stricter preconditions
|
||||
# are in place so that the semantics are consistent with the test description.
|
||||
requires_config_value_at_least "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
|
||||
requires_config_value_at_most "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
|
||||
requires_config_value_equals "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
|
||||
requires_full_size_output_buffer
|
||||
run_test "Authentication: server max_int chain, client default" \
|
||||
"$P_SRV crt_file=data_files/dir-maxpath/c09.pem \
|
||||
@ -2895,8 +2905,7 @@ run_test "Authentication: server max_int chain, client default" \
|
||||
0 \
|
||||
-C "X509 - A fatal error occurred"
|
||||
|
||||
requires_config_value_at_least "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
|
||||
requires_config_value_at_most "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
|
||||
requires_config_value_equals "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
|
||||
requires_full_size_output_buffer
|
||||
run_test "Authentication: server max_int+1 chain, client default" \
|
||||
"$P_SRV crt_file=data_files/dir-maxpath/c10.pem \
|
||||
@ -2905,8 +2914,7 @@ run_test "Authentication: server max_int+1 chain, client default" \
|
||||
1 \
|
||||
-c "X509 - A fatal error occurred"
|
||||
|
||||
requires_config_value_at_least "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
|
||||
requires_config_value_at_most "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
|
||||
requires_config_value_equals "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
|
||||
requires_full_size_output_buffer
|
||||
run_test "Authentication: server max_int+1 chain, client optional" \
|
||||
"$P_SRV crt_file=data_files/dir-maxpath/c10.pem \
|
||||
@ -2916,8 +2924,7 @@ run_test "Authentication: server max_int+1 chain, client optional" \
|
||||
1 \
|
||||
-c "X509 - A fatal error occurred"
|
||||
|
||||
requires_config_value_at_least "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
|
||||
requires_config_value_at_most "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
|
||||
requires_config_value_equals "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
|
||||
requires_full_size_output_buffer
|
||||
run_test "Authentication: server max_int+1 chain, client none" \
|
||||
"$P_SRV crt_file=data_files/dir-maxpath/c10.pem \
|
||||
@ -2927,8 +2934,7 @@ run_test "Authentication: server max_int+1 chain, client none" \
|
||||
0 \
|
||||
-C "X509 - A fatal error occurred"
|
||||
|
||||
requires_config_value_at_least "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
|
||||
requires_config_value_at_most "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
|
||||
requires_config_value_equals "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
|
||||
requires_full_size_output_buffer
|
||||
run_test "Authentication: client max_int+1 chain, server default" \
|
||||
"$P_SRV ca_file=data_files/dir-maxpath/00.crt" \
|
||||
@ -2937,8 +2943,7 @@ run_test "Authentication: client max_int+1 chain, server default" \
|
||||
0 \
|
||||
-S "X509 - A fatal error occurred"
|
||||
|
||||
requires_config_value_at_least "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
|
||||
requires_config_value_at_most "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
|
||||
requires_config_value_equals "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
|
||||
requires_full_size_output_buffer
|
||||
run_test "Authentication: client max_int+1 chain, server optional" \
|
||||
"$P_SRV ca_file=data_files/dir-maxpath/00.crt auth_mode=optional" \
|
||||
@ -2947,8 +2952,7 @@ run_test "Authentication: client max_int+1 chain, server optional" \
|
||||
1 \
|
||||
-s "X509 - A fatal error occurred"
|
||||
|
||||
requires_config_value_at_least "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
|
||||
requires_config_value_at_most "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
|
||||
requires_config_value_equals "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
|
||||
requires_full_size_output_buffer
|
||||
run_test "Authentication: client max_int+1 chain, server required" \
|
||||
"$P_SRV ca_file=data_files/dir-maxpath/00.crt auth_mode=required" \
|
||||
@ -2957,8 +2961,7 @@ run_test "Authentication: client max_int+1 chain, server required" \
|
||||
1 \
|
||||
-s "X509 - A fatal error occurred"
|
||||
|
||||
requires_config_value_at_least "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
|
||||
requires_config_value_at_most "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
|
||||
requires_config_value_equals "MBEDTLS_X509_MAX_INTERMEDIATE_CA" $MAX_IM_CA
|
||||
requires_full_size_output_buffer
|
||||
run_test "Authentication: client max_int chain, server required" \
|
||||
"$P_SRV ca_file=data_files/dir-maxpath/00.crt auth_mode=required" \
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user