Skip to content

Commit 771fd7d

Browse files
authored
Merge pull request Mbed-TLS#9022 from mpg/compat-fixes-dev
[dev] Small fixes to compat.sh (partial forward-port)
2 parents 87a6d27 + eb86b90 commit 771fd7d

File tree

3 files changed

+54
-42
lines changed

3 files changed

+54
-42
lines changed

tests/compat.sh

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,18 @@ add_mbedtls_ciphersuites()
588588
# o_check_ciphersuite STANDARD_CIPHER_SUITE
589589
o_check_ciphersuite()
590590
{
591-
if [ "${O_SUPPORT_ECDH}" = "NO" ]; then
591+
# skip DTLS when lack of support was declared
592+
if test "$OSSL_NO_DTLS" -gt 0 && is_dtls "$MODE"; then
593+
SKIP_NEXT_="YES"
594+
fi
595+
596+
# skip DTLS 1.2 is support was not detected
597+
if [ "$O_SUPPORT_DTLS12" = "NO" -a "$MODE" = "dtls12" ]; then
598+
SKIP_NEXT="YES"
599+
fi
600+
601+
# skip static ECDH when OpenSSL doesn't support it
602+
if [ "${O_SUPPORT_STATIC_ECDH}" = "NO" ]; then
592603
case "$1" in
593604
*ECDH_*) SKIP_NEXT="YES"
594605
esac
@@ -665,10 +676,25 @@ setup_arguments()
665676
esac
666677

667678
case $($OPENSSL ciphers ALL) in
668-
*ECDH-ECDSA*|*ECDH-RSA*) O_SUPPORT_ECDH="YES";;
669-
*) O_SUPPORT_ECDH="NO";;
679+
*ECDH-ECDSA*|*ECDH-RSA*) O_SUPPORT_STATIC_ECDH="YES";;
680+
*) O_SUPPORT_STATIC_ECDH="NO";;
681+
esac
682+
683+
case $($OPENSSL ciphers ALL) in
684+
*DES-CBC-*) O_SUPPORT_SINGLE_DES="YES";;
685+
*) O_SUPPORT_SINGLE_DES="NO";;
670686
esac
671687

688+
# OpenSSL <1.0.2 doesn't support DTLS 1.2. Check if OpenSSL
689+
# supports -dtls1_2 from the s_server help. (The s_client
690+
# help isn't accurate as of 1.0.2g: it supports DTLS 1.2
691+
# but doesn't list it. But the s_server help seems to be
692+
# accurate.)
693+
O_SUPPORT_DTLS12="NO"
694+
if $OPENSSL s_server -help 2>&1 | grep -q "^ *-dtls1_2 "; then
695+
O_SUPPORT_DTLS12="YES"
696+
fi
697+
672698
if [ "X$VERIFY" = "XYES" ];
673699
then
674700
M_SERVER_ARGS="$M_SERVER_ARGS ca_file=data_files/test-ca_cat12.crt auth_mode=required"
@@ -1109,19 +1135,6 @@ for MODE in $MODES; do
11091135

11101136
[Oo]pen*)
11111137

1112-
if test "$OSSL_NO_DTLS" -gt 0 && is_dtls "$MODE"; then
1113-
continue;
1114-
fi
1115-
1116-
# OpenSSL <1.0.2 doesn't support DTLS 1.2. Check if OpenSSL
1117-
# supports $O_MODE from the s_server help. (The s_client
1118-
# help isn't accurate as of 1.0.2g: it supports DTLS 1.2
1119-
# but doesn't list it. But the s_server help seems to be
1120-
# accurate.)
1121-
if ! $OPENSSL s_server -help 2>&1 | grep -q "^ *-$O_MODE "; then
1122-
continue;
1123-
fi
1124-
11251138
reset_ciphersuites
11261139
add_common_ciphersuites
11271140
add_openssl_ciphersuites

