Test ssl_client1
Test ssl_client1 with both TLS 1.2 and TLS 1.3.
Test against both OpenSSL and GnuTLS.
Clean up compile-time requirements in ssl_client1.c: any certificate-based
key exchange is ok, so don't insist on built-in RSA.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
diff --git a/tests/opt-testcases/sample.sh b/tests/opt-testcases/sample.sh
index 05db6b8..88bee47 100644
--- a/tests/opt-testcases/sample.sh
+++ b/tests/opt-testcases/sample.sh
@@ -4,3 +4,45 @@
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
: ${PROGRAMS_DIR:=../programs/ssl}
+
+requires_protocol_version tls12
+run_test "Sample: ssl_client1, openssl server, TLS 1.2" \
+ -P 4433 \
+ "$O_SRV -tls1_2" \
+ "$PROGRAMS_DIR/ssl_client1" \
+ 0 \
+ -c "New, TLSv1.2, Cipher is" \
+ -S "ERROR" \
+ -C "error"
+
+requires_protocol_version tls12
+run_test "Sample: ssl_client1, gnutls server, TLS 1.2" \
+ -P 4433 \
+ "$G_SRV --priority=NORMAL:-VERS-TLS-ALL:+VERS-TLS1.2" \
+ "$PROGRAMS_DIR/ssl_client1" \
+ 0 \
+ -s "Version: TLS1.2" \
+ -c "<TD>Protocol version:</TD><TD>TLS1.2</TD>" \
+ -S "Error" \
+ -C "error"
+
+requires_protocol_version tls13
+run_test "Sample: ssl_client1, openssl server, TLS 1.3" \
+ -P 4433 \
+ "$O_SRV -tls1_3" \
+ "$PROGRAMS_DIR/ssl_client1" \
+ 0 \
+ -c "New, TLSv1.3, Cipher is" \
+ -S "ERROR" \
+ -C "error"
+
+requires_protocol_version tls13
+run_test "Sample: ssl_client1, gnutls server, TLS 1.3" \
+ -P 4433 \
+ "$G_SRV --priority=NORMAL:-VERS-TLS-ALL:+VERS-TLS1.3" \
+ "$PROGRAMS_DIR/ssl_client1" \
+ 0 \
+ -s "Version: TLS1.3" \
+ -c "<TD>Protocol version:</TD><TD>TLS1.3</TD>" \
+ -S "Error" \
+ -C "error"