1# $OpenBSD: Makefile,v 1.10 2025/01/15 10:54:17 tb Exp $ 2 3LIBRARIES = libressl 4.if exists(/usr/local/bin/eopenssl33) 5LIBRARIES += openssl33 6.endif 7.if exists(/usr/local/bin/eopenssl34) 8LIBRARIES += openssl34 9.endif 10 11# run netcat server and connect with test client 12 13.for clib in ${LIBRARIES} 14 15REGRESS_TARGETS += run-netcat-client-${clib}-server-nc 16REGRESS_TARGETS += run-protocol-client-${clib} 17 18run-netcat-client-${clib}-server-nc: ../${clib}/client 127.0.0.1.crt 19 echo "greeting" | \ 20 nc >${@:S/^run/server/}.out \ 21 -l -c -C 127.0.0.1.crt -K 127.0.0.1.key \ 22 127.0.0.1 0 & \ 23 for i in `jot 1000`; do fstat -p $$! >netcat.fstat; \ 24 grep -q ' stream tcp .*:[1-9][0-9]*$$' netcat.fstat && \ 25 exit 0; done; exit 1 26 LD_LIBRARY_PATH=/usr/local/lib/e${clib} \ 27 ../${clib}/client >${@:S/^run/client/}.out \ 28 `sed -n 's/.* stream tcp .*:/127.0.0.1 /p' netcat.fstat` 29 # check that the client run successfully to the end 30 grep -q '^success$$' ${@:S/^run/client/}.out 31 # client must have read server greeting 32 grep -q '^<<< greeting$$' ${@:S/^run/client/}.out 33 # netstat server must have read client hello 34 grep -q '^hello$$' ${@:S/^run/server/}.out 35 36.endfor 37 38# run test server and connect with netcat client 39 40.for slib in ${LIBRARIES} 41 42REGRESS_TARGETS += run-netcat-client-nc-server-${slib} 43 44run-netcat-client-nc-server-${slib}: ../${slib}/server 127.0.0.1.crt 45 LD_LIBRARY_PATH=/usr/local/lib/e${slib} \ 46 ../${slib}/server >${@:S/^run/server/}.out \ 47 127.0.0.1 0 48 echo "hello" | \ 49 nc >${@:S/^run/client/}.out \ 50 -c -R 127.0.0.1.crt \ 51 `sed -n 's/listen sock: //p' ${@:S/^run/server/}.out` 52 # check that the server child run successfully to the end 53 grep -q '^success$$' ${@:S/^run/server/}.out || \ 54 { sleep 1; grep -q '^success$$' ${@:S/^run/server/}.out; } 55 # server must have read client hello 56 grep -q '^<<< hello$$' ${@:S/^run/server/}.out 57 # client must have read server greeting 58 grep -q '^greeting$$' ${@:S/^run/client/}.out 59 60.endfor 61 62# check the TLS protocol version in client and server logs 63 64.for clib in ${LIBRARIES} 65 66REGRESS_TARGETS += run-protocol-client-${clib} 67 68run-protocol-client-${clib}: client-netcat-client-${clib}-server-nc.out 69 # check that LibTLS protocol version is TLS 1.2 or TLS 1.3 70 grep 'Protocol *: TLSv1.[23]' client-netcat-client-${clib}-server-nc.out 71 72.endfor 73 74.for slib in ${LIBRARIES} 75 76REGRESS_TARGETS += run-protocol-server-${slib} 77 78run-protocol-server-${slib}: server-netcat-client-nc-server-${slib}.out 79 # check that LibTLS protocol version is TLS 1.2 or TLS 1.3 80 grep 'Protocol *: TLSv1.[23]' server-netcat-client-nc-server-${slib}.out 81 82.endfor 83 84.include <bsd.regress.mk> 85