summaryrefslogtreecommitdiff
path: root/src/regress/lib/libssl
diff options
context:
space:
mode:
Diffstat (limited to 'src/regress/lib/libssl')
-rw-r--r--src/regress/lib/libssl/interop/Makefile4
-rw-r--r--src/regress/lib/libssl/interop/botan/Makefile9
-rw-r--r--src/regress/lib/libssl/interop/cert/Makefile9
-rw-r--r--src/regress/lib/libssl/interop/cipher/Makefile17
-rw-r--r--src/regress/lib/libssl/interop/netcat/Makefile9
-rw-r--r--src/regress/lib/libssl/interop/openssl33/Makefile44
-rw-r--r--src/regress/lib/libssl/interop/openssl34/Makefile44
-rw-r--r--src/regress/lib/libssl/interop/openssl35/Makefile44
-rw-r--r--src/regress/lib/libssl/interop/session/Makefile9
-rw-r--r--src/regress/lib/libssl/interop/version/Makefile12
-rw-r--r--src/regress/lib/libssl/openssl-ruby/Makefile23
-rw-r--r--src/regress/lib/libssl/pqueue/Makefile7
-rw-r--r--src/regress/lib/libssl/pqueue/expected.txt3
-rw-r--r--src/regress/lib/libssl/pqueue/pq_test.c95
-rw-r--r--src/regress/lib/libssl/tlsext/tlsexttest.c41
-rw-r--r--src/regress/lib/libssl/tlsfuzzer/tlsfuzzer.py308
16 files changed, 306 insertions, 372 deletions
diff --git a/src/regress/lib/libssl/interop/Makefile b/src/regress/lib/libssl/interop/Makefile
index bdc67f627a..e1e9633d37 100644
--- a/src/regress/lib/libssl/interop/Makefile
+++ b/src/regress/lib/libssl/interop/Makefile
@@ -1,6 +1,6 @@
1# $OpenBSD: Makefile,v 1.21 2025/01/15 10:54:17 tb Exp $ 1# $OpenBSD: Makefile,v 1.23 2025/07/25 16:33:15 tb Exp $
2 2
3SUBDIR = libressl openssl33 openssl34 3SUBDIR = libressl openssl35
4 4
5# the above binaries must have been built before we can continue 5# the above binaries must have been built before we can continue
6SUBDIR += netcat 6SUBDIR += netcat
diff --git a/src/regress/lib/libssl/interop/botan/Makefile b/src/regress/lib/libssl/interop/botan/Makefile
index 85877d4290..56bcdaf4bd 100644
--- a/src/regress/lib/libssl/interop/botan/Makefile
+++ b/src/regress/lib/libssl/interop/botan/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.10 2025/01/15 10:54:17 tb Exp $ 1# $OpenBSD: Makefile,v 1.12 2025/07/25 16:33:15 tb Exp $
2 2
3.include <bsd.own.mk> 3.include <bsd.own.mk>
4 4
@@ -20,11 +20,8 @@ CXX = /usr/local/bin/eg++
20.endif 20.endif
21 21
22LIBRARIES = libressl 22LIBRARIES = libressl
23.if exists(/usr/local/bin/eopenssl33) 23.if exists(/usr/local/bin/eopenssl35)
24LIBRARIES += openssl33 24LIBRARIES += openssl35
25.endif
26.if exists(/usr/local/bin/eopenssl34)
27LIBRARIES += openssl34
28.endif 25.endif
29 26
30PROGS = client 27PROGS = client
diff --git a/src/regress/lib/libssl/interop/cert/Makefile b/src/regress/lib/libssl/interop/cert/Makefile
index 74c63c86a8..9698c56acd 100644
--- a/src/regress/lib/libssl/interop/cert/Makefile
+++ b/src/regress/lib/libssl/interop/cert/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.14 2025/01/15 10:54:17 tb Exp $ 1# $OpenBSD: Makefile,v 1.16 2025/07/25 16:33:15 tb 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 3.x. Create client and server certificates 4# openssl 3.x. Create client and server certificates
@@ -7,11 +7,8 @@
7# and check the result of certificate verification. 7# and check the result of certificate verification.
8 8
9LIBRARIES = libressl 9LIBRARIES = libressl
10.if exists(/usr/local/bin/eopenssl33) 10.if exists(/usr/local/bin/eopenssl35)
11LIBRARIES += openssl33 11LIBRARIES += openssl35
12.endif
13.if exists(/usr/local/bin/eopenssl34)
14LIBRARIES += openssl34
15.endif 12.endif
16 13
17.for cca in noca ca fakeca 14.for cca in noca ca fakeca
diff --git a/src/regress/lib/libssl/interop/cipher/Makefile b/src/regress/lib/libssl/interop/cipher/Makefile
index fa7e25f9ee..5bdc9089fe 100644
--- a/src/regress/lib/libssl/interop/cipher/Makefile
+++ b/src/regress/lib/libssl/interop/cipher/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.17 2025/01/15 10:54:17 tb Exp $ 1# $OpenBSD: Makefile,v 1.19 2025/07/25 16:33:15 tb 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 3.0. Create lists of supported ciphers 4# openssl 1.1 or 3.0. Create lists of supported ciphers
@@ -7,11 +7,8 @@
7# have used correct cipher by grepping in their session print out. 7# have used correct cipher by grepping in their session print out.
8 8
9LIBRARIES = libressl 9LIBRARIES = libressl
10.if exists(/usr/local/bin/eopenssl33) 10.if exists(/usr/local/bin/eopenssl35)
11LIBRARIES += openssl33 11LIBRARIES += openssl35
12.endif
13.if exists(/usr/local/bin/eopenssl34)
14LIBRARIES += openssl34
15.endif 12.endif
16 13
17CLEANFILES = *.tmp *.ciphers ciphers.mk 14CLEANFILES = *.tmp *.ciphers ciphers.mk
@@ -41,8 +38,7 @@ client-${clib}-server-${slib}.ciphers: \
41 uniq -d <$@.tmp >$@ 38 uniq -d <$@.tmp >$@
42 # we are only interested in ciphers supported by libressl 39 # we are only interested in ciphers supported by libressl
43 sort $@ client-libressl.ciphers >$@.tmp 40 sort $@ client-libressl.ciphers >$@.tmp
44. if "${clib}" == "openssl33" || "${slib}" == "openssl33" || \ 41. if "${clib}" == "openssl35" || "${slib}" == "openssl35"
45 "${clib}" == "openssl34" || "${slib}" == "openssl34"
46 # OpenSSL's SSL_CTX_set_cipher_list doesn't accept TLSv1.3 ciphers 42 # OpenSSL's SSL_CTX_set_cipher_list doesn't accept TLSv1.3 ciphers
47 sed -i '/^TLS_/d' $@.tmp 43 sed -i '/^TLS_/d' $@.tmp
48. endif 44. endif
@@ -70,8 +66,7 @@ regress: ciphers.mk
70.endif 66.endif
71 67
72LEVEL_libressl = 68LEVEL_libressl =
73LEVEL_openssl33 = ,@SECLEVEL=0 69LEVEL_openssl35 = ,@SECLEVEL=0
74LEVEL_openssl34 = ,@SECLEVEL=0
75 70
76.for clib in ${LIBRARIES} 71.for clib in ${LIBRARIES}
77.for slib in ${LIBRARIES} 72.for slib in ${LIBRARIES}
@@ -132,7 +127,7 @@ check-cipher-${cipher}-client-${clib}-server-${slib}: \
132. endif 127. endif
133. if "${clib}" == "libressl" 128. if "${clib}" == "libressl"
134 # libressl client may prefer chacha-poly if aes-ni is not supported 129 # libressl client may prefer chacha-poly if aes-ni is not supported
135. if "${slib}" == "openssl33" || "${slib}" == "openssl34" 130. if "${slib}" == "openssl35"
136 egrep -q ' Cipher *: TLS_(AES_256_GCM_SHA384|CHACHA20_POLY1305_SHA256)$$' ${@:S/^check/server/}.out 131 egrep -q ' Cipher *: TLS_(AES_256_GCM_SHA384|CHACHA20_POLY1305_SHA256)$$' ${@:S/^check/server/}.out
137. else 132. else
138 egrep -q ' Cipher *: TLS_(AES_256_GCM_SHA384|CHACHA20_POLY1305_SHA256)$$' ${@:S/^check/server/}.out 133 egrep -q ' Cipher *: TLS_(AES_256_GCM_SHA384|CHACHA20_POLY1305_SHA256)$$' ${@:S/^check/server/}.out
diff --git a/src/regress/lib/libssl/interop/netcat/Makefile b/src/regress/lib/libssl/interop/netcat/Makefile
index 3b8e3f95be..cff6b7ea76 100644
--- a/src/regress/lib/libssl/interop/netcat/Makefile
+++ b/src/regress/lib/libssl/interop/netcat/Makefile
@@ -1,11 +1,8 @@
1# $OpenBSD: Makefile,v 1.10 2025/01/15 10:54:17 tb Exp $ 1# $OpenBSD: Makefile,v 1.12 2025/07/25 16:33:15 tb Exp $
2 2
3LIBRARIES = libressl 3LIBRARIES = libressl
4.if exists(/usr/local/bin/eopenssl33) 4.if exists(/usr/local/bin/eopenssl35)
5LIBRARIES += openssl33 5LIBRARIES += openssl35
6.endif
7.if exists(/usr/local/bin/eopenssl34)
8LIBRARIES += openssl34
9.endif 6.endif
10 7
11# run netcat server and connect with test client 8# run netcat server and connect with test client
diff --git a/src/regress/lib/libssl/interop/openssl33/Makefile b/src/regress/lib/libssl/interop/openssl33/Makefile
deleted file mode 100644
index eff61704d0..0000000000
--- a/src/regress/lib/libssl/interop/openssl33/Makefile
+++ /dev/null
@@ -1,44 +0,0 @@
1# $OpenBSD: Makefile,v 1.1 2025/01/15 10:54:17 tb Exp $
2
3.if ! exists(/usr/local/bin/eopenssl33)
4regress:
5 # install openssl-3.3 from ports for interop tests
6 @echo 'Run "pkg_add openssl--%3.3" to run tests against OpenSSL 3.3'
7 @echo SKIPPED
8.else
9
10PROGS = client server
11CFLAGS += -DOPENSSL_SUPPRESS_DEPRECATED
12CPPFLAGS = -I /usr/local/include/eopenssl33
13LDFLAGS = -L /usr/local/lib/eopenssl33
14LDADD = -lssl -lcrypto
15DPADD = /usr/local/lib/eopenssl33/libssl.a \
16 /usr/local/lib/eopenssl33/libcrypto.a
17LD_LIBRARY_PATH = /usr/local/lib/eopenssl33
18REGRESS_TARGETS = run-self-client-server
19.for p in ${PROGS}
20REGRESS_TARGETS += run-ldd-$p run-version-$p run-protocol-$p
21.endfor
22
23.for p in ${PROGS}
24
25run-ldd-$p: ldd-$p.out
26 # check that $p is linked with OpenSSL 3.3
27 grep -q /usr/local/lib/eopenssl33/libcrypto.so ldd-$p.out
28 grep -q /usr/local/lib/eopenssl33/libssl.so ldd-$p.out
29 # check that $p is not linked with LibreSSL
30 ! grep -v libc.so ldd-$p.out | grep /usr/lib/
31
32run-version-$p: $p-self.out
33 # check that runtime version is OpenSSL 3.3
34 grep 'SSLEAY_VERSION: OpenSSL 3.3' $p-self.out
35
36run-protocol-$p: $p-self.out
37 # check that OpenSSL 3.3 protocol version is TLS 1.3
38 grep 'Protocol *: TLSv1.3' $p-self.out
39
40.endfor
41
42.endif # exists(/usr/local/bin/eopenssl33)
43
44.include <bsd.regress.mk>
diff --git a/src/regress/lib/libssl/interop/openssl34/Makefile b/src/regress/lib/libssl/interop/openssl34/Makefile
deleted file mode 100644
index 72246bb621..0000000000
--- a/src/regress/lib/libssl/interop/openssl34/Makefile
+++ /dev/null
@@ -1,44 +0,0 @@
1# $OpenBSD: Makefile,v 1.1 2025/01/15 10:54:17 tb Exp $
2
3.if ! exists(/usr/local/bin/eopenssl34)
4regress:
5 # install openssl-3.4 from ports for interop tests
6 @echo 'Run "pkg_add openssl--%3.4" to run tests against OpenSSL 3.4'
7 @echo SKIPPED
8.else
9
10PROGS = client server
11CFLAGS += -DOPENSSL_SUPPRESS_DEPRECATED
12CPPFLAGS = -I /usr/local/include/eopenssl34
13LDFLAGS = -L /usr/local/lib/eopenssl34
14LDADD = -lssl -lcrypto
15DPADD = /usr/local/lib/eopenssl34/libssl.a \
16 /usr/local/lib/eopenssl34/libcrypto.a
17LD_LIBRARY_PATH = /usr/local/lib/eopenssl34
18REGRESS_TARGETS = run-self-client-server
19.for p in ${PROGS}
20REGRESS_TARGETS += run-ldd-$p run-version-$p run-protocol-$p
21.endfor
22
23.for p in ${PROGS}
24
25run-ldd-$p: ldd-$p.out
26 # check that $p is linked with OpenSSL 3.4
27 grep -q /usr/local/lib/eopenssl34/libcrypto.so ldd-$p.out
28 grep -q /usr/local/lib/eopenssl34/libssl.so ldd-$p.out
29 # check that $p is not linked with LibreSSL
30 ! grep -v libc.so ldd-$p.out | grep /usr/lib/
31
32run-version-$p: $p-self.out
33 # check that runtime version is OpenSSL 3.4
34 grep 'SSLEAY_VERSION: OpenSSL 3.4' $p-self.out
35
36run-protocol-$p: $p-self.out
37 # check that OpenSSL 3.4 protocol version is TLS 1.3
38 grep 'Protocol *: TLSv1.3' $p-self.out
39
40.endfor
41
42.endif # exists(/usr/local/bin/eopenssl34)
43
44.include <bsd.regress.mk>
diff --git a/src/regress/lib/libssl/interop/openssl35/Makefile b/src/regress/lib/libssl/interop/openssl35/Makefile
new file mode 100644
index 0000000000..e11ad5dd20
--- /dev/null
+++ b/src/regress/lib/libssl/interop/openssl35/Makefile
@@ -0,0 +1,44 @@
1# $OpenBSD: Makefile,v 1.1 2025/07/09 17:48:02 tb Exp $
2
3.if ! exists(/usr/local/bin/eopenssl35)
4regress:
5 # install openssl-3.5 from ports for interop tests
6 @echo 'Run "pkg_add openssl--%3.5" to run tests against OpenSSL 3.5'
7 @echo SKIPPED
8.else
9
10PROGS = client server
11CFLAGS += -DOPENSSL_SUPPRESS_DEPRECATED
12CPPFLAGS = -I /usr/local/include/eopenssl35
13LDFLAGS = -L /usr/local/lib/eopenssl35
14LDADD = -lssl -lcrypto
15DPADD = /usr/local/lib/eopenssl35/libssl.a \
16 /usr/local/lib/eopenssl35/libcrypto.a
17LD_LIBRARY_PATH = /usr/local/lib/eopenssl35
18REGRESS_TARGETS = run-self-client-server
19.for p in ${PROGS}
20REGRESS_TARGETS += run-ldd-$p run-version-$p run-protocol-$p
21.endfor
22
23.for p in ${PROGS}
24
25run-ldd-$p: ldd-$p.out
26 # check that $p is linked with OpenSSL 3.5
27 grep -q /usr/local/lib/eopenssl35/libcrypto.so ldd-$p.out
28 grep -q /usr/local/lib/eopenssl35/libssl.so ldd-$p.out
29 # check that $p is not linked with LibreSSL
30 ! grep -v -e libc.so -e libpthread.so ldd-$p.out | grep /usr/lib/
31
32run-version-$p: $p-self.out
33 # check that runtime version is OpenSSL 3.5
34 grep 'SSLEAY_VERSION: OpenSSL 3.5' $p-self.out
35
36run-protocol-$p: $p-self.out
37 # check that OpenSSL 3.5 protocol version is TLS 1.3
38 grep 'Protocol *: TLSv1.3' $p-self.out
39
40.endfor
41
42.endif # exists(/usr/local/bin/eopenssl35)
43
44.include <bsd.regress.mk>
diff --git a/src/regress/lib/libssl/interop/session/Makefile b/src/regress/lib/libssl/interop/session/Makefile
index e9a353f99e..fff66b169b 100644
--- a/src/regress/lib/libssl/interop/session/Makefile
+++ b/src/regress/lib/libssl/interop/session/Makefile
@@ -1,11 +1,8 @@
1# $OpenBSD: Makefile,v 1.12 2025/01/15 10:54:17 tb Exp $ 1# $OpenBSD: Makefile,v 1.14 2025/07/25 16:33:15 tb Exp $
2 2
3LIBRARIES = libressl 3LIBRARIES = libressl
4.if exists(/usr/local/bin/eopenssl33) 4.if exists(/usr/local/bin/eopenssl35)
5#LIBRARIES += openssl33 5#LIBRARIES += openssl35
6.endif
7.if exists(/usr/local/bin/eopenssl34)
8#LIBRARIES += openssl34
9.endif 6.endif
10 7
11run-session-client-libressl-server-libressl: 8run-session-client-libressl-server-libressl:
diff --git a/src/regress/lib/libssl/interop/version/Makefile b/src/regress/lib/libssl/interop/version/Makefile
index 605fba252f..5ee7d4c4f3 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.10 2025/01/15 10:54:17 tb Exp $ 1# $OpenBSD: Makefile,v 1.12 2025/07/25 16:33:15 tb 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
@@ -7,11 +7,8 @@
7# print out. 7# print out.
8 8
9LIBRARIES = libressl 9LIBRARIES = libressl
10.if exists(/usr/local/bin/eopenssl33) 10.if exists(/usr/local/bin/eopenssl35)
11LIBRARIES += openssl33 11LIBRARIES += openssl35
12.endif
13.if exists(/usr/local/bin/eopenssl34)
14LIBRARIES += openssl34
15.endif 12.endif
16 13
17VERSIONS = any TLS1_2 TLS1_3 14VERSIONS = any TLS1_2 TLS1_3
@@ -29,8 +26,7 @@ FAIL_${cver}_${sver} = !
29.for slib in ${LIBRARIES} 26.for slib in ${LIBRARIES}
30 27
31.if ("${cver}" != TLS1_3 && "${sver}" != TLS1_3) && \ 28.if ("${cver}" != TLS1_3 && "${sver}" != TLS1_3) && \
32 ((("${clib}" != openssl33 && "${slib}" != openssl33)) || \ 29 ((("${clib}" != openssl35 && "${slib}" != openssl35)) || \
33 (("${clib}" != openssl34 && "${slib}" != openssl34)) || \
34 (("${cver}" != any && "${sver}" != any) && \ 30 (("${cver}" != any && "${sver}" != any) && \
35 ("${cver}" != TLS1 && "${sver}" != TLS1) && \ 31 ("${cver}" != TLS1 && "${sver}" != TLS1) && \
36 ("${cver}" != TLS1_1 && "${sver}" != TLS1_1))) 32 ("${cver}" != TLS1_1 && "${sver}" != TLS1_1)))
diff --git a/src/regress/lib/libssl/openssl-ruby/Makefile b/src/regress/lib/libssl/openssl-ruby/Makefile
index af8083f662..19d2f2fc40 100644
--- a/src/regress/lib/libssl/openssl-ruby/Makefile
+++ b/src/regress/lib/libssl/openssl-ruby/Makefile
@@ -1,10 +1,10 @@
1# $OpenBSD: Makefile,v 1.14 2024/08/31 11:14:58 tb Exp $ 1# $OpenBSD: Makefile,v 1.17 2025/06/27 03:32:08 tb Exp $
2 2
3OPENSSL_RUBY_TESTS = /usr/local/share/openssl-ruby-tests 3OPENSSL_RUBY_TESTS = /usr/local/share/openssl-ruby-tests
4.if exists(/usr/local/bin/ruby32) 4.if exists(/usr/local/bin/ruby33)
5RUBY_BINREV = 32
6.else
7RUBY_BINREV = 33 5RUBY_BINREV = 33
6.else
7RUBY_BINREV = 34
8.endif 8.endif
9RUBY = ruby${RUBY_BINREV} 9RUBY = ruby${RUBY_BINREV}
10 10
@@ -71,6 +71,21 @@ ${_t}: ${_BUILD_COOKIE}
71 -n ${_t} 71 -n ${_t}
72.endfor 72.endfor
73 73
74# These tests can be a pain to run. To run a small set of individual
75# ssl tests, set the test names separated by spaces in the environment
76# variable RUBY_SSL_TEST_TARGETS - then you can type "make <test_name>"
77# to run a single ruby ssl test.
78.for _t in ${RUBY_SSL_TEST_TARGETS}
79REGRESS_TARGETS += ${_t}
80REGRESS_EXPECTED_FAILURES += ${_t}
81${_t}: ${_BUILD_COOKIE}
82 cd ${BUILDDIR} && \
83 ${RUBY} -I. -I${OPENSSL_RUBY_TESTS}/test/openssl \
84 -I${OPENSSL_RUBY_TESTS}/lib \
85 ${OPENSSL_RUBY_TESTS}/test/openssl/test_ssl.rb \
86 -n ${_t}
87.endfor
88
74CLEANFILES += ${_BUILD_COOKIE} ${_TEST_COOKIE} ${_BUILDDIR_COOKIE} 89CLEANFILES += ${_BUILD_COOKIE} ${_TEST_COOKIE} ${_BUILDDIR_COOKIE}
75 90
76. if make(clean) || make(cleandir) 91. if make(clean) || make(cleandir)
diff --git a/src/regress/lib/libssl/pqueue/Makefile b/src/regress/lib/libssl/pqueue/Makefile
index 48c2cb7e61..05fe9a268d 100644
--- a/src/regress/lib/libssl/pqueue/Makefile
+++ b/src/regress/lib/libssl/pqueue/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.1 2016/11/04 19:45:12 jsing Exp $ 1# $OpenBSD: Makefile,v 1.2 2025/05/04 11:04:02 tb Exp $
2 2
3PROG= pq_test 3PROG= pq_test
4SRC= ${.CURDIR}/../../../../lib/libssl 4SRC= ${.CURDIR}/../../../../lib/libssl
@@ -9,9 +9,4 @@ DPADD= ${LIBSSL} ${LIBCRYPTO}
9WARNINGS= Yes 9WARNINGS= Yes
10CFLAGS+= -DLIBRESSL_INTERNAL -Werror 10CFLAGS+= -DLIBRESSL_INTERNAL -Werror
11 11
12REGRESS_TARGETS= regress-pq_test
13
14regress-pq_test: ${PROG}
15 ${.OBJDIR}/pq_test | cmp -s ${.CURDIR}/expected.txt /dev/stdin
16
17.include <bsd.regress.mk> 12.include <bsd.regress.mk>
diff --git a/src/regress/lib/libssl/pqueue/expected.txt b/src/regress/lib/libssl/pqueue/expected.txt
deleted file mode 100644
index c59d6cd838..0000000000
--- a/src/regress/lib/libssl/pqueue/expected.txt
+++ /dev/null
@@ -1,3 +0,0 @@
1item 6966726167696c69
2item 7374696365787069
3item 737570657263616c
diff --git a/src/regress/lib/libssl/pqueue/pq_test.c b/src/regress/lib/libssl/pqueue/pq_test.c
index a078ba5366..822fdea961 100644
--- a/src/regress/lib/libssl/pqueue/pq_test.c
+++ b/src/regress/lib/libssl/pqueue/pq_test.c
@@ -59,60 +59,77 @@
59#include <stdio.h> 59#include <stdio.h>
60#include <stdlib.h> 60#include <stdlib.h>
61#include <string.h> 61#include <string.h>
62
62#include "pqueue.h" 63#include "pqueue.h"
63 64
64/* remember to change expected.txt if you change these values */ 65static const unsigned char *pq_expected[3] = {
65unsigned char prio1[8] = "supercal"; 66 "ifragili",
66unsigned char prio2[8] = "ifragili"; 67 "sticexpi",
67unsigned char prio3[8] = "sticexpi"; 68 "supercal"
69};
68 70
69static void 71static int
70pqueue_print(pqueue pq) 72test_pqueue(void)
71{ 73{
72 pitem *iter, *item; 74 const unsigned char *prio1 = pq_expected[2];
73 75 const unsigned char *prio2 = pq_expected[0];
74 iter = pqueue_iterator(pq); 76 const unsigned char *prio3 = pq_expected[1];
75 for (item = pqueue_next(&iter); item != NULL; 77 pqueue pq = NULL;
76 item = pqueue_next(&iter)) { 78 pitem *item = NULL;
77 printf("item\t%02x%02x%02x%02x%02x%02x%02x%02x\n", 79 pitem *iter = NULL;
78 item->priority[0], item->priority[1], 80 int i = 0;
79 item->priority[2], item->priority[3], 81 int failed = 1;
80 item->priority[4], item->priority[5],
81 item->priority[6], item->priority[7]);
82 }
83}
84 82
85int 83 if ((pq = pqueue_new()) == NULL)
86main(void) 84 goto failure;
87{
88 pitem *item;
89 pqueue pq;
90 85
91 pq = pqueue_new(); 86 if (!pqueue_insert(pq, pitem_new(prio3, NULL)))
87 goto failure;
88 if (!pqueue_insert(pq, pitem_new(prio1, NULL)))
89 goto failure;
90 if (!pqueue_insert(pq, pitem_new(prio2, NULL)))
91 goto failure;
92 92
93 item = pitem_new(prio3, NULL); 93 if (pqueue_size(pq) != 3)
94 pqueue_insert(pq, item); 94 goto failure;
95 95
96 item = pitem_new(prio1, NULL); 96 if ((item = pqueue_find(pq, prio1)) == NULL)
97 pqueue_insert(pq, item); 97 goto failure;
98 if ((item = pqueue_find(pq, prio2)) == NULL)
99 goto failure;
100 if ((item = pqueue_find(pq, prio3)) == NULL)
101 goto failure;
98 102
99 item = pitem_new(prio2, NULL); 103 if ((item = pqueue_peek(pq)) == NULL)
100 pqueue_insert(pq, item); 104 goto failure;
101 105
102 item = pqueue_find(pq, prio1); 106 if (memcmp(item->priority, pq_expected[0], 8))
103 fprintf(stderr, "found %p\n", item->priority); 107 goto failure;
104 108
105 item = pqueue_find(pq, prio2); 109 iter = pqueue_iterator(pq);
106 fprintf(stderr, "found %p\n", item->priority); 110 for (item = pqueue_next(&iter); item != NULL; item = pqueue_next(&iter)) {
111 if (memcmp(item->priority, pq_expected[i], 8) != 0)
112 goto failure;
113 i++;
114 }
107 115
108 item = pqueue_find(pq, prio3); 116 failed = (i != 3);
109 fprintf(stderr, "found %p\n", item ? item->priority: 0);
110 117
111 pqueue_print(pq); 118 failure:
112 119
113 for (item = pqueue_pop(pq); item != NULL; item = pqueue_pop(pq)) 120 for (item = pqueue_pop(pq); item != NULL; item = pqueue_pop(pq))
114 pitem_free(item); 121 pitem_free(item);
115
116 pqueue_free(pq); 122 pqueue_free(pq);
117 return 0; 123
124 return failed;
125}
126
127int
128main(void)
129{
130 int failed = 0;
131
132 failed |= test_pqueue();
133
134 return failed;
118} 135}
diff --git a/src/regress/lib/libssl/tlsext/tlsexttest.c b/src/regress/lib/libssl/tlsext/tlsexttest.c
index 4adf27421d..68584998ce 100644
--- a/src/regress/lib/libssl/tlsext/tlsexttest.c
+++ b/src/regress/lib/libssl/tlsext/tlsexttest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tlsexttest.c,v 1.92 2024/09/11 15:04:16 tb Exp $ */ 1/* $OpenBSD: tlsexttest.c,v 1.94 2025/05/03 08:37:28 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2017 Doug Hogan <doug@openbsd.org> 4 * Copyright (c) 2017 Doug Hogan <doug@openbsd.org>
@@ -3740,6 +3740,11 @@ test_tlsext_keyshare_client(void)
3740 FAIL("Did not select a key share"); 3740 FAIL("Did not select a key share");
3741 goto done; 3741 goto done;
3742 } 3742 }
3743 if (tls_key_share_group(ssl->s3->hs.key_share) != 29) {
3744 FAIL("wrong key share group: got %d, expected 29\n",
3745 tls_key_share_group(ssl->s3->hs.key_share));
3746 goto done;
3747 }
3743 3748
3744 /* 3749 /*
3745 * Pretend the client did not send the supported groups extension. We 3750 * Pretend the client did not send the supported groups extension. We
@@ -4542,12 +4547,10 @@ test_tlsext_valid_hostnames(void)
4542#define N_TLSEXT_RANDOMIZATION_TESTS 1000 4547#define N_TLSEXT_RANDOMIZATION_TESTS 1000
4543 4548
4544static int 4549static int
4545test_tlsext_check_extension_order(SSL *ssl) 4550test_tlsext_check_psk_is_last_extension(SSL *ssl)
4546{ 4551{
4547 const struct tls_extension *ext; 4552 const struct tls_extension *ext;
4548 uint16_t type; 4553 uint16_t type;
4549 size_t alpn_idx, sni_idx;
4550 size_t i;
4551 4554
4552 if (ssl->tlsext_build_order_len == 0) { 4555 if (ssl->tlsext_build_order_len == 0) {
4553 FAIL("Unexpected zero build order length"); 4556 FAIL("Unexpected zero build order length");
@@ -4560,34 +4563,6 @@ test_tlsext_check_extension_order(SSL *ssl)
4560 return 1; 4563 return 1;
4561 } 4564 }
4562 4565
4563 if (ssl->server)
4564 return 0;
4565
4566 alpn_idx = sni_idx = ssl->tlsext_build_order_len;
4567 for (i = 0; i < ssl->tlsext_build_order_len; i++) {
4568 ext = ssl->tlsext_build_order[i];
4569 if (tls_extension_type(ext) == TLSEXT_TYPE_alpn)
4570 alpn_idx = i;
4571 if (tls_extension_type(ext) == TLSEXT_TYPE_server_name)
4572 sni_idx = i;
4573 }
4574
4575 if (alpn_idx == ssl->tlsext_build_order_len) {
4576 FAIL("could not find alpn extension\n");
4577 return 1;
4578 }
4579
4580 if (sni_idx == ssl->tlsext_build_order_len) {
4581 FAIL("could not find alpn extension\n");
4582 return 1;
4583 }
4584
4585 if (sni_idx >= alpn_idx) {
4586 FAIL("sni does not precede alpn: %zu >= %zu\n",
4587 sni_idx, alpn_idx);
4588 return 1;
4589 }
4590
4591 return 0; 4566 return 0;
4592} 4567}
4593 4568
@@ -4600,7 +4575,7 @@ test_tlsext_randomized_extensions(SSL *ssl)
4600 for (i = 0; i < N_TLSEXT_RANDOMIZATION_TESTS; i++) { 4575 for (i = 0; i < N_TLSEXT_RANDOMIZATION_TESTS; i++) {
4601 if (!tlsext_randomize_build_order(ssl)) 4576 if (!tlsext_randomize_build_order(ssl))
4602 errx(1, "failed to randomize extensions"); 4577 errx(1, "failed to randomize extensions");
4603 failed |= test_tlsext_check_extension_order(ssl); 4578 failed |= test_tlsext_check_psk_is_last_extension(ssl);
4604 } 4579 }
4605 4580
4606 return failed; 4581 return failed;
diff --git a/src/regress/lib/libssl/tlsfuzzer/tlsfuzzer.py b/src/regress/lib/libssl/tlsfuzzer/tlsfuzzer.py
index 91aedad165..ff678ec9a8 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.56 2024/09/18 19:12:37 tb Exp $ 1# $OpenBSD: tlsfuzzer.py,v 1.57 2025/06/15 09:44:57 tb Exp $
2# 2#
3# Copyright (c) 2020 Theo Buehler <tb@openbsd.org> 3# Copyright (c) 2020 Theo Buehler <tb@openbsd.org>
4# 4#
@@ -72,7 +72,7 @@ def substitute_alert(want, got):
72 return f"Expected alert description \"{want}\" " \ 72 return f"Expected alert description \"{want}\" " \
73 + f"does not match received \"{got}\"" 73 + f"does not match received \"{got}\""
74 74
75# test-tls13-finished.py has 70 failing tests that expect a "decode_error" 75# test_tls13_finished.py has 70 failing tests that expect a "decode_error"
76# instead of the "decrypt_error" sent by tls13_server_finished_recv(). 76# instead of the "decrypt_error" sent by tls13_server_finished_recv().
77# Both alerts appear to be reasonable in this context, so work around this 77# Both alerts appear to be reasonable in this context, so work around this
78# in the test instead of the library. 78# in the test instead of the library.
@@ -164,46 +164,46 @@ def generate_test_tls13_finished_args():
164 return args 164 return args
165 165
166tls13_tests = TestGroup("TLSv1.3 tests", [ 166tls13_tests = TestGroup("TLSv1.3 tests", [
167 Test("test-tls13-ccs.py"), 167 Test("test_tls13_ccs.py"),
168 Test("test-tls13-conversation.py"), 168 Test("test_tls13_conversation.py"),
169 Test("test-tls13-count-tickets.py"), 169 Test("test_tls13_count_tickets.py"),
170 Test("test-tls13-empty-alert.py"), 170 Test("test_tls13_empty_alert.py"),
171 Test("test-tls13-finished.py", generate_test_tls13_finished_args()), 171 Test("test_tls13_finished.py", generate_test_tls13_finished_args()),
172 Test("test-tls13-finished-plaintext.py"), 172 Test("test_tls13_finished_plaintext.py"),
173 Test("test-tls13-hrr.py"), 173 Test("test_tls13_hrr.py"),
174 Test("test-tls13-keyshare-omitted.py"), 174 Test("test_tls13_keyshare_omitted.py"),
175 Test("test-tls13-legacy-version.py"), 175 Test("test_tls13_legacy_version.py"),
176 Test("test-tls13-nociphers.py"), 176 Test("test_tls13_nociphers.py"),
177 Test("test-tls13-record-padding.py"), 177 Test("test_tls13_record_padding.py"),
178 # Exclude QUIC transport parameters 178 # Exclude QUIC transport parameters
179 Test("test-tls13-shuffled-extentions.py", [ "--exc", "57" ]), 179 Test("test_tls13_shuffled_extentions.py", [ "--exc", "57" ]),
180 Test("test-tls13-zero-content-type.py"), 180 Test("test_tls13_zero_content_type.py"),
181 181
182 # The skipped tests fail due to a bug in BIO_gets() which masks the retry 182 # The skipped tests fail due to a bug in BIO_gets() which masks the retry
183 # signalled from an SSL_read() failure. Testing with httpd(8) shows we're 183 # signalled from an SSL_read() failure. Testing with httpd(8) shows we're
184 # handling these corner cases correctly since tls13_record_layer.c -r1.47. 184 # handling these corner cases correctly since tls13_record_layer.c -r1.47.
185 Test("test-tls13-zero-length-data.py", [ 185 Test("test_tls13_zero_length_data.py", [
186 "-e", "zero-length app data", 186 "-e", "zero-length app data",
187 "-e", "zero-length app data with large padding", 187 "-e", "zero-length app data with large padding",
188 "-e", "zero-length app data with padding", 188 "-e", "zero-length app data with padding",
189 ]), 189 ]),
190 190
191 # We don't currently handle NSTs 191 # We don't currently handle NSTs
192 Test("test-tls13-connection-abort.py", ["-e", "After NewSessionTicket"]), 192 Test("test_tls13_connection_abort.py", ["-e", "After NewSessionTicket"]),
193]) 193])
194 194
195# Tests that take a lot of time (> ~30s on an x280) 195# Tests that take a lot of time (> ~30s on an x280)
196tls13_slow_tests = TestGroup("slow TLSv1.3 tests", [ 196tls13_slow_tests = TestGroup("slow TLSv1.3 tests", [
197 # XXX: Investigate the occasional message 197 # XXX: Investigate the occasional message
198 # "Got shared secret with 1 most significant bytes equal to zero." 198 # "Got shared secret with 1 most significant bytes equal to zero."
199 Test("test-tls13-dhe-shared-secret-padding.py", tls13_unsupported_ciphers), 199 Test("test_tls13_dhe_shared_secret_padding.py", tls13_unsupported_ciphers),
200 200
201 Test("test-tls13-invalid-ciphers.py"), 201 Test("test_tls13_invalid_ciphers.py"),
202 Test("test-tls13-serverhello-random.py", tls13_unsupported_ciphers), 202 Test("test_tls13_serverhello_random.py", tls13_unsupported_ciphers),
203 203
204 # Mark two tests cases as xfail for now. The tests expect an arguably 204 # Mark two tests cases as xfail for now. The tests expect an arguably
205 # correct decode_error while we send a decrypt_error (like fizz/boring). 205 # correct decode_error while we send a decrypt_error (like fizz/boring).
206 Test("test-tls13-record-layer-limits.py", [ 206 Test("test_tls13_record_layer_limits.py", [
207 "-x", "max size payload (2**14) of Finished msg, with 16348 bytes of left padding, cipher TLS_AES_128_GCM_SHA256", 207 "-x", "max size payload (2**14) of Finished msg, with 16348 bytes of left padding, cipher TLS_AES_128_GCM_SHA256",
208 "-X", substitute_alert("decode_error", "decrypt_error"), 208 "-X", substitute_alert("decode_error", "decrypt_error"),
209 "-x", "max size payload (2**14) of Finished msg, with 16348 bytes of left padding, cipher TLS_CHACHA20_POLY1305_SHA256", 209 "-x", "max size payload (2**14) of Finished msg, with 16348 bytes of left padding, cipher TLS_CHACHA20_POLY1305_SHA256",
@@ -212,22 +212,22 @@ tls13_slow_tests = TestGroup("slow TLSv1.3 tests", [
212 # We don't accept an empty ECPF extension since it must advertise the 212 # We don't accept an empty ECPF extension since it must advertise the
213 # uncompressed point format. Exclude this extension type from the test. 213 # uncompressed point format. Exclude this extension type from the test.
214 Test( 214 Test(
215 "test-tls13-large-number-of-extensions.py", 215 "test_tls13_large_number_of_extensions.py",
216 tls13_args = ["--exc", "11"], 216 tls13_args = ["--exc", "11"],
217 ), 217 ),
218]) 218])
219 219
220tls13_extra_cert_tests = TestGroup("TLSv1.3 certificate tests", [ 220tls13_extra_cert_tests = TestGroup("TLSv1.3 certificate tests", [
221 # need to set up client certs to run these 221 # need to set up client certs to run these
222 Test("test-tls13-certificate-request.py"), 222 Test("test_tls13_certificate_request.py"),
223 Test("test-tls13-certificate-verify.py"), 223 Test("test_tls13_certificate_verify.py"),
224 Test("test-tls13-ecdsa-in-certificate-verify.py"), 224 Test("test_tls13_ecdsa_in_certificate_verify.py"),
225 Test("test-tls13-eddsa-in-certificate-verify.py"), 225 Test("test_tls13_eddsa_in_certificate_verify.py"),
226 226
227 # Test expects the server to have installed three certificates: 227 # Test expects the server to have installed three certificates:
228 # with P-256, P-384 and P-521 curve. Also SHA1+ECDSA is verified 228 # with P-256, P-384 and P-521 curve. Also SHA1+ECDSA is verified
229 # to not work. 229 # to not work.
230 Test("test-tls13-ecdsa-support.py"), 230 Test("test_tls13_ecdsa_support.py"),
231]) 231])
232 232
233tls13_failing_tests = TestGroup("failing TLSv1.3 tests", [ 233tls13_failing_tests = TestGroup("failing TLSv1.3 tests", [
@@ -235,7 +235,7 @@ tls13_failing_tests = TestGroup("failing TLSv1.3 tests", [
235 # With X25519, we accept weak peer public keys and fail when we actually 235 # With X25519, we accept weak peer public keys and fail when we actually
236 # compute the keyshare. Other tests seem to indicate that we could be 236 # compute the keyshare. Other tests seem to indicate that we could be
237 # stricter about what keyshares we accept. 237 # stricter about what keyshares we accept.
238 Test("test-tls13-crfg-curves.py", [ 238 Test("test_tls13_crfg_curves.py", [
239 '-e', 'all zero x448 key share', 239 '-e', 'all zero x448 key share',
240 '-e', 'empty x448 key share', 240 '-e', 'empty x448 key share',
241 '-e', 'sanity x448 with compression ansiX962_compressed_char2', 241 '-e', 'sanity x448 with compression ansiX962_compressed_char2',
@@ -245,7 +245,7 @@ tls13_failing_tests = TestGroup("failing TLSv1.3 tests", [
245 '-e', 'too small x448 key share', 245 '-e', 'too small x448 key share',
246 '-e', 'x448 key share of "1"', 246 '-e', 'x448 key share of "1"',
247 ]), 247 ]),
248 Test("test-tls13-ecdhe-curves.py", [ 248 Test("test_tls13_ecdhe_curves.py", [
249 '-e', 'sanity - x448', 249 '-e', 'sanity - x448',
250 '-e', 'x448 - key share from other curve', 250 '-e', 'x448 - key share from other curve',
251 '-e', 'x448 - point at infinity', 251 '-e', 'x448 - point at infinity',
@@ -258,21 +258,21 @@ tls13_failing_tests = TestGroup("failing TLSv1.3 tests", [
258 # We have the logic corresponding to NSS's fix for CVE-2020-25648 258 # We have the logic corresponding to NSS's fix for CVE-2020-25648
259 # https://hg.mozilla.org/projects/nss/rev/57bbefa793232586d27cee83e74411171e128361 259 # https://hg.mozilla.org/projects/nss/rev/57bbefa793232586d27cee83e74411171e128361
260 # so should not be affected by this issue. 260 # so should not be affected by this issue.
261 Test("test-tls13-multiple-ccs-messages.py"), 261 Test("test_tls13_multiple_ccs_messages.py"),
262 262
263 # https://github.com/openssl/openssl/issues/8369 263 # https://github.com/openssl/openssl/issues/8369
264 Test("test-tls13-obsolete-curves.py"), 264 Test("test_tls13_obsolete_curves.py"),
265 265
266 # 3 failing rsa_pss_pss tests 266 # 3 failing rsa_pss_pss tests
267 Test("test-tls13-rsa-signatures.py"), 267 Test("test_tls13_rsa_signatures.py"),
268 268
269 # The failing tests all expect an ri extension. What's up with that? 269 # The failing tests all expect an ri extension. What's up with that?
270 Test("test-tls13-version-negotiation.py"), 270 Test("test_tls13_version_negotiation.py"),
271]) 271])
272 272
273tls13_slow_failing_tests = TestGroup("slow, failing TLSv1.3 tests", [ 273tls13_slow_failing_tests = TestGroup("slow, failing TLSv1.3 tests", [
274 # Other test failures bugs in keyshare/tlsext negotiation? 274 # Other test failures bugs in keyshare/tlsext negotiation?
275 Test("test-tls13-unrecognised-groups.py"), # unexpected closure 275 Test("test_tls13_unrecognised_groups.py"), # unexpected closure
276 276
277 # 5 occasional failures: 277 # 5 occasional failures:
278 # 'app data split, conversation with KeyUpdate msg' 278 # 'app data split, conversation with KeyUpdate msg'
@@ -280,43 +280,43 @@ tls13_slow_failing_tests = TestGroup("slow, failing TLSv1.3 tests", [
280 # 'multiple KeyUpdate messages' 280 # 'multiple KeyUpdate messages'
281 # 'post-handshake KeyUpdate msg with update_not_request' 281 # 'post-handshake KeyUpdate msg with update_not_request'
282 # 'post-handshake KeyUpdate msg with update_request' 282 # 'post-handshake KeyUpdate msg with update_request'
283 Test("test-tls13-keyupdate.py"), 283 Test("test_tls13_keyupdate.py"),
284 284
285 Test("test-tls13-symetric-ciphers.py"), # unexpected message from peer 285 Test("test_tls13_symetric_ciphers.py"), # unexpected message from peer
286 286
287 # 6 tests fail: 'rsa_pkcs1_{md5,sha{1,224,256,384,512}} signature' 287 # 6 tests fail: 'rsa_pkcs1_{md5,sha{1,224,256,384,512}} signature'
288 # We send server hello, but the test expects handshake_failure 288 # We send server hello, but the test expects handshake_failure
289 Test("test-tls13-pkcs-signature.py"), 289 Test("test_tls13_pkcs_signature.py"),
290 # 8 tests fail: 'tls13 signature rsa_pss_{pss,rsae}_sha{256,384,512} 290 # 8 tests fail: 'tls13 signature rsa_pss_{pss,rsae}_sha{256,384,512}
291 Test("test-tls13-rsapss-signatures.py"), 291 Test("test_tls13_rsapss_signatures.py"),
292]) 292])
293 293
294tls13_unsupported_tests = TestGroup("TLSv1.3 tests for unsupported features", [ 294tls13_unsupported_tests = TestGroup("TLSv1.3 tests for unsupported features", [
295 # Tests for features we don't support 295 # Tests for features we don't support
296 Test("test-tls13-0rtt-garbage.py"), 296 Test("test_tls13_0rtt_garbage.py"),
297 Test("test-tls13-ffdhe-groups.py"), 297 Test("test_tls13_ffdhe_groups.py"),
298 Test("test-tls13-ffdhe-sanity.py"), 298 Test("test_tls13_ffdhe_sanity.py"),
299 Test("test-tls13-psk_dhe_ke.py"), 299 Test("test_tls13_psk_dhe_ke.py"),
300 Test("test-tls13-psk_ke.py"), 300 Test("test_tls13_psk_ke.py"),
301 301
302 # need server to react to HTTP GET for /keyupdate 302 # need server to react to HTTP GET for /keyupdate
303 Test("test-tls13-keyupdate-from-server.py"), 303 Test("test_tls13_keyupdate_from_server.py"),
304 304
305 # needs an echo server 305 # needs an echo server
306 Test("test-tls13-lengths.py"), 306 Test("test_tls13_lengths.py"),
307 307
308 # Weird test: tests servers that don't support 1.3 308 # Weird test: tests servers that don't support 1.3
309 Test("test-tls13-non-support.py"), 309 Test("test_tls13_non_support.py"),
310 310
311 # broken test script 311 # broken test script
312 # UnboundLocalError: local variable 'cert' referenced before assignment 312 # UnboundLocalError: local variable 'cert' referenced before assignment
313 Test("test-tls13-post-handshake-auth.py"), 313 Test("test_tls13_post_handshake_auth.py"),
314 314
315 # ExpectNewSessionTicket 315 # ExpectNewSessionTicket
316 Test("test-tls13-session-resumption.py"), 316 Test("test_tls13_session_resumption.py"),
317 317
318 # Server must be configured to support only rsa_pss_rsae_sha512 318 # Server must be configured to support only rsa_pss_rsae_sha512
319 Test("test-tls13-signature-algorithms.py"), 319 Test("test_tls13_signature_algorithms.py"),
320]) 320])
321 321
322tls12_exclude_legacy_protocols = [ 322tls12_exclude_legacy_protocols = [
@@ -345,52 +345,52 @@ tls12_exclude_legacy_protocols = [
345 345
346tls12_tests = TestGroup("TLSv1.2 tests", [ 346tls12_tests = TestGroup("TLSv1.2 tests", [
347 # Tests that pass as they are. 347 # Tests that pass as they are.
348 Test("test-aes-gcm-nonces.py"), 348 Test("test_aes_gcm_nonces.py"),
349 Test("test-connection-abort.py"), 349 Test("test_connection_abort.py"),
350 Test("test-conversation.py"), 350 Test("test_conversation.py"),
351 Test("test-cve-2016-2107.py"), 351 Test("test_cve_2016_2107.py"),
352 Test("test-cve-2016-6309.py"), 352 Test("test_cve_2016_6309.py"),
353 Test("test-dhe-rsa-key-exchange.py"), 353 Test("test_dhe_rsa_key_exchange.py"),
354 Test("test-early-application-data.py"), 354 Test("test_early_application_data.py"),
355 Test("test-empty-extensions.py"), 355 Test("test_empty_extensions.py"),
356 Test("test-extensions.py"), 356 Test("test_extensions.py"),
357 Test("test-fuzzed-MAC.py"), 357 Test("test_fuzzed_MAC.py"),
358 Test("test-fuzzed-ciphertext.py"), 358 Test("test_fuzzed_ciphertext.py"),
359 Test("test-fuzzed-finished.py"), 359 Test("test_fuzzed_finished.py"),
360 Test("test-fuzzed-padding.py"), 360 Test("test_fuzzed_padding.py"),
361 Test("test-fuzzed-plaintext.py"), # fails once in a while 361 Test("test_fuzzed_plaintext.py"), # fails once in a while
362 Test("test-hello-request-by-client.py"), 362 Test("test_hello_request_by_client.py"),
363 Test("test-invalid-cipher-suites.py"), 363 Test("test_invalid_cipher_suites.py"),
364 Test("test-invalid-content-type.py"), 364 Test("test_invalid_content_type.py"),
365 Test("test-invalid-session-id.py"), 365 Test("test_invalid_session_id.py"),
366 Test("test-invalid-version.py"), 366 Test("test_invalid_version.py"),
367 Test("test-large-number-of-extensions.py"), 367 Test("test_large_number_of_extensions.py"),
368 Test("test-lucky13.py"), 368 Test("test_lucky13.py"),
369 Test("test-message-skipping.py"), 369 Test("test_message_skipping.py"),
370 Test("test-no-heartbeat.py"), 370 Test("test_no_heartbeat.py"),
371 Test("test-record-layer-fragmentation.py"), 371 Test("test_record_layer_fragmentation.py"),
372 Test("test-sslv2-connection.py"), 372 Test("test_sslv2_connection.py"),
373 Test("test-truncating-of-finished.py"), 373 Test("test_truncating_of_finished.py"),
374 Test("test-truncating-of-kRSA-client-key-exchange.py"), 374 Test("test_truncating_of_kRSA_client_key_exchange.py"),
375 Test("test-unsupported-curve-fallback.py"), 375 Test("test_unsupported_curve_fallback.py"),
376 Test("test-version-numbers.py"), 376 Test("test_version_numbers.py"),
377 Test("test-zero-length-data.py"), 377 Test("test_zero_length_data.py"),
378 378
379 # Tests that need tweaking for unsupported features and ciphers. 379 # Tests that need tweaking for unsupported features and ciphers.
380 Test( 380 Test(
381 "test-atypical-padding.py", [ 381 "test_atypical_padding.py", [
382 "-e", "sanity - encrypt then MAC", 382 "-e", "sanity - encrypt then MAC",
383 "-e", "2^14 bytes of AppData with 256 bytes of padding (SHA1 + Encrypt then MAC)", 383 "-e", "2^14 bytes of AppData with 256 bytes of padding (SHA1 + Encrypt then MAC)",
384 ] 384 ]
385 ), 385 ),
386 Test( 386 Test(
387 "test-ccs.py", [ 387 "test_ccs.py", [
388 "-x", "two bytes long CCS", 388 "-x", "two bytes long CCS",
389 "-X", substitute_alert("unexpected_message", "decode_error"), 389 "-X", substitute_alert("unexpected_message", "decode_error"),
390 ] 390 ]
391 ), 391 ),
392 Test( 392 Test(
393 "test-dhe-rsa-key-exchange-signatures.py", [ 393 "test_dhe_rsa_key_exchange_signatures.py", [
394 "-e", "TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA sha224 signature", 394 "-e", "TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA sha224 signature",
395 "-e", "TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 sha224 signature", 395 "-e", "TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 sha224 signature",
396 "-e", "TLS_DHE_RSA_WITH_AES_128_CBC_SHA sha224 signature", 396 "-e", "TLS_DHE_RSA_WITH_AES_128_CBC_SHA sha224 signature",
@@ -398,14 +398,14 @@ tls12_tests = TestGroup("TLSv1.2 tests", [
398 "-e", "TLS_DHE_RSA_WITH_AES_256_CBC_SHA sha224 signature", 398 "-e", "TLS_DHE_RSA_WITH_AES_256_CBC_SHA sha224 signature",
399 ] 399 ]
400 ), 400 ),
401 Test("test-dhe-rsa-key-exchange-with-bad-messages.py", [ 401 Test("test_dhe_rsa_key_exchange_with_bad_messages.py", [
402 "-x", "invalid dh_Yc value - missing", 402 "-x", "invalid dh_Yc value - missing",
403 "-X", substitute_alert("decode_error", "illegal_parameter"), 403 "-X", substitute_alert("decode_error", "illegal_parameter"),
404 ]), 404 ]),
405 Test("test-dhe-key-share-random.py", tls12_exclude_legacy_protocols), 405 Test("test_dhe_key_share_random.py", tls12_exclude_legacy_protocols),
406 Test("test-export-ciphers-rejected.py", ["--min-ver", "TLSv1.2"]), 406 Test("test_export_ciphers_rejected.py", ["--min-ver", "TLSv1.2"]),
407 Test( 407 Test(
408 "test-downgrade-protection.py", 408 "test_downgrade_protection.py",
409 tls12_args = ["--server-max-protocol", "TLSv1.2"], 409 tls12_args = ["--server-max-protocol", "TLSv1.2"],
410 tls13_args = [ 410 tls13_args = [
411 "--server-max-protocol", "TLSv1.3", 411 "--server-max-protocol", "TLSv1.3",
@@ -414,7 +414,7 @@ tls12_tests = TestGroup("TLSv1.2 tests", [
414 ] 414 ]
415 ), 415 ),
416 Test( 416 Test(
417 "test-fallback-scsv.py", 417 "test_fallback_scsv.py",
418 tls13_args = [ 418 tls13_args = [
419 "--tls-1.3", 419 "--tls-1.3",
420 "-e", "FALLBACK - hello TLSv1.1 - pos 0", 420 "-e", "FALLBACK - hello TLSv1.1 - pos 0",
@@ -428,7 +428,7 @@ tls12_tests = TestGroup("TLSv1.2 tests", [
428 ] 428 ]
429 ), 429 ),
430 430
431 Test("test-invalid-compression-methods.py", [ 431 Test("test_invalid_compression_methods.py", [
432 "-x", "invalid compression methods", 432 "-x", "invalid compression methods",
433 "-X", substitute_alert("illegal_parameter", "decode_error"), 433 "-X", substitute_alert("illegal_parameter", "decode_error"),
434 "-x", "only deflate compression method", 434 "-x", "only deflate compression method",
@@ -437,134 +437,134 @@ tls12_tests = TestGroup("TLSv1.2 tests", [
437 437
438 # Skip extended_master_secret test. Since we don't support this 438 # Skip extended_master_secret test. Since we don't support this
439 # extension, we don't notice that it was dropped. 439 # extension, we don't notice that it was dropped.
440 Test("test-renegotiation-changed-clienthello.py", [ 440 Test("test_renegotiation_changed_clienthello.py", [
441 "-e", "drop extended_master_secret in renegotiation", 441 "-e", "drop extended_master_secret in renegotiation",
442 ]), 442 ]),
443 443
444 Test("test-sessionID-resumption.py", [ 444 Test("test_sessionID_resumption.py", [
445 "-x", "Client Hello too long session ID", 445 "-x", "Client Hello too long session ID",
446 "-X", substitute_alert("decode_error", "illegal_parameter"), 446 "-X", substitute_alert("decode_error", "illegal_parameter"),
447 ]), 447 ]),
448 448
449 # Without --sig-algs-drop-ok, two tests fail since we do not currently 449 # Without --sig-algs-drop-ok, two tests fail since we do not currently
450 # implement the signature_algorithms_cert extension (although we MUST). 450 # implement the signature_algorithms_cert extension (although we MUST).
451 Test("test-sig-algs-renegotiation-resumption.py", ["--sig-algs-drop-ok"]), 451 Test("test_sig_algs_renegotiation_resumption.py", ["--sig-algs-drop-ok"]),
452 452
453 Test("test-serverhello-random.py", args = tls12_exclude_legacy_protocols), 453 Test("test_serverhello_random.py", args = tls12_exclude_legacy_protocols),
454 454
455 Test("test-chacha20.py", [ "-e", "Chacha20 in TLS1.1" ]), 455 Test("test_chacha20.py", [ "-e", "Chacha20 in TLS1.1" ]),
456]) 456])
457 457
458tls12_slow_tests = TestGroup("slow TLSv1.2 tests", [ 458tls12_slow_tests = TestGroup("slow TLSv1.2 tests", [
459 Test("test-cve-2016-7054.py"), 459 Test("test_cve_2016_7054.py"),
460 Test("test-dhe-no-shared-secret-padding.py", tls12_exclude_legacy_protocols), 460 Test("test_dhe_no_shared_secret_padding.py", tls12_exclude_legacy_protocols),
461 Test("test-ecdhe-padded-shared-secret.py", tls12_exclude_legacy_protocols), 461 Test("test_ecdhe_padded_shared_secret.py", tls12_exclude_legacy_protocols),
462 Test("test-ecdhe-rsa-key-share-random.py", tls12_exclude_legacy_protocols), 462 Test("test_ecdhe_rsa_key_share_random.py", tls12_exclude_legacy_protocols),
463 # Start at extension number 58 to avoid QUIC transport parameters (57) 463 # Start at extension number 58 to avoid QUIC transport parameters (57)
464 Test("test-large-hello.py", [ "-m", "58" ]), 464 Test("test_large_hello.py", [ "-m", "58" ]),
465]) 465])
466 466
467tls12_failing_tests = TestGroup("failing TLSv1.2 tests", [ 467tls12_failing_tests = TestGroup("failing TLSv1.2 tests", [
468 # no shared cipher 468 # no shared cipher
469 Test("test-aesccm.py"), 469 Test("test_aesccm.py"),
470 # need server to set up alpn 470 # need server to set up alpn
471 Test("test-alpn-negotiation.py"), 471 Test("test_alpn_negotiation.py"),
472 # Failing on TLS_RSA_WITH_AES_128_CBC_SHA because server does not support it. 472 # Failing on TLS_RSA_WITH_AES_128_CBC_SHA because server does not support it.
473 Test("test-bleichenbacher-timing-pregenerate.py"), 473 Test("test_bleichenbacher_timing_pregenerate.py"),
474 # many tests fail due to unexpected server_name extension 474 # many tests fail due to unexpected server_name extension
475 Test("test-bleichenbacher-workaround.py"), 475 Test("test_bleichenbacher_workaround.py"),
476 476
477 # need client key and cert plus extra server setup 477 # need client key and cert plus extra server setup
478 Test("test-certificate-malformed.py"), 478 Test("test_certificate_malformed.py"),
479 Test("test-certificate-request.py"), 479 Test("test_certificate_request.py"),
480 Test("test-certificate-verify-malformed-sig.py"), 480 Test("test_certificate_verify_malformed_sig.py"),
481 Test("test-certificate-verify-malformed.py"), 481 Test("test_certificate_verify_malformed.py"),
482 Test("test-certificate-verify.py"), 482 Test("test_certificate_verify.py"),
483 Test("test-ecdsa-in-certificate-verify.py"), 483 Test("test_ecdsa_in_certificate_verify.py"),
484 Test("test-eddsa-in-certificate-verify.py"), 484 Test("test_eddsa_in_certificate_verify.py"),
485 Test("test-renegotiation-disabled-client-cert.py"), 485 Test("test_renegotiation_disabled_client_cert.py"),
486 Test("test-rsa-pss-sigs-on-certificate-verify.py"), 486 Test("test_rsa_pss_sigs_on_certificate_verify.py"),
487 Test("test-rsa-sigs-on-certificate-verify.py"), 487 Test("test_rsa_sigs_on_certificate_verify.py"),
488 488
489 # test doesn't expect session ticket 489 # test doesn't expect session ticket
490 Test("test-client-compatibility.py"), 490 Test("test_client_compatibility.py"),
491 # abrupt closure 491 # abrupt closure
492 Test("test-client-hello-max-size.py"), 492 Test("test_client_hello_max_size.py"),
493 # unknown signature algorithms 493 # unknown signature algorithms
494 Test("test-clienthello-md5.py"), 494 Test("test_clienthello_md5.py"),
495 495
496 # Tests expect an illegal_parameter or a decode_error alert. Should be 496 # Tests expect an illegal_parameter or a decode_error alert. Should be
497 # added to ssl3_get_client_key_exchange on kex function failure. 497 # added to ssl3_get_client_key_exchange on kex function failure.
498 Test("test-ecdhe-rsa-key-exchange-with-bad-messages.py"), 498 Test("test_ecdhe_rsa_key_exchange_with_bad_messages.py"),
499 499
500 # We send a handshake_failure due to no shared ciphers while the 500 # We send a handshake_failure due to no shared ciphers while the
501 # test expects to succeed. 501 # test expects to succeed.
502 Test("test-ecdhe-rsa-key-exchange.py"), 502 Test("test_ecdhe_rsa_key_exchange.py"),
503 503
504 # no shared cipher 504 # no shared cipher
505 Test("test-ecdsa-sig-flexibility.py"), 505 Test("test_ecdsa_sig_flexibility.py"),
506 506
507 # Tests expect SH but we send unexpected_message or handshake_failure 507 # Tests expect SH but we send unexpected_message or handshake_failure
508 # 'Application data inside Client Hello' 508 # 'Application data inside Client Hello'
509 # 'Application data inside Client Key Exchange' 509 # 'Application data inside Client Key Exchange'
510 # 'Application data inside Finished' 510 # 'Application data inside Finished'
511 Test("test-interleaved-application-data-and-fragmented-handshakes-in-renegotiation.py"), 511 Test("test_interleaved_application_data_and_fragmented_handshakes_in_renegotiation.py"),
512 # Tests expect SH but we send handshake_failure 512 # Tests expect SH but we send handshake_failure
513 # 'Application data before Change Cipher Spec' 513 # 'Application data before Change Cipher Spec'
514 # 'Application data before Client Key Exchange' 514 # 'Application data before Client Key Exchange'
515 # 'Application data before Finished' 515 # 'Application data before Finished'
516 Test("test-interleaved-application-data-in-renegotiation.py"), 516 Test("test_interleaved_application_data_in_renegotiation.py"),
517 517
518 # broken test script 518 # broken test script
519 # TypeError: '<' not supported between instances of 'int' and 'NoneType' 519 # TypeError: '<' not supported between instances of 'int' and 'NoneType'
520 Test("test-invalid-client-hello-w-record-overflow.py"), 520 Test("test_invalid_client_hello_w_record_overflow.py"),
521 521
522 # Lots of failures. abrupt closure 522 # Lots of failures. abrupt closure
523 Test("test-invalid-client-hello.py"), 523 Test("test_invalid_client_hello.py"),
524 524
525 # abrupt closure 525 # abrupt closure
526 # 'encrypted premaster set to all zero (n)' n in 256 384 512 526 # 'encrypted premaster set to all zero (n)' n in 256 384 512
527 Test("test-invalid-rsa-key-exchange-messages.py"), 527 Test("test_invalid_rsa_key_exchange_messages.py"),
528 528
529 # test expects illegal_parameter, we send unrecognized_name (which seems 529 # test expects illegal_parameter, we send unrecognized_name (which seems
530 # correct according to rfc 6066?) 530 # correct according to rfc 6066?)
531 Test("test-invalid-server-name-extension-resumption.py"), 531 Test("test_invalid_server_name_extension_resumption.py"),
532 # let through some server names without sending an alert 532 # let through some server names without sending an alert
533 # again illegal_parameter vs unrecognized_name 533 # again illegal_parameter vs unrecognized_name
534 Test("test-invalid-server-name-extension.py"), 534 Test("test_invalid_server_name_extension.py"),
535 535
536 # 4 failures: 536 # 4 failures:
537 # 'insecure (legacy) renegotiation with GET after 2nd handshake' 537 # 'insecure (legacy) renegotiation with GET after 2nd handshake'
538 # 'insecure (legacy) renegotiation with incomplete GET' 538 # 'insecure (legacy) renegotiation with incomplete GET'
539 # 'secure renegotiation with GET after 2nd handshake' 539 # 'secure renegotiation with GET after 2nd handshake'
540 # 'secure renegotiation with incomplete GET' 540 # 'secure renegotiation with incomplete GET'
541 Test("test-legacy-renegotiation.py"), 541 Test("test_legacy_renegotiation.py"),
542 542
543 # 1 failure (timeout): we don't send the unexpected_message alert 543 # 1 failure (timeout): we don't send the unexpected_message alert
544 # 'duplicate change cipher spec after Finished' 544 # 'duplicate change cipher spec after Finished'
545 Test("test-message-duplication.py"), 545 Test("test_message_duplication.py"),
546 546
547 # server should send status_request 547 # server should send status_request
548 Test("test-ocsp-stapling.py"), 548 Test("test_ocsp_stapling.py"),
549 549
550 # unexpected closure 550 # unexpected closure
551 Test("test-openssl-3712.py"), 551 Test("test_openssl_3712.py"),
552 552
553 # failed: 3 (expect an alert, we send AD) 553 # failed: 3 (expect an alert, we send AD)
554 # 'try insecure (legacy) renegotiation with incomplete GET' 554 # 'try insecure (legacy) renegotiation with incomplete GET'
555 # 'try secure renegotiation with GET after 2nd CH' 555 # 'try secure renegotiation with GET after 2nd CH'
556 # 'try secure renegotiation with incomplete GET' 556 # 'try secure renegotiation with incomplete GET'
557 Test("test-renegotiation-disabled.py"), 557 Test("test_renegotiation_disabled.py"),
558 558
559 # 'resumption of safe session with NULL cipher' 559 # 'resumption of safe session with NULL cipher'
560 # 'resumption with cipher from old CH but not selected by server' 560 # 'resumption with cipher from old CH but not selected by server'
561 Test("test-resumption-with-wrong-ciphers.py"), 561 Test("test_resumption_with_wrong_ciphers.py"),
562 562
563 # 'session resumption with empty session_id' 563 # 'session resumption with empty session_id'
564 # 'session resumption with random session_id' 564 # 'session resumption with random session_id'
565 # 'session resumption with renegotiation' 565 # 'session resumption with renegotiation'
566 # AssertionError: Server did not send extension(s): session_ticket 566 # AssertionError: Server did not send extension(s): session_ticket
567 Test("test-session-ticket-resumption.py"), 567 Test("test_session_ticket_resumption.py"),
568 568
569 # 5 failures: 569 # 5 failures:
570 # 'empty sigalgs' 570 # 'empty sigalgs'
@@ -572,7 +572,7 @@ tls12_failing_tests = TestGroup("failing TLSv1.2 tests", [
572 # 'rsa_pss_pss_sha256 only' 572 # 'rsa_pss_pss_sha256 only'
573 # 'rsa_pss_pss_sha384 only' 573 # 'rsa_pss_pss_sha384 only'
574 # 'rsa_pss_pss_sha512 only' 574 # 'rsa_pss_pss_sha512 only'
575 Test("test-sig-algs.py"), 575 Test("test_sig_algs.py"),
576 576
577 # 13 failures: 577 # 13 failures:
578 # 'duplicated n non-rsa schemes' for n in 202 2342 8119 23741 32744 578 # 'duplicated n non-rsa schemes' for n in 202 2342 8119 23741 32744
@@ -581,51 +581,51 @@ tls12_failing_tests = TestGroup("failing TLSv1.2 tests", [
581 # 'tolerance 32758 methods with sig_alg_cert' 581 # 'tolerance 32758 methods with sig_alg_cert'
582 # 'tolerance max 32744 number of methods with sig_alg_cert' 582 # 'tolerance max 32744 number of methods with sig_alg_cert'
583 # 'tolerance max (32760) number of methods' 583 # 'tolerance max (32760) number of methods'
584 Test("test-signature-algorithms.py"), 584 Test("test_signature_algorithms.py"),
585 585
586 # times out 586 # times out
587 Test("test-ssl-death-alert.py"), 587 Test("test_ssl_death_alert.py"),
588 588
589 # 17 pass, 13 fail. padding and truncation 589 # 17 pass, 13 fail. padding and truncation
590 Test("test-truncating-of-client-hello.py"), 590 Test("test_truncating_of_client_hello.py"),
591 591
592 # x448 tests need disabling plus x25519 corner cases need sorting out 592 # x448 tests need disabling plus x25519 corner cases need sorting out
593 Test("test-x25519.py"), 593 Test("test_x25519.py"),
594 594
595 # Needs TLS 1.0 or 1.1 595 # Needs TLS 1.0 or 1.1
596 Test("test-TLSv1_2-rejected-without-TLSv1_2.py"), 596 Test("test_TLSv1_2_rejected_without_TLSv1_2.py"),
597]) 597])
598 598
599tls12_unsupported_tests = TestGroup("TLSv1.2 for unsupported features", [ 599tls12_unsupported_tests = TestGroup("TLSv1.2 for unsupported features", [
600 # protocol_version 600 # protocol_version
601 Test("test-SSLv3-padding.py"), 601 Test("test_SSLv3_padding.py"),
602 # we don't do RSA key exchanges 602 # we don't do RSA key exchanges
603 Test("test-bleichenbacher-timing.py"), 603 Test("test_bleichenbacher_timing.py"),
604 # no encrypt-then-mac 604 # no encrypt-then-mac
605 Test("test-encrypt-then-mac-renegotiation.py"), 605 Test("test_encrypt_then_mac_renegotiation.py"),
606 Test("test-encrypt-then-mac.py"), 606 Test("test_encrypt_then_mac.py"),
607 # no EME support 607 # no EME support
608 Test("test-extended-master-secret-extension-with-client-cert.py"), 608 Test("test_extended_master_secret_extension_with_client_cert.py"),
609 Test("test-extended-master-secret-extension.py"), 609 Test("test_extended_master_secret_extension.py"),
610 # no ffdhe 610 # no ffdhe
611 Test("test-ffdhe-expected-params.py"), 611 Test("test_ffdhe_expected_params.py"),
612 Test("test-ffdhe-negotiation.py"), 612 Test("test_ffdhe_negotiation.py"),
613 # record_size_limit/max_fragment_length extension (RFC 8449) 613 # record_size_limit/max_fragment_length extension (RFC 8449)
614 Test("test-record-size-limit.py"), 614 Test("test_record_size_limit.py"),
615 # expects the server to send the heartbeat extension 615 # expects the server to send the heartbeat extension
616 Test("test-heartbeat.py"), 616 Test("test_heartbeat.py"),
617 # needs an echo server 617 # needs an echo server
618 Test("test-lengths.py"), 618 Test("test_lengths.py"),
619]) 619])
620 620
621# These tests take a ton of time to fail against an 1.3 server, 621# These tests take a ton of time to fail against an 1.3 server,
622# so don't run them against 1.3 pending further investigation. 622# so don't run them against 1.3 pending further investigation.
623legacy_tests = TestGroup("Legacy protocol tests", [ 623legacy_tests = TestGroup("Legacy protocol tests", [
624 Test("test-sslv2-force-cipher-3des.py"), 624 Test("test_sslv2_force_cipher_3des.py"),
625 Test("test-sslv2-force-cipher-non3des.py"), 625 Test("test_sslv2_force_cipher_non3des.py"),
626 Test("test-sslv2-force-cipher.py"), 626 Test("test_sslv2_force_cipher.py"),
627 Test("test-sslv2-force-export-cipher.py"), 627 Test("test_sslv2_force_export_cipher.py"),
628 Test("test-sslv2hello-protocol.py"), 628 Test("test_sslv2hello_protocol.py"),
629]) 629])
630 630
631all_groups = [ 631all_groups = [