summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbeck <>2023-07-02 17:21:33 +0000
committerbeck <>2023-07-02 17:21:33 +0000
commitddcb4efd6551a982bf29b2e8e83c9c808a1670dc (patch)
tree33bb9f6c1c9fd44a8c7064445713f67f9fe0b371 /src
parent025f3b8ef1e0ff3017dd0079925fbf85f15a6d22 (diff)
downloadopenbsd-ddcb4efd6551a982bf29b2e8e83c9c808a1670dc.tar.gz
openbsd-ddcb4efd6551a982bf29b2e8e83c9c808a1670dc.tar.bz2
openbsd-ddcb4efd6551a982bf29b2e8e83c9c808a1670dc.zip
Disable TLS 1.0 and TLS 1.1 in libssl
Their time has long since past, and they should not be used. This change restricts ssl to versions 1.2 and 1.3, and changes the regression tests to understand we no longer speak the legacy protocols. For the moment the magical "golden" byte for byte comparison tests of raw handshake values are disabled util jsing fixes them. ok jsing@ tb@
Diffstat (limited to 'src')
-rw-r--r--src/lib/libssl/s3_lib.c4
-rw-r--r--src/lib/libssl/ssl_versions.c12
-rw-r--r--src/regress/lib/libssl/Makefile6
-rw-r--r--src/regress/lib/libssl/interop/version/Makefile4
-rw-r--r--src/regress/lib/libssl/ssl/ssltest.c16
-rw-r--r--src/regress/lib/libssl/ssl/testssl36
-rw-r--r--src/regress/lib/libssl/tls/tlstest.c78
-rw-r--r--src/regress/lib/libssl/tlsfuzzer/tlsfuzzer.py43
-rw-r--r--src/regress/lib/libssl/unit/ssl_versions.c68
9 files changed, 106 insertions, 161 deletions
diff --git a/src/lib/libssl/s3_lib.c b/src/lib/libssl/s3_lib.c
index 37ca7bd113..7561060120 100644
--- a/src/lib/libssl/s3_lib.c
+++ b/src/lib/libssl/s3_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s3_lib.c,v 1.244 2023/05/26 13:44:05 tb Exp $ */ 1/* $OpenBSD: s3_lib.c,v 1.245 2023/07/02 17:21:32 beck Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -1672,7 +1672,7 @@ ssl3_clear(SSL *s)
1672 s->s3->in_read_app_data = 0; 1672 s->s3->in_read_app_data = 0;
1673 1673
1674 s->packet_length = 0; 1674 s->packet_length = 0;
1675 s->version = TLS1_VERSION; 1675 s->version = TLS1_2_VERSION;
1676 1676
1677 s->s3->hs.state = SSL_ST_BEFORE|((s->server) ? SSL_ST_ACCEPT : SSL_ST_CONNECT); 1677 s->s3->hs.state = SSL_ST_BEFORE|((s->server) ? SSL_ST_ACCEPT : SSL_ST_CONNECT);
1678} 1678}
diff --git a/src/lib/libssl/ssl_versions.c b/src/lib/libssl/ssl_versions.c
index fbc0004f4b..8273546062 100644
--- a/src/lib/libssl/ssl_versions.c
+++ b/src/lib/libssl/ssl_versions.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_versions.c,v 1.26 2022/11/26 16:08:56 tb Exp $ */ 1/* $OpenBSD: ssl_versions.c,v 1.27 2023/07/02 17:21:32 beck Exp $ */
2/* 2/*
3 * Copyright (c) 2016, 2017 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2016, 2017 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -150,11 +150,7 @@ ssl_enabled_tls_version_range(SSL *s, uint16_t *min_ver, uint16_t *max_ver)
150 options |= SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_2; 150 options |= SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_2;
151 } 151 }
152 152
153 if ((options & SSL_OP_NO_TLSv1) == 0) 153 if ((options & SSL_OP_NO_TLSv1_2) == 0)
154 min_version = TLS1_VERSION;
155 else if ((options & SSL_OP_NO_TLSv1_1) == 0)
156 min_version = TLS1_1_VERSION;
157 else if ((options & SSL_OP_NO_TLSv1_2) == 0)
158 min_version = TLS1_2_VERSION; 154 min_version = TLS1_2_VERSION;
159 else if ((options & SSL_OP_NO_TLSv1_3) == 0) 155 else if ((options & SSL_OP_NO_TLSv1_3) == 0)
160 min_version = TLS1_3_VERSION; 156 min_version = TLS1_3_VERSION;
@@ -162,10 +158,6 @@ ssl_enabled_tls_version_range(SSL *s, uint16_t *min_ver, uint16_t *max_ver)
162 if ((options & SSL_OP_NO_TLSv1_3) && min_version < TLS1_3_VERSION) 158 if ((options & SSL_OP_NO_TLSv1_3) && min_version < TLS1_3_VERSION)
163 max_version = TLS1_2_VERSION; 159 max_version = TLS1_2_VERSION;
164 if ((options & SSL_OP_NO_TLSv1_2) && min_version < TLS1_2_VERSION) 160 if ((options & SSL_OP_NO_TLSv1_2) && min_version < TLS1_2_VERSION)
165 max_version = TLS1_1_VERSION;
166 if ((options & SSL_OP_NO_TLSv1_1) && min_version < TLS1_1_VERSION)
167 max_version = TLS1_VERSION;
168 if ((options & SSL_OP_NO_TLSv1) && min_version < TLS1_VERSION)
169 max_version = 0; 161 max_version = 0;
170 162
171 /* Everything has been disabled... */ 163 /* Everything has been disabled... */
diff --git a/src/regress/lib/libssl/Makefile b/src/regress/lib/libssl/Makefile
index bae1248ab1..f9919404f2 100644
--- a/src/regress/lib/libssl/Makefile
+++ b/src/regress/lib/libssl/Makefile
@@ -1,11 +1,11 @@
1# $OpenBSD: Makefile,v 1.51 2022/11/05 21:58:24 jsing Exp $ 1# $OpenBSD: Makefile,v 1.52 2023/07/02 17:21:32 beck Exp $
2 2
3SUBDIR += api 3SUBDIR += api
4SUBDIR += asn1 4SUBDIR += asn1
5SUBDIR += buffer 5SUBDIR += buffer
6SUBDIR += bytestring 6SUBDIR += bytestring
7SUBDIR += ciphers 7SUBDIR += ciphers
8SUBDIR += client 8#SUBDIR += client
9SUBDIR += dtls 9SUBDIR += dtls
10SUBDIR += exporter 10SUBDIR += exporter
11SUBDIR += handshake 11SUBDIR += handshake
@@ -13,7 +13,7 @@ SUBDIR += pqueue
13SUBDIR += quic 13SUBDIR += quic
14SUBDIR += record 14SUBDIR += record
15SUBDIR += record_layer 15SUBDIR += record_layer
16SUBDIR += server 16#SUBDIR += server
17SUBDIR += ssl 17SUBDIR += ssl
18SUBDIR += tls 18SUBDIR += tls
19SUBDIR += tlsext 19SUBDIR += tlsext
diff --git a/src/regress/lib/libssl/interop/version/Makefile b/src/regress/lib/libssl/interop/version/Makefile
index 9d0ae418ba..c4f7705d63 100644
--- a/src/regress/lib/libssl/interop/version/Makefile
+++ b/src/regress/lib/libssl/interop/version/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.6 2023/04/19 15:34:23 tb Exp $ 1# $OpenBSD: Makefile,v 1.7 2023/07/02 17:21:32 beck Exp $
2 2
3# Connect a client to a server. Both can be current libressl, or 3# Connect a client to a server. Both can be current libressl, or
4# openssl 1.1 or openssl 3.0. Pin client or server to a fixed TLS 4# openssl 1.1 or openssl 3.0. Pin client or server to a fixed TLS
@@ -14,7 +14,7 @@ LIBRARIES += openssl11
14LIBRARIES += openssl30 14LIBRARIES += openssl30
15.endif 15.endif
16 16
17VERSIONS = any TLS1 TLS1_1 TLS1_2 TLS1_3 17VERSIONS = any TLS1_2 TLS1_3
18 18
19.for cver in ${VERSIONS} 19.for cver in ${VERSIONS}
20.for sver in ${VERSIONS} 20.for sver in ${VERSIONS}
diff --git a/src/regress/lib/libssl/ssl/ssltest.c b/src/regress/lib/libssl/ssl/ssltest.c
index b4b10446e6..6b8e243073 100644
--- a/src/regress/lib/libssl/ssl/ssltest.c
+++ b/src/regress/lib/libssl/ssl/ssltest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssltest.c,v 1.39 2023/04/15 16:50:05 tb Exp $ */ 1/* $OpenBSD: ssltest.c,v 1.40 2023/07/02 17:21:32 beck Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -336,7 +336,7 @@ sv_usage(void)
336 fprintf(stderr, " -dhe1024dsa - use 1024 bit key (with 160-bit subprime) for DHE\n"); 336 fprintf(stderr, " -dhe1024dsa - use 1024 bit key (with 160-bit subprime) for DHE\n");
337 fprintf(stderr, " -no_dhe - disable DHE\n"); 337 fprintf(stderr, " -no_dhe - disable DHE\n");
338 fprintf(stderr, " -no_ecdhe - disable ECDHE\n"); 338 fprintf(stderr, " -no_ecdhe - disable ECDHE\n");
339 fprintf(stderr, " -dtls1 - use DTLSv1\n"); 339 fprintf(stderr, " -dtls1_2 - use DTLSv1.2\n");
340 fprintf(stderr, " -tls1 - use TLSv1\n"); 340 fprintf(stderr, " -tls1 - use TLSv1\n");
341 fprintf(stderr, " -tls1_2 - use TLSv1.2\n"); 341 fprintf(stderr, " -tls1_2 - use TLSv1.2\n");
342 fprintf(stderr, " -CApath arg - PEM format directory of CA's\n"); 342 fprintf(stderr, " -CApath arg - PEM format directory of CA's\n");
@@ -409,7 +409,7 @@ main(int argc, char *argv[])
409 int badop = 0; 409 int badop = 0;
410 int bio_pair = 0; 410 int bio_pair = 0;
411 int force = 0; 411 int force = 0;
412 int tls1 = 0, tls1_2 = 0, dtls1 = 0, ret = 1; 412 int tls1 = 0, tls1_2 = 0, dtls1_2 = 0, ret = 1;
413 int client_auth = 0; 413 int client_auth = 0;
414 int server_auth = 0, i; 414 int server_auth = 0, i;
415 char *app_verify_arg = "Test Callback Argument"; 415 char *app_verify_arg = "Test Callback Argument";
@@ -464,8 +464,8 @@ main(int argc, char *argv[])
464 no_dhe = 1; 464 no_dhe = 1;
465 else if (strcmp(*argv, "-no_ecdhe") == 0) 465 else if (strcmp(*argv, "-no_ecdhe") == 0)
466 no_ecdhe = 1; 466 no_ecdhe = 1;
467 else if (strcmp(*argv, "-dtls1") == 0) 467 else if (strcmp(*argv, "-dtls1_2") == 0)
468 dtls1 = 1; 468 dtls1_2 = 1;
469 else if (strcmp(*argv, "-tls1") == 0) 469 else if (strcmp(*argv, "-tls1") == 0)
470 tls1 = 1; 470 tls1 = 1;
471 else if (strcmp(*argv, "-tls1_2") == 0) 471 else if (strcmp(*argv, "-tls1_2") == 0)
@@ -565,7 +565,7 @@ bad:
565 goto end; 565 goto end;
566 } 566 }
567 567
568 if (!dtls1 && !tls1 && !tls1_2 && number > 1 && !reuse && !force) { 568 if (!dtls1_2 && !tls1 && !tls1_2 && number > 1 && !reuse && !force) {
569 fprintf(stderr, 569 fprintf(stderr,
570 "This case cannot work. Use -f to perform " 570 "This case cannot work. Use -f to perform "
571 "the test anyway (and\n-d to see what happens), " 571 "the test anyway (and\n-d to see what happens), "
@@ -588,8 +588,8 @@ bad:
588 SSL_library_init(); 588 SSL_library_init();
589 SSL_load_error_strings(); 589 SSL_load_error_strings();
590 590
591 if (dtls1) 591 if (dtls1_2)
592 meth = DTLSv1_method(); 592 meth = DTLSv1_2_method();
593 else if (tls1) 593 else if (tls1)
594 meth = TLSv1_method(); 594 meth = TLSv1_method();
595 else if (tls1_2) 595 else if (tls1_2)
diff --git a/src/regress/lib/libssl/ssl/testssl b/src/regress/lib/libssl/ssl/testssl
index 43efaa6460..70db1752b7 100644
--- a/src/regress/lib/libssl/ssl/testssl
+++ b/src/regress/lib/libssl/ssl/testssl
@@ -95,8 +95,7 @@ done
95if $openssl no-dh; then 95if $openssl no-dh; then
96 echo skipping anonymous DH tests 96 echo skipping anonymous DH tests
97else 97else
98 echo test tls1 with 1024bit anonymous DH, multiple handshakes 98 echo skipping tls1 tests.
99 $ssltest -v -bio_pair -tls1 -cipher ADH -dhe1024dsa -num 10 -f -time $extra || exit 1
100fi 99fi
101 100
102#if $openssl no-rsa; then 101#if $openssl no-rsa; then
@@ -117,17 +116,16 @@ fi
117# DTLS tests 116# DTLS tests
118# 117#
119 118
120echo test dtlsv1 119$ssltest -dtls1_2 $extra || exit 1
121$ssltest -dtls1 $extra || exit 1
122 120
123echo test dtlsv1 with server authentication 121echo test dtlsv1_2 with server authentication
124$ssltest -dtls1 -server_auth $CA $extra || exit 1 122$ssltest -dtls1_2 -server_auth $CA $extra || exit 1
125 123
126echo test dtlsv1 with client authentication 124echo test dtlsv1_2 with client authentication
127$ssltest -dtls1 -client_auth $CA $extra || exit 1 125$ssltest -dtls1_2 -client_auth $CA $extra || exit 1
128 126
129echo test dtlsv1 with both client and server authentication 127echo test dtlsv1_2 with both client and server authentication
130$ssltest -dtls1 -server_auth -client_auth $CA $extra || exit 1 128$ssltest -dtls1_2 -server_auth -client_auth $CA $extra || exit 1
131 129
132echo "Testing DTLS ciphersuites" 130echo "Testing DTLS ciphersuites"
133for protocol in SSLv3; do 131for protocol in SSLv3; do
@@ -136,7 +134,7 @@ for protocol in SSLv3; do
136 awk "/ $protocol / { print \\$1 }" | 134 awk "/ $protocol / { print \\$1 }" |
137 grep -v RC4`; do 135 grep -v RC4`; do
138 echo "Testing $cipher" 136 echo "Testing $cipher"
139 $ssltest -cipher $cipher -dtls1 137 $ssltest -cipher $cipher -dtls1_2
140 if [ $? -ne 0 ] ; then 138 if [ $? -ne 0 ] ; then
141 echo "Failed $cipher" 139 echo "Failed $cipher"
142 exit 1 140 exit 1
@@ -148,17 +146,17 @@ done
148# ALPN tests 146# ALPN tests
149# 147#
150echo "Testing ALPN..." 148echo "Testing ALPN..."
151$ssltest -bio_pair -tls1 -alpn_client foo -alpn_server bar || exit 1 149$ssltest -bio_pair -alpn_client foo -alpn_server bar || exit 1
152$ssltest -bio_pair -tls1 -alpn_client foo -alpn_server foo \ 150$ssltest -bio_pair -alpn_client foo -alpn_server foo \
153 -alpn_expected foo || exit 1 151 -alpn_expected foo || exit 1
154$ssltest -bio_pair -tls1 -alpn_client foo,bar -alpn_server foo \ 152$ssltest -bio_pair -alpn_client foo,bar -alpn_server foo \
155 -alpn_expected foo || exit 1 153 -alpn_expected foo || exit 1
156$ssltest -bio_pair -tls1 -alpn_client bar,foo -alpn_server foo \ 154$ssltest -bio_pair -alpn_client bar,foo -alpn_server foo \
157 -alpn_expected foo || exit 1 155 -alpn_expected foo || exit 1
158$ssltest -bio_pair -tls1 -alpn_client bar,foo -alpn_server foo,bar \ 156$ssltest -bio_pair -alpn_client bar,foo -alpn_server foo,bar \
159 -alpn_expected foo || exit 1 157 -alpn_expected foo || exit 1
160$ssltest -bio_pair -tls1 -alpn_client bar,foo -alpn_server bar,foo \ 158$ssltest -bio_pair -alpn_client bar,foo -alpn_server bar,foo \
161 -alpn_expected bar || exit 1 159 -alpn_expected bar || exit 1
162$ssltest -bio_pair -tls1 -alpn_client foo,bar -alpn_server bar,foo \ 160$ssltest -bio_pair -alpn_client foo,bar -alpn_server bar,foo \
163 -alpn_expected bar || exit 1 161 -alpn_expected bar || exit 1
164$ssltest -bio_pair -tls1 -alpn_client baz -alpn_server bar,foo || exit 1 162$ssltest -bio_pair -alpn_client baz -alpn_server bar,foo || exit 1
diff --git a/src/regress/lib/libssl/tls/tlstest.c b/src/regress/lib/libssl/tls/tlstest.c
index 5c72717e6e..8154e7576c 100644
--- a/src/regress/lib/libssl/tls/tlstest.c
+++ b/src/regress/lib/libssl/tls/tlstest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tlstest.c,v 1.1 2021/10/23 14:34:10 jsing Exp $ */ 1/* $OpenBSD: tlstest.c,v 1.2 2023/07/02 17:21:33 beck Exp $ */
2/* 2/*
3 * Copyright (c) 2020, 2021 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2020, 2021 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -245,14 +245,6 @@ static const struct tls_test tls_tests[] = {
245 .server_max_version = TLS1_2_VERSION, 245 .server_max_version = TLS1_2_VERSION,
246 }, 246 },
247 { 247 {
248 .desc = "Default client and TLSv1.1 server",
249 .server_max_version = TLS1_1_VERSION,
250 },
251 {
252 .desc = "Default client and TLSv1.0 server",
253 .server_max_version = TLS1_VERSION,
254 },
255 {
256 .desc = "Default client and default server with ECDHE KEX", 248 .desc = "Default client and default server with ECDHE KEX",
257 .server_ciphers = "ECDHE-RSA-AES128-SHA", 249 .server_ciphers = "ECDHE-RSA-AES128-SHA",
258 }, 250 },
@@ -262,16 +254,6 @@ static const struct tls_test tls_tests[] = {
262 .server_ciphers = "ECDHE-RSA-AES128-SHA", 254 .server_ciphers = "ECDHE-RSA-AES128-SHA",
263 }, 255 },
264 { 256 {
265 .desc = "Default client and TLSv1.1 server with ECDHE KEX",
266 .server_max_version = TLS1_1_VERSION,
267 .server_ciphers = "ECDHE-RSA-AES128-SHA",
268 },
269 {
270 .desc = "Default client and TLSv1.0 server with ECDHE KEX",
271 .server_max_version = TLS1_VERSION,
272 .server_ciphers = "ECDHE-RSA-AES128-SHA",
273 },
274 {
275 .desc = "Default client and default server with DHE KEX", 257 .desc = "Default client and default server with DHE KEX",
276 .server_ciphers = "DHE-RSA-AES128-SHA", 258 .server_ciphers = "DHE-RSA-AES128-SHA",
277 }, 259 },
@@ -281,16 +263,6 @@ static const struct tls_test tls_tests[] = {
281 .server_ciphers = "DHE-RSA-AES128-SHA", 263 .server_ciphers = "DHE-RSA-AES128-SHA",
282 }, 264 },
283 { 265 {
284 .desc = "Default client and TLSv1.1 server with DHE KEX",
285 .server_max_version = TLS1_1_VERSION,
286 .server_ciphers = "DHE-RSA-AES128-SHA",
287 },
288 {
289 .desc = "Default client and TLSv1.0 server with DHE KEX",
290 .server_max_version = TLS1_VERSION,
291 .server_ciphers = "DHE-RSA-AES128-SHA",
292 },
293 {
294 .desc = "Default client and default server with RSA KEX", 266 .desc = "Default client and default server with RSA KEX",
295 .server_ciphers = "AES128-SHA", 267 .server_ciphers = "AES128-SHA",
296 }, 268 },
@@ -300,72 +272,24 @@ static const struct tls_test tls_tests[] = {
300 .server_ciphers = "AES128-SHA", 272 .server_ciphers = "AES128-SHA",
301 }, 273 },
302 { 274 {
303 .desc = "Default client and TLSv1.1 server with RSA KEX",
304 .server_max_version = TLS1_1_VERSION,
305 .server_ciphers = "AES128-SHA",
306 },
307 {
308 .desc = "Default client and TLSv1.0 server with RSA KEX",
309 .server_max_version = TLS1_VERSION,
310 .server_ciphers = "AES128-SHA",
311 },
312 {
313 .desc = "TLSv1.2 client and default server", 275 .desc = "TLSv1.2 client and default server",
314 .client_max_version = TLS1_2_VERSION, 276 .client_max_version = TLS1_2_VERSION,
315 }, 277 },
316 { 278 {
317 .desc = "TLSv1.1 client and default server",
318 .client_max_version = TLS1_1_VERSION,
319 },
320 {
321 .desc = "TLSv1.0 client and default server",
322 .client_max_version = TLS1_VERSION,
323 },
324 {
325 .desc = "TLSv1.2 client and default server with ECDHE KEX", 279 .desc = "TLSv1.2 client and default server with ECDHE KEX",
326 .client_max_version = TLS1_2_VERSION, 280 .client_max_version = TLS1_2_VERSION,
327 .client_ciphers = "ECDHE-RSA-AES128-SHA", 281 .client_ciphers = "ECDHE-RSA-AES128-SHA",
328 }, 282 },
329 { 283 {
330 .desc = "TLSv1.1 client and default server with ECDHE KEX",
331 .client_max_version = TLS1_1_VERSION,
332 .client_ciphers = "ECDHE-RSA-AES128-SHA",
333 },
334 {
335 .desc = "TLSv1.0 client and default server with ECDHE KEX",
336 .client_max_version = TLS1_VERSION,
337 .client_ciphers = "ECDHE-RSA-AES128-SHA",
338 },
339 {
340 .desc = "TLSv1.2 client and default server with DHE KEX", 284 .desc = "TLSv1.2 client and default server with DHE KEX",
341 .server_max_version = TLS1_2_VERSION, 285 .server_max_version = TLS1_2_VERSION,
342 .client_ciphers = "DHE-RSA-AES128-SHA", 286 .client_ciphers = "DHE-RSA-AES128-SHA",
343 }, 287 },
344 { 288 {
345 .desc = "TLSv1.1 client and default server with DHE KEX",
346 .client_max_version = TLS1_1_VERSION,
347 .client_ciphers = "DHE-RSA-AES128-SHA",
348 },
349 {
350 .desc = "TLSv1.0 client and default server with DHE KEX",
351 .client_max_version = TLS1_VERSION,
352 .client_ciphers = "DHE-RSA-AES128-SHA",
353 },
354 {
355 .desc = "TLSv1.2 client and default server with RSA KEX", 289 .desc = "TLSv1.2 client and default server with RSA KEX",
356 .client_max_version = TLS1_2_VERSION, 290 .client_max_version = TLS1_2_VERSION,
357 .client_ciphers = "AES128-SHA", 291 .client_ciphers = "AES128-SHA",
358 }, 292 },
359 {
360 .desc = "TLSv1.1 client and default server with RSA KEX",
361 .client_max_version = TLS1_1_VERSION,
362 .client_ciphers = "AES128-SHA",
363 },
364 {
365 .desc = "TLSv1.0 client and default server with RSA KEX",
366 .client_max_version = TLS1_VERSION,
367 .client_ciphers = "AES128-SHA",
368 },
369}; 293};
370 294
371#define N_TLS_TESTS (sizeof(tls_tests) / sizeof(*tls_tests)) 295#define N_TLS_TESTS (sizeof(tls_tests) / sizeof(*tls_tests))
diff --git a/src/regress/lib/libssl/tlsfuzzer/tlsfuzzer.py b/src/regress/lib/libssl/tlsfuzzer/tlsfuzzer.py
index 2953320c1d..aa7e384e1f 100644
--- a/src/regress/lib/libssl/tlsfuzzer/tlsfuzzer.py
+++ b/src/regress/lib/libssl/tlsfuzzer/tlsfuzzer.py
@@ -1,4 +1,4 @@
1# $OpenBSD: tlsfuzzer.py,v 1.49 2023/06/10 05:00:58 tb Exp $ 1# $OpenBSD: tlsfuzzer.py,v 1.50 2023/07/02 17:21:33 beck Exp $
2# 2#
3# Copyright (c) 2020 Theo Buehler <tb@openbsd.org> 3# Copyright (c) 2020 Theo Buehler <tb@openbsd.org>
4# 4#
@@ -323,6 +323,8 @@ tls13_unsupported_tests = TestGroup("TLSv1.3 tests for unsupported features", [
323tls12_exclude_legacy_protocols = [ 323tls12_exclude_legacy_protocols = [
324 # all these have BIO_read timeouts against TLSv1.3 324 # all these have BIO_read timeouts against TLSv1.3
325 "-e", "Protocol (3, 0)", 325 "-e", "Protocol (3, 0)",
326 "-e", "Protocol (3, 1)",
327 "-e", "Protocol (3, 2)",
326 "-e", "Protocol (3, 0) in SSLv2 compatible ClientHello", 328 "-e", "Protocol (3, 0) in SSLv2 compatible ClientHello",
327 # the following only fail with TLSv1.3 329 # the following only fail with TLSv1.3
328 "-e", "Protocol (3, 1) in SSLv2 compatible ClientHello", 330 "-e", "Protocol (3, 1) in SSLv2 compatible ClientHello",
@@ -331,13 +333,20 @@ tls12_exclude_legacy_protocols = [
331 "-e", "Protocol (3, 1) with x448 group", 333 "-e", "Protocol (3, 1) with x448 group",
332 "-e", "Protocol (3, 2) with x448 group", 334 "-e", "Protocol (3, 2) with x448 group",
333 "-e", "Protocol (3, 3) with x448 group", 335 "-e", "Protocol (3, 3) with x448 group",
336 # These don't work without TLSv1.0 and TLSv1.1
337 "-e", "Protocol (3, 1) with secp256r1 group",
338 "-e", "Protocol (3, 1) with secp384r1 group",
339 "-e", "Protocol (3, 1) with secp521r1 group",
340 "-e", "Protocol (3, 1) with x25519 group",
341 "-e", "Protocol (3, 2) with secp256r1 group",
342 "-e", "Protocol (3, 2) with secp384r1 group",
343 "-e", "Protocol (3, 2) with secp521r1 group",
344 "-e", "Protocol (3, 2) with x25519 group",
334] 345]
335 346
336tls12_tests = TestGroup("TLSv1.2 tests", [ 347tls12_tests = TestGroup("TLSv1.2 tests", [
337 # Tests that pass as they are. 348 # Tests that pass as they are.
338 Test("test-TLSv1_2-rejected-without-TLSv1_2.py"),
339 Test("test-aes-gcm-nonces.py"), 349 Test("test-aes-gcm-nonces.py"),
340 Test("test-chacha20.py"),
341 Test("test-connection-abort.py"), 350 Test("test-connection-abort.py"),
342 Test("test-conversation.py"), 351 Test("test-conversation.py"),
343 Test("test-cve-2016-2107.py"), 352 Test("test-cve-2016-2107.py"),
@@ -386,13 +395,30 @@ tls12_tests = TestGroup("TLSv1.2 tests", [
386 ] 395 ]
387 ), 396 ),
388 Test("test-dhe-key-share-random.py", tls12_exclude_legacy_protocols), 397 Test("test-dhe-key-share-random.py", tls12_exclude_legacy_protocols),
389 Test("test-export-ciphers-rejected.py", ["--min-ver", "TLSv1.0"]), 398 Test("test-export-ciphers-rejected.py", ["--min-ver", "TLSv1.2"]),
390 Test( 399 Test(
391 "test-downgrade-protection.py", 400 "test-downgrade-protection.py",
392 tls12_args = ["--server-max-protocol", "TLSv1.2"], 401 tls12_args = ["--server-max-protocol", "TLSv1.2"],
393 tls13_args = ["--server-max-protocol", "TLSv1.3"], 402 tls13_args = [
403 "--server-max-protocol", "TLSv1.3",
404 "-e", "TLS 1.3 downgrade check for Protocol (3, 1)",
405 "-e", "TLS 1.3 downgrade check for Protocol (3, 2)",
406 ]
407 ),
408 Test(
409 "test-fallback-scsv.py",
410 tls13_args = [
411 "--tls-1.3",
412 "-e", "FALLBACK - hello TLSv1.1 - pos 0",
413 "-e", "FALLBACK - hello TLSv1.1 - pos 1",
414 "-e", "FALLBACK - hello TLSv1.1 - pos 2",
415 "-e", "FALLBACK - record TLSv1.1 hello TLSv1.1 - pos 0",
416 "-e", "FALLBACK - record TLSv1.1 hello TLSv1.1 - pos 1",
417 "-e", "FALLBACK - record TLSv1.1 hello TLSv1.1 - pos 2",
418 "-e", "record TLSv1.1 hello TLSv1.1",
419 "-e", "sanity - TLSv1.1",
420 ]
394 ), 421 ),
395 Test("test-fallback-scsv.py", tls13_args = ["--tls-1.3"] ),
396 422
397 Test("test-invalid-compression-methods.py", [ 423 Test("test-invalid-compression-methods.py", [
398 "-x", "invalid compression methods", 424 "-x", "invalid compression methods",
@@ -412,6 +438,8 @@ tls12_tests = TestGroup("TLSv1.2 tests", [
412 Test("test-sig-algs-renegotiation-resumption.py", ["--sig-algs-drop-ok"]), 438 Test("test-sig-algs-renegotiation-resumption.py", ["--sig-algs-drop-ok"]),
413 439
414 Test("test-serverhello-random.py", args = tls12_exclude_legacy_protocols), 440 Test("test-serverhello-random.py", args = tls12_exclude_legacy_protocols),
441
442 Test("test-chacha20.py", [ "-e", "Chacha20 in TLS1.1" ]),
415]) 443])
416 444
417tls12_slow_tests = TestGroup("slow TLSv1.2 tests", [ 445tls12_slow_tests = TestGroup("slow TLSv1.2 tests", [
@@ -549,6 +577,9 @@ tls12_failing_tests = TestGroup("failing TLSv1.2 tests", [
549 577
550 # x448 tests need disabling plus x25519 corner cases need sorting out 578 # x448 tests need disabling plus x25519 corner cases need sorting out
551 Test("test-x25519.py"), 579 Test("test-x25519.py"),
580
581 # Needs TLS 1.0 or 1.1
582 Test("test-TLSv1_2-rejected-without-TLSv1_2.py"),
552]) 583])
553 584
554tls12_unsupported_tests = TestGroup("TLSv1.2 for unsupported features", [ 585tls12_unsupported_tests = TestGroup("TLSv1.2 for unsupported features", [
diff --git a/src/regress/lib/libssl/unit/ssl_versions.c b/src/regress/lib/libssl/unit/ssl_versions.c
index 261bed3a7a..ebfe8d2c28 100644
--- a/src/regress/lib/libssl/unit/ssl_versions.c
+++ b/src/regress/lib/libssl/unit/ssl_versions.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_versions.c,v 1.19 2022/11/26 16:08:57 tb Exp $ */ 1/* $OpenBSD: ssl_versions.c,v 1.20 2023/07/02 17:21:33 beck Exp $ */
2/* 2/*
3 * Copyright (c) 2016, 2017 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2016, 2017 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -32,43 +32,43 @@ static struct version_range_test version_range_tests[] = {
32 .options = 0, 32 .options = 0,
33 .minver = TLS1_VERSION, 33 .minver = TLS1_VERSION,
34 .maxver = TLS1_3_VERSION, 34 .maxver = TLS1_3_VERSION,
35 .want_minver = TLS1_VERSION, 35 .want_minver = TLS1_2_VERSION,
36 .want_maxver = TLS1_3_VERSION, 36 .want_maxver = TLS1_3_VERSION,
37 }, 37 },
38 { 38 {
39 .options = 0, 39 .options = 0,
40 .minver = TLS1_VERSION, 40 .minver = TLS1_VERSION,
41 .maxver = TLS1_2_VERSION, 41 .maxver = TLS1_2_VERSION,
42 .want_minver = TLS1_VERSION, 42 .want_minver = TLS1_2_VERSION,
43 .want_maxver = TLS1_2_VERSION, 43 .want_maxver = TLS1_2_VERSION,
44 }, 44 },
45 { 45 {
46 .options = SSL_OP_NO_TLSv1, 46 .options = SSL_OP_NO_TLSv1,
47 .minver = TLS1_VERSION, 47 .minver = TLS1_VERSION,
48 .maxver = TLS1_2_VERSION, 48 .maxver = TLS1_2_VERSION,
49 .want_minver = TLS1_1_VERSION, 49 .want_minver = TLS1_2_VERSION,
50 .want_maxver = TLS1_2_VERSION, 50 .want_maxver = TLS1_2_VERSION,
51 }, 51 },
52 { 52 {
53 .options = SSL_OP_NO_TLSv1_3, 53 .options = SSL_OP_NO_TLSv1_3,
54 .minver = TLS1_VERSION, 54 .minver = TLS1_VERSION,
55 .maxver = TLS1_3_VERSION, 55 .maxver = TLS1_3_VERSION,
56 .want_minver = TLS1_VERSION, 56 .want_minver = TLS1_2_VERSION,
57 .want_maxver = TLS1_2_VERSION, 57 .want_maxver = TLS1_2_VERSION,
58 }, 58 },
59 { 59 {
60 .options = SSL_OP_NO_TLSv1_2, 60 .options = SSL_OP_NO_TLSv1_2,
61 .minver = TLS1_VERSION, 61 .minver = TLS1_VERSION,
62 .maxver = TLS1_2_VERSION, 62 .maxver = TLS1_2_VERSION,
63 .want_minver = TLS1_VERSION, 63 .want_minver = 0,
64 .want_maxver = TLS1_1_VERSION, 64 .want_maxver = 0,
65 }, 65 },
66 { 66 {
67 .options = SSL_OP_NO_TLSv1_1, 67 .options = SSL_OP_NO_TLSv1_1,
68 .minver = TLS1_VERSION, 68 .minver = TLS1_VERSION,
69 .maxver = TLS1_2_VERSION, 69 .maxver = TLS1_2_VERSION,
70 .want_minver = TLS1_VERSION, 70 .want_minver = TLS1_2_VERSION,
71 .want_maxver = TLS1_VERSION, 71 .want_maxver = TLS1_2_VERSION,
72 }, 72 },
73 { 73 {
74 .options = SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1, 74 .options = SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1,
@@ -81,15 +81,15 @@ static struct version_range_test version_range_tests[] = {
81 .options = SSL_OP_NO_TLSv1_1 | SSL_OP_NO_TLSv1_2, 81 .options = SSL_OP_NO_TLSv1_1 | SSL_OP_NO_TLSv1_2,
82 .minver = TLS1_VERSION, 82 .minver = TLS1_VERSION,
83 .maxver = TLS1_2_VERSION, 83 .maxver = TLS1_2_VERSION,
84 .want_minver = TLS1_VERSION, 84 .want_minver = 0,
85 .want_maxver = TLS1_VERSION, 85 .want_maxver = 0,
86 }, 86 },
87 { 87 {
88 .options = SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_2, 88 .options = SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_2,
89 .minver = TLS1_VERSION, 89 .minver = TLS1_VERSION,
90 .maxver = TLS1_2_VERSION, 90 .maxver = TLS1_2_VERSION,
91 .want_minver = TLS1_1_VERSION, 91 .want_minver = 0,
92 .want_maxver = TLS1_1_VERSION, 92 .want_maxver = 0,
93 }, 93 },
94 { 94 {
95 .options = SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1 | 95 .options = SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1 |
@@ -119,14 +119,14 @@ static struct version_range_test version_range_tests[] = {
119 .options = 0, 119 .options = 0,
120 .minver = TLS1_VERSION, 120 .minver = TLS1_VERSION,
121 .maxver = TLS1_2_VERSION, 121 .maxver = TLS1_2_VERSION,
122 .want_minver = TLS1_VERSION, 122 .want_minver = TLS1_2_VERSION,
123 .want_maxver = TLS1_2_VERSION, 123 .want_maxver = TLS1_2_VERSION,
124 }, 124 },
125 { 125 {
126 .options = 0, 126 .options = 0,
127 .minver = TLS1_1_VERSION, 127 .minver = TLS1_1_VERSION,
128 .maxver = TLS1_2_VERSION, 128 .maxver = TLS1_2_VERSION,
129 .want_minver = TLS1_1_VERSION, 129 .want_minver = TLS1_2_VERSION,
130 .want_maxver = TLS1_2_VERSION, 130 .want_maxver = TLS1_2_VERSION,
131 }, 131 },
132 { 132 {
@@ -140,14 +140,14 @@ static struct version_range_test version_range_tests[] = {
140 .options = 0, 140 .options = 0,
141 .minver = TLS1_VERSION, 141 .minver = TLS1_VERSION,
142 .maxver = TLS1_3_VERSION, 142 .maxver = TLS1_3_VERSION,
143 .want_minver = TLS1_VERSION, 143 .want_minver = TLS1_2_VERSION,
144 .want_maxver = TLS1_3_VERSION, 144 .want_maxver = TLS1_3_VERSION,
145 }, 145 },
146 { 146 {
147 .options = 0, 147 .options = 0,
148 .minver = TLS1_1_VERSION, 148 .minver = TLS1_1_VERSION,
149 .maxver = TLS1_3_VERSION, 149 .maxver = TLS1_3_VERSION,
150 .want_minver = TLS1_1_VERSION, 150 .want_minver = TLS1_2_VERSION,
151 .want_maxver = TLS1_3_VERSION, 151 .want_maxver = TLS1_3_VERSION,
152 }, 152 },
153 { 153 {
@@ -168,15 +168,15 @@ static struct version_range_test version_range_tests[] = {
168 .options = 0, 168 .options = 0,
169 .minver = TLS1_VERSION, 169 .minver = TLS1_VERSION,
170 .maxver = TLS1_1_VERSION, 170 .maxver = TLS1_1_VERSION,
171 .want_minver = TLS1_VERSION, 171 .want_minver = 0,
172 .want_maxver = TLS1_1_VERSION, 172 .want_maxver = 0,
173 }, 173 },
174 { 174 {
175 .options = 0, 175 .options = 0,
176 .minver = TLS1_VERSION, 176 .minver = TLS1_VERSION,
177 .maxver = TLS1_VERSION, 177 .maxver = TLS1_VERSION,
178 .want_minver = TLS1_VERSION, 178 .want_minver = 0,
179 .want_maxver = TLS1_VERSION, 179 .want_maxver = 0,
180 }, 180 },
181}; 181};
182 182
@@ -276,7 +276,7 @@ static struct shared_version_test shared_version_tests[] = {
276 .minver = TLS1_VERSION, 276 .minver = TLS1_VERSION,
277 .maxver = TLS1_2_VERSION, 277 .maxver = TLS1_2_VERSION,
278 .peerver = TLS1_VERSION, 278 .peerver = TLS1_VERSION,
279 .want_maxver = TLS1_VERSION, 279 .want_maxver = 0,
280 }, 280 },
281 { 281 {
282 .ssl_method = TLS_method, 282 .ssl_method = TLS_method,
@@ -284,7 +284,7 @@ static struct shared_version_test shared_version_tests[] = {
284 .minver = TLS1_VERSION, 284 .minver = TLS1_VERSION,
285 .maxver = TLS1_2_VERSION, 285 .maxver = TLS1_2_VERSION,
286 .peerver = TLS1_1_VERSION, 286 .peerver = TLS1_1_VERSION,
287 .want_maxver = TLS1_1_VERSION, 287 .want_maxver = 0,
288 }, 288 },
289 { 289 {
290 .ssl_method = TLS_method, 290 .ssl_method = TLS_method,
@@ -316,7 +316,7 @@ static struct shared_version_test shared_version_tests[] = {
316 .minver = TLS1_VERSION, 316 .minver = TLS1_VERSION,
317 .maxver = TLS1_2_VERSION, 317 .maxver = TLS1_2_VERSION,
318 .peerver = TLS1_2_VERSION, 318 .peerver = TLS1_2_VERSION,
319 .want_maxver = TLS1_1_VERSION, 319 .want_maxver = 0,
320 }, 320 },
321 { 321 {
322 .ssl_method = TLS_method, 322 .ssl_method = TLS_method,
@@ -324,7 +324,7 @@ static struct shared_version_test shared_version_tests[] = {
324 .minver = TLS1_VERSION, 324 .minver = TLS1_VERSION,
325 .maxver = TLS1_2_VERSION, 325 .maxver = TLS1_2_VERSION,
326 .peerver = TLS1_2_VERSION, 326 .peerver = TLS1_2_VERSION,
327 .want_maxver = TLS1_VERSION, 327 .want_maxver = 0,
328 }, 328 },
329 { 329 {
330 .ssl_method = TLS_method, 330 .ssl_method = TLS_method,
@@ -340,7 +340,7 @@ static struct shared_version_test shared_version_tests[] = {
340 .minver = TLS1_VERSION, 340 .minver = TLS1_VERSION,
341 .maxver = TLS1_2_VERSION, 341 .maxver = TLS1_2_VERSION,
342 .peerver = TLS1_1_VERSION, 342 .peerver = TLS1_1_VERSION,
343 .want_maxver = TLS1_1_VERSION, 343 .want_maxver = 0,
344 }, 344 },
345 { 345 {
346 .ssl_method = TLS_method, 346 .ssl_method = TLS_method,
@@ -356,7 +356,7 @@ static struct shared_version_test shared_version_tests[] = {
356 .minver = TLS1_VERSION, 356 .minver = TLS1_VERSION,
357 .maxver = TLS1_2_VERSION, 357 .maxver = TLS1_2_VERSION,
358 .peerver = TLS1_1_VERSION, 358 .peerver = TLS1_1_VERSION,
359 .want_maxver = TLS1_VERSION, 359 .want_maxver = 0,
360 }, 360 },
361 { 361 {
362 .ssl_method = TLS_method, 362 .ssl_method = TLS_method,
@@ -372,7 +372,7 @@ static struct shared_version_test shared_version_tests[] = {
372 .minver = TLS1_VERSION, 372 .minver = TLS1_VERSION,
373 .maxver = TLS1_1_VERSION, 373 .maxver = TLS1_1_VERSION,
374 .peerver = TLS1_2_VERSION, 374 .peerver = TLS1_2_VERSION,
375 .want_maxver = TLS1_1_VERSION, 375 .want_maxver = 0,
376 }, 376 },
377 { 377 {
378 .ssl_method = TLS_method, 378 .ssl_method = TLS_method,
@@ -380,7 +380,7 @@ static struct shared_version_test shared_version_tests[] = {
380 .minver = TLS1_VERSION, 380 .minver = TLS1_VERSION,
381 .maxver = TLS1_VERSION, 381 .maxver = TLS1_VERSION,
382 .peerver = TLS1_2_VERSION, 382 .peerver = TLS1_2_VERSION,
383 .want_maxver = TLS1_VERSION, 383 .want_maxver = 0,
384 }, 384 },
385 { 385 {
386 .ssl_method = TLSv1_method, 386 .ssl_method = TLSv1_method,
@@ -388,7 +388,7 @@ static struct shared_version_test shared_version_tests[] = {
388 .minver = TLS1_VERSION, 388 .minver = TLS1_VERSION,
389 .maxver = TLS1_2_VERSION, 389 .maxver = TLS1_2_VERSION,
390 .peerver = TLS1_VERSION, 390 .peerver = TLS1_VERSION,
391 .want_maxver = TLS1_VERSION, 391 .want_maxver = 0,
392 }, 392 },
393 { 393 {
394 .ssl_method = TLSv1_method, 394 .ssl_method = TLSv1_method,
@@ -404,7 +404,7 @@ static struct shared_version_test shared_version_tests[] = {
404 .minver = TLS1_VERSION, 404 .minver = TLS1_VERSION,
405 .maxver = TLS1_2_VERSION, 405 .maxver = TLS1_2_VERSION,
406 .peerver = TLS1_1_VERSION, 406 .peerver = TLS1_1_VERSION,
407 .want_maxver = TLS1_1_VERSION, 407 .want_maxver = 0,
408 }, 408 },
409 { 409 {
410 .ssl_method = DTLS_method, 410 .ssl_method = DTLS_method,
@@ -412,7 +412,7 @@ static struct shared_version_test shared_version_tests[] = {
412 .minver = TLS1_1_VERSION, 412 .minver = TLS1_1_VERSION,
413 .maxver = TLS1_2_VERSION, 413 .maxver = TLS1_2_VERSION,
414 .peerver = DTLS1_VERSION, 414 .peerver = DTLS1_VERSION,
415 .want_maxver = DTLS1_VERSION, 415 .want_maxver = 0,
416 }, 416 },
417 { 417 {
418 .ssl_method = DTLS_method, 418 .ssl_method = DTLS_method,
@@ -436,7 +436,7 @@ static struct shared_version_test shared_version_tests[] = {
436 .minver = TLS1_1_VERSION, 436 .minver = TLS1_1_VERSION,
437 .maxver = TLS1_1_VERSION, 437 .maxver = TLS1_1_VERSION,
438 .peerver = DTLS1_2_VERSION, 438 .peerver = DTLS1_2_VERSION,
439 .want_maxver = DTLS1_VERSION, 439 .want_maxver = 0,
440 }, 440 },
441 { 441 {
442 .ssl_method = DTLSv1_2_method, 442 .ssl_method = DTLSv1_2_method,
@@ -476,7 +476,7 @@ static struct shared_version_test shared_version_tests[] = {
476 .minver = TLS1_1_VERSION, 476 .minver = TLS1_1_VERSION,
477 .maxver = TLS1_2_VERSION, 477 .maxver = TLS1_2_VERSION,
478 .peerver = DTLS1_2_VERSION, 478 .peerver = DTLS1_2_VERSION,
479 .want_maxver = DTLS1_VERSION, 479 .want_maxver = 0,
480 }, 480 },
481}; 481};
482 482