diff options
| author | bluhm <> | 2018-11-11 00:15:04 +0000 |
|---|---|---|
| committer | bluhm <> | 2018-11-11 00:15:04 +0000 |
| commit | 50da4d90eb521ba89a43af23da2b26ada631c4d1 (patch) | |
| tree | 2e2f3822b8e0eb71ba45a900f399e61fb573f4b2 /src/regress/lib | |
| parent | 53421fd94339bb9af842ae49a732315507d719b2 (diff) | |
| download | openbsd-50da4d90eb521ba89a43af23da2b26ada631c4d1.tar.gz openbsd-50da4d90eb521ba89a43af23da2b26ada631c4d1.tar.bz2 openbsd-50da4d90eb521ba89a43af23da2b26ada631c4d1.zip | |
Reorganize libssl interop tests. Move netcat tests into separate
directory. Keep all log files for easier debugging. Name regress
target names consistently.
Diffstat (limited to 'src/regress/lib')
| -rw-r--r-- | src/regress/lib/libssl/interop/Makefile | 3 | ||||
| -rw-r--r-- | src/regress/lib/libssl/interop/Makefile.inc | 69 | ||||
| -rw-r--r-- | src/regress/lib/libssl/interop/README | 13 | ||||
| -rw-r--r-- | src/regress/lib/libssl/interop/cert/Makefile | 43 | ||||
| -rw-r--r-- | src/regress/lib/libssl/interop/libressl/Makefile | 30 | ||||
| -rw-r--r-- | src/regress/lib/libssl/interop/netcat/Makefile | 89 | ||||
| -rw-r--r-- | src/regress/lib/libssl/interop/openssl/Makefile | 25 | ||||
| -rw-r--r-- | src/regress/lib/libssl/interop/openssl11/Makefile | 28 | ||||
| -rw-r--r-- | src/regress/lib/libssl/interop/session/Makefile | 45 |
9 files changed, 197 insertions, 148 deletions
diff --git a/src/regress/lib/libssl/interop/Makefile b/src/regress/lib/libssl/interop/Makefile index f538f87366..dcde044d97 100644 --- a/src/regress/lib/libssl/interop/Makefile +++ b/src/regress/lib/libssl/interop/Makefile | |||
| @@ -1,7 +1,8 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.4 2018/11/10 08:33:45 bluhm Exp $ | 1 | # $OpenBSD: Makefile,v 1.5 2018/11/11 00:15:04 bluhm Exp $ |
| 2 | 2 | ||
| 3 | SUBDIR = libressl openssl openssl11 | 3 | SUBDIR = libressl openssl openssl11 |
| 4 | # the above binaries must have been built before we can continue | 4 | # the above binaries must have been built before we can continue |
| 5 | SUBDIR += netcat | ||
| 5 | SUBDIR += session | 6 | SUBDIR += session |
| 6 | SUBDIR += cert | 7 | SUBDIR += cert |
| 7 | 8 | ||
diff --git a/src/regress/lib/libssl/interop/Makefile.inc b/src/regress/lib/libssl/interop/Makefile.inc index 9daae79e57..7dadc3607b 100644 --- a/src/regress/lib/libssl/interop/Makefile.inc +++ b/src/regress/lib/libssl/interop/Makefile.inc | |||
| @@ -1,74 +1,37 @@ | |||
| 1 | # $OpenBSD: Makefile.inc,v 1.4 2018/11/09 06:30:41 bluhm Exp $ | 1 | # $OpenBSD: Makefile.inc,v 1.5 2018/11/11 00:15:04 bluhm Exp $ |
| 2 | 2 | ||
| 3 | .PATH: ${.CURDIR}/.. | 3 | .PATH: ${.CURDIR}/.. |
| 4 | 4 | ||
| 5 | SRCS_client = client.c util.c | 5 | SRCS_client = client.c util.c |
| 6 | SRCS_server = server.c util.c | 6 | SRCS_server = server.c util.c |
| 7 | WARNINGS = yes | 7 | WARNINGS = yes |
| 8 | 8 | CLEANFILES += *.out *.fstat | |
| 9 | # check that program is linked with correct libraries | ||
| 10 | 9 | ||
| 11 | .for p in ${PROGS} | 10 | .for p in ${PROGS} |
| 12 | CLEANFILES += ldd-$p.out | ||
| 13 | ldd-$p.out: $p | 11 | ldd-$p.out: $p |
| 12 | # programs must be linked with correct libraries | ||
| 14 | LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ldd $p >$@ | 13 | LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ldd $p >$@ |
| 15 | .endfor | 14 | .endfor |
| 16 | 15 | ||
| 17 | # run netcat server and connect with test client | 16 | client-self.out server-self.out: run-self-client-server |
| 18 | |||
| 19 | CLEANFILES += nc-client.out netcat-l.out netcat-l.fstat | ||
| 20 | nc-client.out run-client: client 127.0.0.1.crt | ||
| 21 | @echo '\n======== $@ ========' | ||
| 22 | echo "greeting" | nc -l -c -C 127.0.0.1.crt -K 127.0.0.1.key \ | ||
| 23 | 127.0.0.1 0 >netcat-l.out & \ | ||
| 24 | for i in `jot 1000`; do fstat -p $$! >netcat-l.fstat; \ | ||
| 25 | grep -q ' stream tcp .*:[1-9][0-9]*$$' netcat-l.fstat && exit 0; \ | ||
| 26 | done; exit 1 | ||
| 27 | LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ./client \ | ||
| 28 | `sed -n 's/.* stream tcp .*:/127.0.0.1 /p' netcat-l.fstat` \ | ||
| 29 | >nc-client.out | ||
| 30 | # check that the client run successfully to the end | ||
| 31 | grep -q '^success$$' nc-client.out | ||
| 32 | # client must have read server greeting | ||
| 33 | grep -q '^<<< greeting$$' nc-client.out | ||
| 34 | # netstat server must have read client hello | ||
| 35 | grep -q '^hello$$' netcat-l.out | ||
| 36 | |||
| 37 | # run test server and connect with netcat client | ||
| 38 | |||
| 39 | CLEANFILES += nc-server.out netcat.out | ||
| 40 | nc-server.out run-server: server 127.0.0.1.crt | ||
| 41 | @echo '\n======== $@ ========' | ||
| 42 | LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ./server 127.0.0.1 0 \ | ||
| 43 | >nc-server.out | ||
| 44 | echo "hello" | nc -c -R 127.0.0.1.crt \ | ||
| 45 | `sed -n 's/listen sock: //p' nc-server.out` \ | ||
| 46 | >netcat.out | ||
| 47 | # check that the server child run successfully to the end | ||
| 48 | grep -q '^success$$' nc-server.out | ||
| 49 | # server must have read client hello | ||
| 50 | grep -q '^<<< hello$$' nc-server.out | ||
| 51 | # client must have read server greeting | ||
| 52 | grep -q '^greeting$$' netcat.out | ||
| 53 | |||
| 54 | # run test server and with test client, self test the ssl library | ||
| 55 | 17 | ||
| 56 | CLEANFILES += self-client.out self-server.out | 18 | run-self-client-server: client server 127.0.0.1.crt |
| 57 | self-client.out self-server.out run-self: client server 127.0.0.1.crt | ||
| 58 | @echo '\n======== $@ ========' | 19 | @echo '\n======== $@ ========' |
| 59 | LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ./server 127.0.0.1 0 \ | 20 | # check that tls client and server work together |
| 60 | >self-server.out | 21 | LD_LIBRARY_PATH=${LD_LIBRARY_PATH} \ |
| 61 | LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ./client \ | 22 | ./server >server-self.out \ |
| 62 | `sed -n 's/listen sock: //p' self-server.out` \ | 23 | 127.0.0.1 0 |
| 63 | >self-client.out | 24 | LD_LIBRARY_PATH=${LD_LIBRARY_PATH} \ |
| 25 | ./client >client-self.out \ | ||
| 26 | `sed -n 's/listen sock: //p' server-self.out` | ||
| 64 | # check that the client run successfully to the end | 27 | # check that the client run successfully to the end |
| 65 | grep -q '^success$$' self-client.out | 28 | grep -q '^success$$' client-self.out |
| 66 | # client must have read server greeting | 29 | # client must have read server greeting |
| 67 | grep -q '^<<< greeting$$' self-client.out | 30 | grep -q '^<<< greeting$$' client-self.out |
| 68 | # check that the server child run successfully to the end | 31 | # check that the server child run successfully to the end |
| 69 | grep -q '^success$$' self-server.out | 32 | grep -q '^success$$' server-self.out |
| 70 | # server must have read client hello | 33 | # server must have read client hello |
| 71 | grep -q '^<<< hello$$' self-server.out | 34 | grep -q '^<<< hello$$' server-self.out |
| 72 | 35 | ||
| 73 | # create certificates for TLS | 36 | # create certificates for TLS |
| 74 | 37 | ||
diff --git a/src/regress/lib/libssl/interop/README b/src/regress/lib/libssl/interop/README index b53b47b878..42d87acfdb 100644 --- a/src/regress/lib/libssl/interop/README +++ b/src/regress/lib/libssl/interop/README | |||
| @@ -2,8 +2,7 @@ Test TLS interoperability between LibreSSL and OpenSSL. | |||
| 2 | 2 | ||
| 3 | Implement simple SSL client and server in C. Create six binaries | 3 | Implement simple SSL client and server in C. Create six binaries |
| 4 | by linking them with LibreSSL or OpenSSL 1.0.2 or OpenSSL 1.1. This | 4 | by linking them with LibreSSL or OpenSSL 1.0.2 or OpenSSL 1.1. This |
| 5 | way API compatibility is tested. Connect and accept with netcat | 5 | way API compatibility is tested. |
| 6 | to test protocol compatibility with libtls. | ||
| 7 | 6 | ||
| 8 | To self test each SSL library, connect client with server. Check | 7 | To self test each SSL library, connect client with server. Check |
| 9 | that the highest available TLS version is selected. LibreSSL TLS | 8 | that the highest available TLS version is selected. LibreSSL TLS |
| @@ -13,7 +12,9 @@ Currently OpenSSL 1.0.2p and OpenSSL 1.1.1 from ports are used. As | |||
| 13 | soon as LibreSSL supports TLS 1.3, it should be used automatically | 12 | soon as LibreSSL supports TLS 1.3, it should be used automatically |
| 14 | when netcat is communicating with OpenSSL 1.1. | 13 | when netcat is communicating with OpenSSL 1.1. |
| 15 | 14 | ||
| 16 | The cert subdir is testing all combinations of certificate validation. | 15 | Connect and accept with netcat to test protocol compatibility with |
| 17 | Having the three libraries, client and server certificates, missing | 16 | libtls. Test TLS session reuse multiple times with different library |
| 18 | or invalid CA or certificates, and enforcing peer certificate results | 17 | combinations. The cert subdir is testing all combinations of |
| 19 | in 1944 test cases. | 18 | certificate validation. Having the three libraries, client and |
| 19 | server certificates, missing or invalid CA or certificates, and | ||
| 20 | enforcing peer certificate results in 1944 test cases. | ||
diff --git a/src/regress/lib/libssl/interop/cert/Makefile b/src/regress/lib/libssl/interop/cert/Makefile index dabc0441f0..911fe8c325 100644 --- a/src/regress/lib/libssl/interop/cert/Makefile +++ b/src/regress/lib/libssl/interop/cert/Makefile | |||
| @@ -1,12 +1,12 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.1 2018/11/09 06:30:41 bluhm Exp $ | 1 | # $OpenBSD: Makefile,v 1.2 2018/11/11 00:15:04 bluhm Exp $ |
| 2 | 2 | ||
| 3 | .if ! exists(/usr/local/bin/eopenssl) || ! exists(/usr/local/bin/eopenssl11) | 3 | LIBRARIES = libressl |
| 4 | regress: | 4 | .if exists(/usr/local/bin/eopenssl) |
| 5 | # install openssl-1.0.2p and openssl-1.1.1 from ports | 5 | LIBRARIES += openssl |
| 6 | @echo SKIPPED | 6 | .endif |
| 7 | .if exists(/usr/local/bin/eopenssl11) | ||
| 8 | LIBRARIES += openssl11 | ||
| 7 | .endif | 9 | .endif |
| 8 | |||
| 9 | CLEANFILES += client.out server.out | ||
| 10 | 10 | ||
| 11 | .for cca in noca ca fakeca | 11 | .for cca in noca ca fakeca |
| 12 | .for sca in noca ca fakeca | 12 | .for sca in noca ca fakeca |
| @@ -27,35 +27,34 @@ FAIL_${cca}_${sca}_${ccert}_${scert}_${cv}_${sv} = | |||
| 27 | FAIL_${cca}_${sca}_${ccert}_${scert}_${cv}_${sv} = ! | 27 | FAIL_${cca}_${sca}_${ccert}_${scert}_${cv}_${sv} = ! |
| 28 | .endif | 28 | .endif |
| 29 | 29 | ||
| 30 | .for clib in libressl openssl openssl11 | 30 | .for clib in ${LIBRARIES} |
| 31 | .for slib in libressl openssl openssl11 | 31 | .for slib in ${LIBRARIES} |
| 32 | 32 | ||
| 33 | REGRESS_TARGETS += \ | 33 | REGRESS_TARGETS += run-cert-client-${clib}-${cca}-${ccert}-${cv}-server-${slib}-${sca}-${scert}-${sv} |
| 34 | run-client-${clib}-${cca}-${ccert}-${cv}-server-${slib}-${sca}-${scert}-${sv} | ||
| 35 | 34 | ||
| 36 | run-client-${clib}-${cca}-${ccert}-${cv}-server-${slib}-${sca}-${scert}-${sv}:\ | 35 | run-cert-client-${clib}-${cca}-${ccert}-${cv}-server-${slib}-${sca}-${scert}-${sv}: \ |
| 37 | 127.0.0.1.crt ca.crt fake-ca.crt client.crt server.crt \ | 36 | 127.0.0.1.crt ca.crt fake-ca.crt client.crt server.crt \ |
| 38 | ../${clib}/client ../${slib}/server | 37 | ../${clib}/client ../${slib}/server |
| 39 | @echo '\n======== $@ ========' | 38 | @echo '\n======== $@ ========' |
| 40 | LD_LIBRARY_PATH=/usr/local/lib/e${slib} \ | 39 | LD_LIBRARY_PATH=/usr/local/lib/e${slib} \ |
| 41 | ../${slib}/server >server.out \ | 40 | ../${slib}/server >${@:S/^run/server/}.out \ |
| 42 | ${sca:S/^noca//:S/^fakeca/-C fake-ca.crt/:S/^ca/-C ca.crt/} \ | 41 | ${sca:S/^noca//:S/^fakeca/-C fake-ca.crt/:S/^ca/-C ca.crt/} \ |
| 43 | ${scert:S/^nocert//:S/^cert/-c server.crt -k server.key/} \ | 42 | ${scert:S/^nocert//:S/^cert/-c server.crt -k server.key/} \ |
| 44 | ${sv:S/^noverify//:S/^verify/-v/:S/^certverify/-vv/} \ | 43 | ${sv:S/^noverify//:S/^verify/-v/:S/^certverify/-vv/} \ |
| 45 | 127.0.0.1 0 | 44 | 127.0.0.1 0 |
| 46 | ${FAIL_${cca}_${sca}_${ccert}_${scert}_${cv}_${sv}} \ | 45 | ${FAIL_${cca}_${sca}_${ccert}_${scert}_${cv}_${sv}} \ |
| 47 | LD_LIBRARY_PATH=/usr/local/lib/e${clib} \ | 46 | LD_LIBRARY_PATH=/usr/local/lib/e${clib} \ |
| 48 | ../${clib}/client >client.out \ | 47 | ../${clib}/client >${@:S/^run/client/}.out \ |
| 49 | ${cca:S/^noca//:S/^fakeca/-C fake-ca.crt/:S/^ca/-C ca.crt/} \ | 48 | ${cca:S/^noca//:S/^fakeca/-C fake-ca.crt/:S/^ca/-C ca.crt/} \ |
| 50 | ${ccert:S/^nocert//:S/^cert/-c server.crt -k server.key/} \ | 49 | ${ccert:S/^nocert//:S/^cert/-c server.crt -k server.key/} \ |
| 51 | ${cv:S/^noverify//:S/^verify/-v/} \ | 50 | ${cv:S/^noverify//:S/^verify/-v/} \ |
| 52 | `sed -n 's/listen sock: //p' server.out` | 51 | `sed -n 's/listen sock: //p' ${@:S/^run/server/}.out` |
| 53 | .if empty(${FAIL_${cca}_${sca}_${ccert}_${scert}_${cv}_${sv}}) | 52 | .if empty(${FAIL_${cca}_${sca}_${ccert}_${scert}_${cv}_${sv}}) |
| 54 | grep '^success$$' server.out | 53 | grep '^success$$' ${@:S/^run/server/}.out |
| 55 | grep '^success$$' client.out | 54 | grep '^success$$' ${@:S/^run/client/}.out |
| 56 | .elif ! ("${sv}" == certverify && "${ccert}" == nocert) || \ | 55 | .elif ! ("${sv}" == certverify && "${ccert}" == nocert) || \ |
| 57 | ("${cv}" == verify && "${scert}" != cert) | 56 | ("${cv}" == verify && "${scert}" != cert) |
| 58 | grep '^verify: fail' client.out server.out | 57 | grep '^verify: fail' ${@:S/^run/client/}.out ${@:S/^run/server/}.out |
| 59 | .endif | 58 | .endif |
| 60 | 59 | ||
| 61 | .endfor | 60 | .endfor |
| @@ -67,4 +66,12 @@ run-client-${clib}-${cca}-${ccert}-${cv}-server-${slib}-${sca}-${scert}-${sv}:\ | |||
| 67 | .endfor | 66 | .endfor |
| 68 | .endfor | 67 | .endfor |
| 69 | 68 | ||
| 69 | # argument list too long for a single rm * | ||
| 70 | |||
| 71 | clean: _SUBDIRUSE | ||
| 72 | rm -f client-*.out | ||
| 73 | rm -f server-*.out | ||
| 74 | rm -f a.out [Ee]rrs mklog *.core y.tab.h \ | ||
| 75 | ${PROG} ${PROGS} ${OBJS} ${_LEXINTM} ${_YACCINTM} ${CLEANFILES} | ||
| 76 | |||
| 70 | .include <bsd.regress.mk> | 77 | .include <bsd.regress.mk> |
diff --git a/src/regress/lib/libssl/interop/libressl/Makefile b/src/regress/lib/libssl/interop/libressl/Makefile index 6923e12469..868c3c146f 100644 --- a/src/regress/lib/libssl/interop/libressl/Makefile +++ b/src/regress/lib/libssl/interop/libressl/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.4 2018/11/09 06:30:41 bluhm Exp $ | 1 | # $OpenBSD: Makefile,v 1.5 2018/11/11 00:15:04 bluhm Exp $ |
| 2 | 2 | ||
| 3 | PROGS = client server | 3 | PROGS = client server |
| 4 | CPPFLAGS = | 4 | CPPFLAGS = |
| @@ -6,21 +6,13 @@ LDFLAGS = | |||
| 6 | LDADD = -lssl -lcrypto | 6 | LDADD = -lssl -lcrypto |
| 7 | DPADD = ${LIBSSL} ${LIBCRYPTO} | 7 | DPADD = ${LIBSSL} ${LIBCRYPTO} |
| 8 | LD_LIBRARY_PATH = | 8 | LD_LIBRARY_PATH = |
| 9 | REGRESS_TARGETS = run-self | 9 | REGRESS_TARGETS = run-self-client-server |
| 10 | .for p in ${PROGS} | 10 | .for p in ${PROGS} |
| 11 | REGRESS_TARGETS += run-ldd-$p run-$p | 11 | REGRESS_TARGETS += run-ldd-$p run-version-$p run-protocol-$p |
| 12 | .for x in nc self | ||
| 13 | REGRESS_TARGETS += run-version-$x-$p run-protocol-$x-$p | ||
| 14 | .endfor | 12 | .endfor |
| 15 | .endfor | ||
| 16 | |||
| 17 | run-protocol-self-client run-protocol-self-server \ | ||
| 18 | run-protocol-nc-client run-protocol-nc-server: | ||
| 19 | @echo '\n======== $@ ========' | ||
| 20 | # LibreSSL does not support TLS 1.3 yet | ||
| 21 | @echo DISABLED | ||
| 22 | 13 | ||
| 23 | .for p in ${PROGS} | 14 | .for p in ${PROGS} |
| 15 | |||
| 24 | run-ldd-$p: ldd-$p.out | 16 | run-ldd-$p: ldd-$p.out |
| 25 | @echo '\n======== $@ ========' | 17 | @echo '\n======== $@ ========' |
| 26 | # check that $p is linked with LibreSSL | 18 | # check that $p is linked with LibreSSL |
| @@ -28,18 +20,18 @@ run-ldd-$p: ldd-$p.out | |||
| 28 | grep -q /usr/lib/libssl.so ldd-$p.out | 20 | grep -q /usr/lib/libssl.so ldd-$p.out |
| 29 | # check that $p is not linked with OpenSSL | 21 | # check that $p is not linked with OpenSSL |
| 30 | ! grep /usr/local/lib/ ldd-$p.out | 22 | ! grep /usr/local/lib/ ldd-$p.out |
| 31 | .endfor | ||
| 32 | 23 | ||
| 33 | .for o in nc-client nc-server self-client self-server | 24 | run-version-$p: $p-self.out |
| 34 | run-version-$o: $o.out | ||
| 35 | @echo '\n======== $@ ========' | 25 | @echo '\n======== $@ ========' |
| 36 | # check that runtime version is LibreSSL | 26 | # check that runtime version is LibreSSL |
| 37 | grep 'SSLEAY_VERSION: LibreSSL' $o.out | 27 | grep 'SSLEAY_VERSION: LibreSSL' $p-self.out |
| 38 | 28 | ||
| 39 | run-protocol-$o: $o.out | 29 | run-protocol-$p: $p-self.out |
| 40 | @echo '\n======== $@ ========' | 30 | @echo '\n======== $@ ========' |
| 41 | # check that protocol version is TLS 1.3 | 31 | # check that LibreSSL protocol version is TLS 1.2 |
| 42 | grep 'Protocol *: TLSv1.3' $o.out | 32 | # XXX adapt when LibreSSL supports TLS 1.3 |
| 33 | grep 'Protocol *: TLSv1.2' $p-self.out | ||
| 34 | |||
| 43 | .endfor | 35 | .endfor |
| 44 | 36 | ||
| 45 | .include <bsd.regress.mk> | 37 | .include <bsd.regress.mk> |
diff --git a/src/regress/lib/libssl/interop/netcat/Makefile b/src/regress/lib/libssl/interop/netcat/Makefile new file mode 100644 index 0000000000..def90c1ffb --- /dev/null +++ b/src/regress/lib/libssl/interop/netcat/Makefile | |||
| @@ -0,0 +1,89 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.1 2018/11/11 00:15:04 bluhm Exp $ | ||
| 2 | |||
| 3 | LIBRARIES = libressl | ||
| 4 | .if exists(/usr/local/bin/eopenssl) | ||
| 5 | LIBRARIES += openssl | ||
| 6 | .endif | ||
| 7 | .if exists(/usr/local/bin/eopenssl11) | ||
| 8 | LIBRARIES += openssl11 | ||
| 9 | .endif | ||
| 10 | |||
| 11 | # run netcat server and connect with test client | ||
| 12 | |||
| 13 | .for clib in ${LIBRARIES} | ||
| 14 | |||
| 15 | REGRESS_TARGETS += run-netcat-client-${clib}-server-nc | ||
| 16 | REGRESS_TARGETS += run-protocol-client-${clib} | ||
| 17 | |||
| 18 | run-netcat-client-${clib}-server-nc: ../${clib}/client 127.0.0.1.crt | ||
| 19 | @echo '\n======== $@ ========' | ||
| 20 | echo "greeting" | \ | ||
| 21 | nc >${@:S/^run/server/}.out \ | ||
| 22 | -l -c -C 127.0.0.1.crt -K 127.0.0.1.key \ | ||
| 23 | 127.0.0.1 0 & \ | ||
| 24 | for i in `jot 1000`; do fstat -p $$! >netcat.fstat; \ | ||
| 25 | grep -q ' stream tcp .*:[1-9][0-9]*$$' netcat.fstat && \ | ||
| 26 | exit 0; done; exit 1 | ||
| 27 | LD_LIBRARY_PATH=/usr/local/lib/e${clib} \ | ||
| 28 | ../${clib}/client >${@:S/^run/client/}.out \ | ||
| 29 | `sed -n 's/.* stream tcp .*:/127.0.0.1 /p' netcat.fstat` | ||
| 30 | # check that the client run successfully to the end | ||
| 31 | grep -q '^success$$' ${@:S/^run/client/}.out | ||
| 32 | # client must have read server greeting | ||
| 33 | grep -q '^<<< greeting$$' ${@:S/^run/client/}.out | ||
| 34 | # netstat server must have read client hello | ||
| 35 | grep -q '^hello$$' ${@:S/^run/server/}.out | ||
| 36 | |||
| 37 | .endfor | ||
| 38 | |||
| 39 | # run test server and connect with netcat client | ||
| 40 | |||
| 41 | .for slib in ${LIBRARIES} | ||
| 42 | |||
| 43 | REGRESS_TARGETS += run-netcat-client-nc-server-${slib} | ||
| 44 | |||
| 45 | run-netcat-client-nc-server-${slib}: ../${slib}/server 127.0.0.1.crt | ||
| 46 | @echo '\n======== $@ ========' | ||
| 47 | LD_LIBRARY_PATH=/usr/local/lib/e${slib} \ | ||
| 48 | ../${slib}/server >${@:S/^run/server/}.out \ | ||
| 49 | 127.0.0.1 0 | ||
| 50 | echo "hello" | \ | ||
| 51 | nc >${@:S/^run/client/}.out \ | ||
| 52 | -c -R 127.0.0.1.crt \ | ||
| 53 | `sed -n 's/listen sock: //p' ${@:S/^run/server/}.out` | ||
| 54 | # check that the server child run successfully to the end | ||
| 55 | grep -q '^success$$' ${@:S/^run/server/}.out | ||
| 56 | # server must have read client hello | ||
| 57 | grep -q '^<<< hello$$' ${@:S/^run/server/}.out | ||
| 58 | # client must have read server greeting | ||
| 59 | grep -q '^greeting$$' ${@:S/^run/client/}.out | ||
| 60 | |||
| 61 | .endfor | ||
| 62 | |||
| 63 | # check the TLS protocol version in client and server logs | ||
| 64 | |||
| 65 | .for clib in ${LIBRARIES} | ||
| 66 | |||
| 67 | REGRESS_TARGETS += run-protocol-client-${clib} | ||
| 68 | |||
| 69 | run-protocol-client-${clib}: client-netcat-client-${clib}-server-nc.out | ||
| 70 | @echo '\n======== $@ ========' | ||
| 71 | # check that LibTLS protocol version is TLS 1.2 | ||
| 72 | # XXX adapt when LibreSSL supports TLS 1.3 | ||
| 73 | grep 'Protocol *: TLSv1.2' client-netcat-client-${clib}-server-nc.out | ||
| 74 | |||
| 75 | .endfor | ||
| 76 | |||
| 77 | .for slib in ${LIBRARIES} | ||
| 78 | |||
| 79 | REGRESS_TARGETS += run-protocol-server-${slib} | ||
| 80 | |||
| 81 | run-protocol-server-${slib}: server-netcat-client-nc-server-${slib}.out | ||
| 82 | @echo '\n======== $@ ========' | ||
| 83 | # check that LibTLS protocol version is TLS 1.2 | ||
| 84 | # XXX adapt when LibreSSL supports TLS 1.3 | ||
| 85 | grep 'Protocol *: TLSv1.2' server-netcat-client-nc-server-${slib}.out | ||
| 86 | |||
| 87 | .endfor | ||
| 88 | |||
| 89 | .include <bsd.regress.mk> | ||
diff --git a/src/regress/lib/libssl/interop/openssl/Makefile b/src/regress/lib/libssl/interop/openssl/Makefile index 80f313da3e..adc93e5ad5 100644 --- a/src/regress/lib/libssl/interop/openssl/Makefile +++ b/src/regress/lib/libssl/interop/openssl/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.5 2018/11/10 08:33:45 bluhm Exp $ | 1 | # $OpenBSD: Makefile,v 1.6 2018/11/11 00:15:04 bluhm Exp $ |
| 2 | 2 | ||
| 3 | .if ! exists(/usr/local/bin/eopenssl) | 3 | .if ! exists(/usr/local/bin/eopenssl) |
| 4 | regress: | 4 | regress: |
| @@ -13,15 +13,13 @@ LDADD = -lssl -lcrypto | |||
| 13 | DPADD = /usr/local/lib/eopenssl/libssl.a \ | 13 | DPADD = /usr/local/lib/eopenssl/libssl.a \ |
| 14 | /usr/local/lib/eopenssl/libcrypto.a | 14 | /usr/local/lib/eopenssl/libcrypto.a |
| 15 | LD_LIBRARY_PATH = /usr/local/lib/eopenssl | 15 | LD_LIBRARY_PATH = /usr/local/lib/eopenssl |
| 16 | REGRESS_TARGETS = run-self | 16 | REGRESS_TARGETS = run-self-client-server |
| 17 | .for p in ${PROGS} | 17 | .for p in ${PROGS} |
| 18 | REGRESS_TARGETS += run-ldd-$p run-$p | 18 | REGRESS_TARGETS += run-ldd-$p run-version-$p run-protocol-$p |
| 19 | .for x in nc self | ||
| 20 | REGRESS_TARGETS += run-version-$x-$p run-protocol-$x-$p | ||
| 21 | .endfor | ||
| 22 | .endfor | 19 | .endfor |
| 23 | 20 | ||
| 24 | .for p in ${PROGS} | 21 | .for p in ${PROGS} |
| 22 | |||
| 25 | run-ldd-$p: ldd-$p.out | 23 | run-ldd-$p: ldd-$p.out |
| 26 | @echo '\n======== $@ ========' | 24 | @echo '\n======== $@ ========' |
| 27 | # check that $p is linked with OpenSSL | 25 | # check that $p is linked with OpenSSL |
| @@ -29,18 +27,17 @@ run-ldd-$p: ldd-$p.out | |||
| 29 | grep -q /usr/local/lib/eopenssl/libssl.so ldd-$p.out | 27 | grep -q /usr/local/lib/eopenssl/libssl.so ldd-$p.out |
| 30 | # check that $p is not linked with LibreSSL | 28 | # check that $p is not linked with LibreSSL |
| 31 | ! grep -v libc.so ldd-$p.out | grep /usr/lib/ | 29 | ! grep -v libc.so ldd-$p.out | grep /usr/lib/ |
| 32 | .endfor | ||
| 33 | 30 | ||
| 34 | .for o in nc-client nc-server self-client self-server | 31 | run-version-$p: $p-self.out |
| 35 | run-version-$o: $o.out | ||
| 36 | @echo '\n======== $@ ========' | 32 | @echo '\n======== $@ ========' |
| 37 | # check that runtime version is OpenSSL 1.0 | 33 | # check that runtime version is OpenSSL 1.0.2 |
| 38 | grep 'SSLEAY_VERSION: OpenSSL 1.0' $o.out | 34 | grep 'SSLEAY_VERSION: OpenSSL 1.0.2' $p-self.out |
| 39 | 35 | ||
| 40 | run-protocol-$o: $o.out | 36 | run-protocol-$p: $p-self.out |
| 41 | @echo '\n======== $@ ========' | 37 | @echo '\n======== $@ ========' |
| 42 | # check that protocol version is TLS 1.2 | 38 | # check that OpenSSL 1.0.2 protocol version is TLS 1.2 |
| 43 | grep 'Protocol *: TLSv1.2' $o.out | 39 | grep 'Protocol *: TLSv1.2' $p-self.out |
| 40 | |||
| 44 | .endfor | 41 | .endfor |
| 45 | 42 | ||
| 46 | .include <bsd.regress.mk> | 43 | .include <bsd.regress.mk> |
diff --git a/src/regress/lib/libssl/interop/openssl11/Makefile b/src/regress/lib/libssl/interop/openssl11/Makefile index ef625dffb8..3ea1ef35da 100644 --- a/src/regress/lib/libssl/interop/openssl11/Makefile +++ b/src/regress/lib/libssl/interop/openssl11/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.4 2018/11/10 08:33:45 bluhm Exp $ | 1 | # $OpenBSD: Makefile,v 1.5 2018/11/11 00:15:04 bluhm Exp $ |
| 2 | 2 | ||
| 3 | .if ! exists(/usr/local/bin/eopenssl11) | 3 | .if ! exists(/usr/local/bin/eopenssl11) |
| 4 | regress: | 4 | regress: |
| @@ -13,20 +13,13 @@ LDADD = -lssl -lcrypto | |||
| 13 | DPADD = /usr/local/lib/eopenssl11/libssl.a \ | 13 | DPADD = /usr/local/lib/eopenssl11/libssl.a \ |
| 14 | /usr/local/lib/eopenssl11/libcrypto.a | 14 | /usr/local/lib/eopenssl11/libcrypto.a |
| 15 | LD_LIBRARY_PATH = /usr/local/lib/eopenssl11 | 15 | LD_LIBRARY_PATH = /usr/local/lib/eopenssl11 |
| 16 | REGRESS_TARGETS = run-self | 16 | REGRESS_TARGETS = run-self-client-server |
| 17 | .for p in ${PROGS} | 17 | .for p in ${PROGS} |
| 18 | REGRESS_TARGETS += run-ldd-$p run-$p | 18 | REGRESS_TARGETS += run-ldd-$p run-version-$p run-protocol-$p |
| 19 | .for x in nc self | ||
| 20 | REGRESS_TARGETS += run-version-$x-$p run-protocol-$x-$p | ||
| 21 | .endfor | 19 | .endfor |
| 22 | .endfor | ||
| 23 | |||
| 24 | run-protocol-nc-client run-protocol-nc-server: | ||
| 25 | @echo '\n======== $@ ========' | ||
| 26 | # LibreSSL does not support TLS 1.3 yet | ||
| 27 | @echo DISABLED | ||
| 28 | 20 | ||
| 29 | .for p in ${PROGS} | 21 | .for p in ${PROGS} |
| 22 | |||
| 30 | run-ldd-$p: ldd-$p.out | 23 | run-ldd-$p: ldd-$p.out |
| 31 | @echo '\n======== $@ ========' | 24 | @echo '\n======== $@ ========' |
| 32 | # check that $p is linked with OpenSSL 1.1 | 25 | # check that $p is linked with OpenSSL 1.1 |
| @@ -34,18 +27,17 @@ run-ldd-$p: ldd-$p.out | |||
| 34 | grep -q /usr/local/lib/eopenssl11/libssl.so ldd-$p.out | 27 | grep -q /usr/local/lib/eopenssl11/libssl.so ldd-$p.out |
| 35 | # check that $p is not linked with LibreSSL | 28 | # check that $p is not linked with LibreSSL |
| 36 | ! grep -v libc.so ldd-$p.out | grep /usr/lib/ | 29 | ! grep -v libc.so ldd-$p.out | grep /usr/lib/ |
| 37 | .endfor | ||
| 38 | 30 | ||
| 39 | .for o in nc-client nc-server self-client self-server | 31 | run-version-$p: $p-self.out |
| 40 | run-version-$o: $o.out | ||
| 41 | @echo '\n======== $@ ========' | 32 | @echo '\n======== $@ ========' |
| 42 | # check that runtime version is OpenSSL 1.1 | 33 | # check that runtime version is OpenSSL 1.1 |
| 43 | grep 'SSLEAY_VERSION: OpenSSL 1.1' $o.out | 34 | grep 'SSLEAY_VERSION: OpenSSL 1.1' $p-self.out |
| 44 | 35 | ||
| 45 | run-protocol-$o: $o.out | 36 | run-protocol-$p: $p-self.out |
| 46 | @echo '\n======== $@ ========' | 37 | @echo '\n======== $@ ========' |
| 47 | # check that protocol version is TLS 1.3 | 38 | # check that OpenSSL 1.1 protocol version is TLS 1.3 |
| 48 | grep 'Protocol *: TLSv1.3' $o.out | 39 | grep 'Protocol *: TLSv1.3' $p-self.out |
| 40 | |||
| 49 | .endfor | 41 | .endfor |
| 50 | 42 | ||
| 51 | .include <bsd.regress.mk> | 43 | .include <bsd.regress.mk> |
diff --git a/src/regress/lib/libssl/interop/session/Makefile b/src/regress/lib/libssl/interop/session/Makefile index a555f133fb..072fa1b93c 100644 --- a/src/regress/lib/libssl/interop/session/Makefile +++ b/src/regress/lib/libssl/interop/session/Makefile | |||
| @@ -1,35 +1,42 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.1 2018/11/10 08:33:45 bluhm Exp $ | 1 | # $OpenBSD: Makefile,v 1.2 2018/11/11 00:15:04 bluhm Exp $ |
| 2 | 2 | ||
| 3 | run-client-openssl11-reuse-server-openssl11-reuse: | 3 | LIBRARIES = libressl |
| 4 | .if exists(/usr/local/bin/eopenssl) | ||
| 5 | LIBRARIES += openssl | ||
| 6 | .endif | ||
| 7 | .if exists(/usr/local/bin/eopenssl11) | ||
| 8 | LIBRARIES += openssl11 | ||
| 9 | .endif | ||
| 10 | |||
| 11 | run-session-client-openssl11-server-openssl11: | ||
| 4 | @echo '\n======== $@ ========' | 12 | @echo '\n======== $@ ========' |
| 5 | # TLS 1.3 needs some extra setup for session reuse | 13 | # TLS 1.3 needs some extra setup for session reuse |
| 6 | @echo DISABLED | 14 | @echo DISABLED |
| 7 | 15 | ||
| 8 | CLEANFILES += *.out | 16 | .for clib in ${LIBRARIES} |
| 9 | 17 | .for slib in ${LIBRARIES} | |
| 10 | .for clib in libressl openssl openssl11 | ||
| 11 | .for slib in libressl openssl openssl11 | ||
| 12 | 18 | ||
| 13 | REGRESS_TARGETS += run-client-${clib}-reuse-server-${slib}-reuse | 19 | REGRESS_TARGETS += run-session-client-${clib}-server-${slib} |
| 14 | 20 | ||
| 15 | run-client-${clib}-reuse-server-${slib}-reuse: 127.0.0.1.crt | 21 | run-session-client-${clib}-server-${slib}: \ |
| 22 | 127.0.0.1.crt ../${clib}/client ../${slib}/server | ||
| 16 | @echo '\n======== $@ ========' | 23 | @echo '\n======== $@ ========' |
| 17 | LD_LIBRARY_PATH=/usr/local/lib/e${slib} \ | 24 | LD_LIBRARY_PATH=/usr/local/lib/e${slib} \ |
| 18 | ../${slib}/server >server-${slib}-reuse.out \ | 25 | ../${slib}/server >${@:S/^run/server/}.out \ |
| 19 | -ss \ | 26 | -ss \ |
| 20 | 127.0.0.1 0 | 27 | 127.0.0.1 0 |
| 21 | LD_LIBRARY_PATH=/usr/local/lib/e${clib} \ | 28 | LD_LIBRARY_PATH=/usr/local/lib/e${clib} \ |
| 22 | ../${clib}/client >client-${clib}-reuse.out \ | 29 | ../${clib}/client >${@:S/^run/client/}.out \ |
| 23 | -ss \ | 30 | -ss \ |
| 24 | `sed -n 's/listen sock: //p' server-${slib}-reuse.out` | 31 | `sed -n 's/listen sock: //p' ${@:S/^run/server/}.out` |
| 25 | grep '^success$$' server-${slib}-reuse.out | 32 | grep '^success$$' ${@:S/^run/server/}.out |
| 26 | grep '^success$$' client-${clib}-reuse.out | 33 | grep '^success$$' ${@:S/^run/client/}.out |
| 27 | grep '^session 2: new$$' server-${slib}-reuse.out | 34 | grep '^session 2: new$$' ${@:S/^run/server/}.out |
| 28 | grep '^session 2: new$$' client-${clib}-reuse.out | 35 | grep '^session 2: new$$' ${@:S/^run/client/}.out |
| 29 | grep '^session 1: reuse$$' server-${slib}-reuse.out | 36 | grep '^session 1: reuse$$' ${@:S/^run/server/}.out |
| 30 | grep '^session 1: reuse$$' client-${clib}-reuse.out | 37 | grep '^session 1: reuse$$' ${@:S/^run/client/}.out |
| 31 | grep '^session 0: reuse$$' server-${slib}-reuse.out | 38 | grep '^session 0: reuse$$' ${@:S/^run/server/}.out |
| 32 | grep '^session 0: reuse$$' client-${clib}-reuse.out | 39 | grep '^session 0: reuse$$' ${@:S/^run/client/}.out |
| 33 | 40 | ||
| 34 | .endfor | 41 | .endfor |
| 35 | .endfor | 42 | .endfor |
