From 0be5ca530905273d52baace4be4b68ff73fb1b56 Mon Sep 17 00:00:00 2001 From: David Cooper Date: Fri, 8 Apr 2022 10:09:30 -0400 Subject: [PATCH] Support DHE/ECDHE servers with uncommon curves When running in --ssl-native mode, run_fs() will not detect ECDHE ciphers if the server supports both DHE and ECDHE ciphers and the ECDHE ciphers are only supported with curves that are not offered by $OPENSSL by default. This commit fixes this by adding extra connection attempts with the -curves parameter explicitly provided. --- testssl.sh | 47 ++++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/testssl.sh b/testssl.sh index 5985c6a..1a22865 100755 --- a/testssl.sh +++ b/testssl.sh @@ -10323,28 +10323,26 @@ run_fs() { fileout "$jsonID" "WARN" "tests skipped as you only have $nr_supported_ciphers FS ciphers on the client site. ($CLIENT_MIN_FS are required)" return 1 fi + # By default, OpenSSL 1.1.1 and above only include a few curves in the ClientHello, so in order + # to test all curves, the -curves option must be added. In addition, OpenSSL limits the number of + # curves that can be specified to 28. So, if more than 28 curves are supported, then the curves must + # be tested in batches. + curves_list1="$(strip_trailing_space "$(strip_leading_space "$OSSL_SUPPORTED_CURVES")")" + curves_list1="${curves_list1// / }" + if [[ "$(count_words "$OSSL_SUPPORTED_CURVES")" -gt 28 ]]; then + # Place the first 28 supported curves in curves_list1 and the remainder in curves_list2. + curves_list2="${curves_list1#* * * * * * * * * * * * * * * * * * * * * * * * * * * * }" + curves_list1="${curves_list1%$curves_list2}" + curves_list1="$(strip_trailing_space "$curves_list1")" + curves_list2="${curves_list2// /:}" + fi + curves_list1="${curves_list1// /:}" $OPENSSL s_client $(s_client_options "-cipher $fs_cipher_list -ciphersuites ALL $STARTTLS $BUGS -connect $NODEIP:$PORT $PROXY $SNI") >$TMPFILE 2>$ERRFILE $TMPFILE 2>$ERRFILE $TMPFILE $TMPFILE