mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-23 06:01:11 +00:00
Prepare to generalize maybe_requires_ciphersuite_enabled
Rename maybe_requires_ciphersuite_enabled() to detect_required_features() and refactor its code a little. No intended behavior change. In subsequent commits, this function will detect other requirements in a similar way. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
e70605c28e
commit
511fdf435f
|
@ -271,31 +271,24 @@ requires_ciphersuite_enabled() {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# maybe_requires_ciphersuite_enabled CMD [RUN_TEST_OPTION...]
|
# detect_required_features CMD [RUN_TEST_OPTION...]
|
||||||
# If CMD (call to a TLS client or server program) requires a specific
|
# If CMD (call to a TLS client or server program) requires certain features,
|
||||||
# ciphersuite, arrange to only run the test case if this ciphersuite is
|
# arrange to only run the following test case if those features are enabled.
|
||||||
# enabled. As an exception, do run the test case if it expects a ciphersuite
|
detect_required_features() {
|
||||||
# mismatch.
|
|
||||||
maybe_requires_ciphersuite_enabled() {
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
*\ force_ciphersuite=*) :;;
|
*\ force_ciphersuite=*)
|
||||||
*) return;; # No specific required ciphersuite
|
tmp="${1##*\ force_ciphersuite=}"
|
||||||
esac
|
tmp="${tmp%%[!-0-9A-Z_a-z]*}"
|
||||||
ciphersuite="${1##*\ force_ciphersuite=}"
|
case "$*" in
|
||||||
ciphersuite="${ciphersuite%%[!-0-9A-Z_a-z]*}"
|
*"-s SSL - The server has no ciphersuites in common"*)
|
||||||
shift
|
# This test case expects a ciphersuite mismatch, so it
|
||||||
|
# doesn't actually require the ciphersuite to be enabled.
|
||||||
case "$*" in
|
:;;
|
||||||
*"-s SSL - The server has no ciphersuites in common"*)
|
*) requires_ciphersuite_enabled "$tmp";;
|
||||||
# This test case expects a ciphersuite mismatch, so it doesn't
|
esac;;
|
||||||
# require the ciphersuite to be enabled.
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
requires_ciphersuite_enabled "$ciphersuite"
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
unset ciphersuite
|
unset tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
requires_certificate_authentication () {
|
requires_certificate_authentication () {
|
||||||
|
@ -1190,9 +1183,10 @@ run_test() {
|
||||||
requires_config_enabled MBEDTLS_SSL_ALPN;;
|
requires_config_enabled MBEDTLS_SSL_ALPN;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# If the client or serve requires a ciphersuite, check that it's enabled.
|
# If the client or server requires certain features that can be detected
|
||||||
maybe_requires_ciphersuite_enabled "$SRV_CMD" "$@"
|
# from their command-line arguments, check that they're enabled.
|
||||||
maybe_requires_ciphersuite_enabled "$CLI_CMD" "$@"
|
detect_required_features "$SRV_CMD" "$@"
|
||||||
|
detect_required_features "$CLI_CMD" "$@"
|
||||||
|
|
||||||
# If we're in a PSK-only build and the test can be adapted to PSK, do that.
|
# If we're in a PSK-only build and the test can be adapted to PSK, do that.
|
||||||
maybe_adapt_for_psk "$@"
|
maybe_adapt_for_psk "$@"
|
||||||
|
|
Loading…
Reference in a new issue