tests/scripts/all.sh

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,14 +1220,19 @@ component_test_full_cmake_gcc_asan () {
12201220
msg "test: main suites (inc. selftests) (full config, ASan build)"
12211221
make test
12221222
1223-
msg "test: selftest (ASan build)" # ~ 10s
1223+
msg "test: selftest (full config, ASan build)" # ~ 10s
12241224
programs/test/selftest
12251225
12261226
msg "test: ssl-opt.sh (full config, ASan build)"
12271227
tests/ssl-opt.sh
12281228
1229-
msg "test: compat.sh (full config, ASan build)"
1230-
tests/compat.sh
1229+
# Note: the next two invocations cover all compat.sh test cases.
1230+
# We should use the same here and in basic-build-test.sh.
1231+
msg "test: compat.sh: default version (full config, ASan build)"
1232+
tests/compat.sh -e 'ARIA\|CHACHA'
1233+
1234+
msg "test: compat.sh: next: ARIA, Chacha (full config, ASan build)"
1235+
env OPENSSL="$OPENSSL_NEXT" tests/compat.sh -e '^$' -f 'ARIA\|CHACHA'
12311236
12321237
msg "test: context-info.sh (full config, ASan build)" # ~ 15 sec
12331238
tests/context-info.sh
@@ -1241,19 +1246,24 @@ component_test_full_cmake_gcc_asan_new_bignum () {
12411246
CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
12421247
make
12431248
1244-
msg "test: main suites (inc. selftests) (full config, ASan build)"
1249+
msg "test: main suites (inc. selftests) (full config, new bignum, ASan)"
12451250
make test
12461251
1247-
msg "test: selftest (ASan build)" # ~ 10s
1252+
msg "test: selftest (full config, new bignum, ASan)" # ~ 10s
12481253
programs/test/selftest
12491254
1250-
msg "test: ssl-opt.sh (full config, ASan build)"
1255+
msg "test: ssl-opt.sh (full config, new bignum, ASan)"
12511256
tests/ssl-opt.sh
12521257
1253-
msg "test: compat.sh (full config, ASan build)"
1254-
tests/compat.sh
1258+
# Note: the next two invocations cover all compat.sh test cases.
1259+
# We should use the same here and in basic-build-test.sh.
1260+
msg "test: compat.sh: default version (full config, new bignum, ASan)"
1261+
tests/compat.sh -e 'ARIA\|CHACHA'
12551262
1256-
msg "test: context-info.sh (full config, ASan build)" # ~ 15 sec
1263+
msg "test: compat.sh: next: ARIA, Chacha (full config, new bignum, ASan)"
1264+
env OPENSSL="$OPENSSL_NEXT" tests/compat.sh -e '^$' -f 'ARIA\|CHACHA'
1265+
1266+
msg "test: context-info.sh (full config, new bignum, ASan)" # ~ 15 sec
12571267
tests/context-info.sh
12581268
}
12591269
@@ -2171,12 +2181,6 @@ component_test_full_cmake_clang () {
21712181
21722182
msg "test: ssl-opt.sh default, ECJPAKE, SSL async (full config)" # ~ 1s
21732183
tests/ssl-opt.sh -f 'Default\|ECJPAKE\|SSL async private'
2174-
2175-
msg "test: compat.sh NULL (full config)" # ~ 2 min
2176-
tests/compat.sh -e '^$' -f 'NULL'
2177-
2178-
msg "test: compat.sh ARIA + ChachaPoly"
2179-
env OPENSSL="$OPENSSL_NEXT" tests/compat.sh -e '^$' -f 'ARIA\|CHACHA'
21802184
}
21812185
21822186
skip_suites_without_constant_flow () {
@@ -2620,13 +2624,12 @@ component_test_no_psa_crypto_full_cmake_asan() {
26202624
msg "test: ssl-opt.sh (full minus PSA crypto)"
26212625
tests/ssl-opt.sh
26222626
2623-
msg "test: compat.sh default (full minus PSA crypto)"
2624-
tests/compat.sh
2625-
2626-
msg "test: compat.sh NULL (full minus PSA crypto)"
2627-
tests/compat.sh -f 'NULL'
2627+
# Note: the next two invocations cover all compat.sh test cases.
2628+
# We should use the same here and in basic-build-test.sh.
2629+
msg "test: compat.sh: default version (full minus PSA crypto)"
2630+
tests/compat.sh -e 'ARIA\|CHACHA'
26282631
2629-
msg "test: compat.sh ARIA + ChachaPoly (full minus PSA crypto)"
2632+
msg "test: compat.sh: next: ARIA, Chacha (full minus PSA crypto)"
26302633
env OPENSSL="$OPENSSL_NEXT" tests/compat.sh -e '^$' -f 'ARIA\|CHACHA'
26312634
}
26322635

tests/scripts/basic-build-test.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,7 @@ echo
103103
echo '################ compat.sh ################'
104104
{
105105
echo '#### compat.sh: Default versions'
106-
sh compat.sh
107-
echo
108-
109-
echo '#### compat.sh: null cipher'
110-
sh compat.sh -e '^$' -f 'NULL'
106+
sh compat.sh -e 'ARIA\|CHACHA'
111107
echo
112108

113109
echo '#### compat.sh: next (ARIA, ChaCha)'

0 commit comments

Comments
 (0)