From 2cd5b662be8eb60f1d5330727af6e46d9991df31 Mon Sep 17 00:00:00 2001 From: tb Date: Tue, 6 Feb 2018 02:31:13 +0000 Subject: [PATCH] Respect the OPENSSL make variable everywhere so that make OPENSSL=/usr/src/usr.bin/openssl/obj/openssl actually does the expected thing instead of running a mixture of both the openssl below /usr/obj and the one below /usr/bin. Found the hard way via backtraces that made no sense whatsoever. ok jsing --- regress/usr.bin/openssl/Makefile | 10 +++++----- regress/usr.bin/openssl/appstest.sh | 2 +- regress/usr.bin/openssl/test_client.sh | 4 ++-- regress/usr.bin/openssl/test_server.sh | 4 ++-- regress/usr.bin/openssl/testdsa.sh | 9 +++++---- regress/usr.bin/openssl/testenc.sh | 4 ++-- regress/usr.bin/openssl/testrsa.sh | 9 +++++---- 7 files changed, 22 insertions(+), 20 deletions(-) diff --git a/regress/usr.bin/openssl/Makefile b/regress/usr.bin/openssl/Makefile index d1c609980c2..c6bc2748cc9 100644 --- a/regress/usr.bin/openssl/Makefile +++ b/regress/usr.bin/openssl/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.4 2016/11/06 11:56:43 inoguchi Exp $ +# $OpenBSD: Makefile,v 1.5 2018/02/06 02:31:13 tb Exp $ SUBDIR= options @@ -52,13 +52,13 @@ CLEANFILES+=${CIPHER}.${ENC} ${CIPHER}.${ENC}.b64 ${CLEAR2}.${ENC} ${CLEAR2}.${E .endfor ssl-enc: - sh ${.CURDIR}/testenc.sh ${.OBJDIR} ${.CURDIR} + env OPENSSL=${OPENSSL} sh ${.CURDIR}/testenc.sh ${.OBJDIR} ${.CURDIR} ssl-dsa: - sh ${.CURDIR}/testdsa.sh ${.OBJDIR} ${.CURDIR} + env OPENSSL=${OPENSSL} sh ${.CURDIR}/testdsa.sh ${.OBJDIR} ${.CURDIR} ssl-rsa: - sh ${.CURDIR}/testrsa.sh ${.OBJDIR} ${.CURDIR} + env OPENSSL=${OPENSSL} sh ${.CURDIR}/testrsa.sh ${.OBJDIR} ${.CURDIR} appstest: - sh ${.CURDIR}/appstest.sh ${.OBJDIR} ${.CURDIR} + env OPENSSL=${OPENSSL} sh ${.CURDIR}/appstest.sh ${.OBJDIR} ${.CURDIR} clean: rm -rf ${CLEANFILES} diff --git a/regress/usr.bin/openssl/appstest.sh b/regress/usr.bin/openssl/appstest.sh index f241e2c34b2..24d1d741a0f 100755 --- a/regress/usr.bin/openssl/appstest.sh +++ b/regress/usr.bin/openssl/appstest.sh @@ -6,7 +6,7 @@ # output : all files generated by this script go under $ssldir # -openssl_bin=/usr/bin/openssl +openssl_bin=${OPENSSL:-/usr/bin/openssl} uname_s=`uname -s | grep 'MINGW'` if [ "$uname_s" = "" ] ; then diff --git a/regress/usr.bin/openssl/test_client.sh b/regress/usr.bin/openssl/test_client.sh index 36c6ac4adda..fed2baace07 100644 --- a/regress/usr.bin/openssl/test_client.sh +++ b/regress/usr.bin/openssl/test_client.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $OpenBSD: test_client.sh,v 1.1 2014/08/26 17:50:07 jsing Exp $ +# $OpenBSD: test_client.sh,v 1.2 2018/02/06 02:31:13 tb Exp $ echo echo This starts a tls1 mode client to talk to the server run by @@ -9,4 +9,4 @@ echo type in this window after ssl negotiation and your output should echo be echoed by the server. echo echo -/usr/bin/openssl s_client -tls1 +${OPENSSL:-/usr/bin/openssl} s_client -tls1 diff --git a/regress/usr.bin/openssl/test_server.sh b/regress/usr.bin/openssl/test_server.sh index b4fd2560dff..ec4a78a27a8 100644 --- a/regress/usr.bin/openssl/test_server.sh +++ b/regress/usr.bin/openssl/test_server.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $OpenBSD: test_server.sh,v 1.1 2014/08/26 17:50:07 jsing Exp $ +# $OpenBSD: test_server.sh,v 1.2 2018/02/06 02:31:13 tb Exp $ echo This starts a tls1 mode server using the DSA certificate in ./server.pem echo Run ./testclient.sh in another window and type at it, you should @@ -7,4 +7,4 @@ echo see the results of the ssl negotiation, and stuff you type in the client echo should echo in this window echo echo -/usr/bin/openssl s_server -tls1 -key testdsa.key -cert testdsa.pem +${OPENSSL:-/usr/bin/openssl} s_server -tls1 -key testdsa.key -cert testdsa.pem diff --git a/regress/usr.bin/openssl/testdsa.sh b/regress/usr.bin/openssl/testdsa.sh index 32293d8ff35..a04ba171ff4 100644 --- a/regress/usr.bin/openssl/testdsa.sh +++ b/regress/usr.bin/openssl/testdsa.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $OpenBSD: testdsa.sh,v 1.1 2014/08/26 17:50:07 jsing Exp $ +# $OpenBSD: testdsa.sh,v 1.2 2018/02/06 02:31:13 tb Exp $ #Test DSA certificate generation of openssl @@ -7,21 +7,22 @@ cd $1 # Generate DSA paramter set -openssl dsaparam 512 -out dsa512.pem +openssl_bin=${OPENSSL:-/usr/bin/openssl} +$openssl_bin dsaparam 512 -out dsa512.pem if [ $? != 0 ]; then exit 1; fi # Denerate a DSA certificate -openssl req -config $2/openssl.cnf -x509 -newkey dsa:dsa512.pem -out testdsa.pem -keyout testdsa.key +$openssl_bin req -config $2/openssl.cnf -x509 -newkey dsa:dsa512.pem -out testdsa.pem -keyout testdsa.key if [ $? != 0 ]; then exit 1; fi # Now check the certificate -openssl x509 -text -in testdsa.pem +$openssl_bin x509 -text -in testdsa.pem if [ $? != 0 ]; then exit 1; fi diff --git a/regress/usr.bin/openssl/testenc.sh b/regress/usr.bin/openssl/testenc.sh index 72c87a87a91..89b3068a082 100644 --- a/regress/usr.bin/openssl/testenc.sh +++ b/regress/usr.bin/openssl/testenc.sh @@ -1,9 +1,9 @@ #!/bin/sh -# $OpenBSD: testenc.sh,v 1.1 2014/08/26 17:50:07 jsing Exp $ +# $OpenBSD: testenc.sh,v 1.2 2018/02/06 02:31:13 tb Exp $ testsrc=$2/openssl.cnf test=$1/p -cmd=/usr/bin/openssl +cmd=${OPENSSL:-/usr/bin/openssl} cd $1 diff --git a/regress/usr.bin/openssl/testrsa.sh b/regress/usr.bin/openssl/testrsa.sh index a9a00f295e0..36f5e639e8e 100644 --- a/regress/usr.bin/openssl/testrsa.sh +++ b/regress/usr.bin/openssl/testrsa.sh @@ -1,27 +1,28 @@ #!/bin/sh -# $OpenBSD: testrsa.sh,v 1.1 2014/08/26 17:50:07 jsing Exp $ +# $OpenBSD: testrsa.sh,v 1.2 2018/02/06 02:31:13 tb Exp $ #Test RSA certificate generation of openssl cd $1 +openssl_bin=${OPENSSL:-/usr/bin/openssl} # Generate RSA private key -openssl genrsa -out rsakey.pem +$openssl_bin genrsa -out rsakey.pem if [ $? != 0 ]; then exit 1; fi # Generate an RSA certificate -openssl req -config $2/openssl.cnf -key rsakey.pem -new -x509 -days 365 -out rsacert.pem +$openssl_bin req -config $2/openssl.cnf -key rsakey.pem -new -x509 -days 365 -out rsacert.pem if [ $? != 0 ]; then exit 1; fi # Now check the certificate -openssl x509 -text -in rsacert.pem +$openssl_bin x509 -text -in rsacert.pem if [ $? != 0 ]; then exit 1; fi -- 2.20.1