1# $OpenBSD: Makefile,v 1.5 2021/12/02 17:10:53 kn Exp $ 2 3.include <bsd.own.mk> 4 5.if ! exists(/usr/local/bin/botan) 6regress: 7 # install botan2 from ports for interop tests 8 @echo 'Run "pkg_add botan2" to run tests against Botan 2' 9 @echo SKIPPED 10.elif (${COMPILER_VERSION:L} != "clang" && ! exists(/usr/local/bin/eg++)) 11regress: 12 # on gcc-archs install g++ from ports for botan2 interop tests 13 @echo 'Run "pkg_add g++" to run tests against Botan 2 on GCC architectures' 14 @echo SKIPPED 15.else 16 17# C++11 18.if ${COMPILER_VERSION:L} != "clang" && ${CXX} == "c++" 19CXX = /usr/local/bin/eg++ 20.endif 21 22LIBRARIES = libressl 23.if exists(/usr/local/bin/eopenssl) 24LIBRARIES += openssl 25.endif 26.if exists(/usr/local/bin/eopenssl11) 27LIBRARIES += openssl11 28.endif 29 30PROGS = client 31SRCS_client = client.cpp 32CXXFLAGS = -I/usr/local/include/botan-2 -Wall 33LDFLAGS = -L/usr/local/lib 34LDADD = -lbotan-2 35DPADD = /usr/local/lib/libbotan-2.a 36 37.for lib in ${LIBRARIES} 38 39REGRESS_TARGETS += run-client-botan-server-${lib} 40 41run-client-botan-server-${lib}: client server.crt 42 LD_LIBRARY_PATH=/usr/local/lib/e${lib} \ 43 ../${lib}/server >server-${lib}.out \ 44 -c server.crt -k server.key \ 45 127.0.0.1 0 46 ./client >client-botan.out \ 47 -C ca.crt \ 48 127.0.0.1 \ 49 `sed -n 's/listen sock: 127.0.0.1 //p' server-${lib}.out` 50 # check that the server child run successfully to the end 51 grep -q '^success$$' server-${lib}.out || \ 52 { sleep 1; grep -q '^success$$' server-${lib}.out; } 53 # server must have read client hello 54 grep -q '^<<< hello$$' server-${lib}.out 55 # check that the client run successfully to the end 56 grep -q '^success$$' client-botan.out 57 # client must have read server greeting 58 grep -q '^<<< greeting$$' client-botan.out 59 # currently botan supports TLS 1.2, adapt later 60 grep -q ' Protocol *: TLSv1.2$$' server-${lib}.out 61 62.endfor 63 64server.key ca.key: 65 /usr/local/bin/botan keygen >$@.tmp 66 mv $@.tmp $@ 67 68ca.crt: ${@:R}.key 69 /usr/local/bin/botan gen_self_signed ${@:R}.key ${@:R} >$@.tmp \ 70 --organization=tls-regress --ca 71 mv $@.tmp $@ 72 73server.req: ${@:R}.key 74 /usr/local/bin/botan gen_pkcs10 ${@:R}.key localhost >$@.tmp \ 75 --organization=tls-regress --dns=127.0.0.1 76 mv $@.tmp $@ 77 78server.crt: ca.crt ${@:R}.req 79 /usr/local/bin/botan sign_cert ca.crt ca.key ${@:R}.req >$@.tmp 80 mv $@.tmp $@ 81 82.endif # exists(/usr/local/bin/botan) 83 84.include <bsd.regress.mk> 85