From d2c418932a0d77ec56d251b6f72334bca19542db Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Fri, 17 May 2024 11:55:15 +0200 Subject: [PATCH 1/4] ssl-opt.sh, compat.sh: Error out if not executing any tests Alert if all tests are filtered out or skipped: that probably indicates a test script that set up an unintended configuration or an overly strict filter. You can pass `--min 0` to bypass this check. You can pass `--min` with a larger value to require that many test cases to run. Signed-off-by: Gilles Peskine --- tests/compat.sh | 15 +++++++++++++++ tests/ssl-opt.sh | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/tests/compat.sh b/tests/compat.sh index c8c7482f8f0a..b4a3638e3659 100755 --- a/tests/compat.sh +++ b/tests/compat.sh @@ -98,6 +98,7 @@ FILTER="" EXCLUDE='NULL\|DES\|RC4\|ARCFOUR\|ARIA\|CHACHA20-POLY1305' VERBOSE="" MEMCHECK=0 +MIN_TESTS=1 PRESERVE_LOGS=0 PEERS="OpenSSL$PEER_GNUTLS mbedTLS" @@ -118,6 +119,7 @@ print_usage() { printf " -M|--memcheck\tCheck memory leaks and errors.\n" printf " -v|--verbose\tSet verbose output.\n" printf " --list-test-cases\tList all potential test cases (No Execution)\n" + printf " --min \tMinimum number of non-skipped tests (default 1)\n" printf " --outcome-file\tFile where test outcomes are written\n" printf " \t(default: \$MBEDTLS_TEST_OUTCOME_FILE, none if empty)\n" printf " --preserve-logs\tPreserve logs of successful tests as well\n" @@ -213,6 +215,9 @@ get_options() { list_test_cases exit $? ;; + --min) + shift; MIN_TESTS=$1 + ;; --outcome-file) shift; MBEDTLS_TEST_OUTCOME_FILE=$1 ;; @@ -1627,6 +1632,16 @@ fi PASSED=$(( $TESTS - $FAILED )) echo " ($PASSED / $TESTS tests ($SKIPPED skipped$MEMREPORT))" +if [ $((TESTS - SKIPPED)) -lt $MIN_TESTS ]; then + cat < Date: Thu, 30 May 2024 15:14:40 +0200 Subject: [PATCH 2/4] Enable 3DES with GnuTLS With GnuTLS servers, 3DES-CBC cipher suites are enabled by default under our GNUTLS_LEGACY (3.3.8), but disabled by default under more recent versions including the one we use by default on the CI (3.4.6). Even modern versions (I checked 3.7.2) support 3DES if explicitly enabled. So unconditionally enable 3DES-CBC for GnuTLS. Signed-off-by: Gilles Peskine --- tests/compat.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/compat.sh b/tests/compat.sh index b4a3638e3659..1d8dfe487ed2 100755 --- a/tests/compat.sh +++ b/tests/compat.sh @@ -1023,7 +1023,7 @@ setup_arguments() M_SERVER_ARGS="server_port=$PORT server_addr=0.0.0.0 force_version=$MODE arc4=1" O_SERVER_ARGS="-accept $PORT -cipher ALL,COMPLEMENTOFALL -$O_MODE" G_SERVER_ARGS="-p $PORT --http $G_MODE" - G_SERVER_PRIO="NORMAL:${G_PRIO_CCM}+ARCFOUR-128:+NULL:+MD5:+PSK:+DHE-PSK:+ECDHE-PSK:+SHA256:+SHA384:+RSA-PSK:-VERS-TLS-ALL:$G_PRIO_MODE" + G_SERVER_PRIO="NORMAL:${G_PRIO_CCM}+ARCFOUR-128:+3DES-CBC:+NULL:+MD5:+PSK:+DHE-PSK:+ECDHE-PSK:+SHA256:+SHA384:+RSA-PSK:-VERS-TLS-ALL:$G_PRIO_MODE" # The default prime for `openssl s_server` depends on the version: # * OpenSSL <= 1.0.2a: 512-bit From 8f5722a9719ce4870ce55fb88c8c78e926137453 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Thu, 30 May 2024 15:17:28 +0200 Subject: [PATCH 3/4] Fix compat.sh not running any tests on config-mini-tls1_1.h We were only requesting 3DES cipher suites (which is weirdly restrictive since the configuration also includes AES), but DES is in the default exclusion list for compat.sh, so we ended up having no acceptable cipher suites. Fix this. Signed-off-by: Gilles Peskine --- tests/scripts/test-ref-configs.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/scripts/test-ref-configs.pl b/tests/scripts/test-ref-configs.pl index efe716e6a7cc..f29afc54d8d7 100755 --- a/tests/scripts/test-ref-configs.pl +++ b/tests/scripts/test-ref-configs.pl @@ -27,7 +27,8 @@ 'test_again_with_use_psa' => 1 }, 'config-mini-tls1_1.h' => { - 'compat' => '-m tls1_1 -f \'^DES-CBC3-SHA$\|^TLS-RSA-WITH-3DES-EDE-CBC-SHA$\'', #', + # Include DES; exclude (EC)DH; only pure-RSA key exchanges + 'compat' => '-m tls1_1 -e \'NULL\|RC4\|ARCFOUR\|ARIA\|CAMELLIA\|DH\|PSK\' -f RSA', ## Skip ssl-opt testing for now because ssl-opt.sh is missing a lot ## of requires_xxx so it would try to run tests that don't apply. # 'opt' => ' ', From 5a63e2f25fbdeced59b132ea9febd75f18fafbd3 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Fri, 31 May 2024 13:36:55 +0200 Subject: [PATCH 4/4] Select more RSA cipher suites Filtering on cipher suites that have RSA in their name excludes a few old RSA-based cipher suites whose name doesn't contain RSA. Signed-off-by: Gilles Peskine --- tests/scripts/test-ref-configs.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/scripts/test-ref-configs.pl b/tests/scripts/test-ref-configs.pl index f29afc54d8d7..d5b66e0a2da4 100755 --- a/tests/scripts/test-ref-configs.pl +++ b/tests/scripts/test-ref-configs.pl @@ -28,7 +28,7 @@ }, 'config-mini-tls1_1.h' => { # Include DES; exclude (EC)DH; only pure-RSA key exchanges - 'compat' => '-m tls1_1 -e \'NULL\|RC4\|ARCFOUR\|ARIA\|CAMELLIA\|DH\|PSK\' -f RSA', + 'compat' => '-m tls1_1 -e \'NULL\|RC4\|ARCFOUR\|ARIA\|CAMELLIA\|DH\|PSK\' -t RSA', ## Skip ssl-opt testing for now because ssl-opt.sh is missing a lot ## of requires_xxx so it would try to run tests that don't apply. # 'opt' => ' ',