From 2843d32d000ecd28ea035280440d10b6c878d525 Mon Sep 17 00:00:00 2001 From: Tom Krizek Date: Tue, 25 Oct 2022 14:05:07 +0200 Subject: [PATCH] Support testcrypto.sh usage without including conf.sh The only variable really needed for the script to work is the path to the $KEYGEN binary. Allow setting this via an environment variable to avoid loading conf.sh (and causing a chicken-egg problem). Also make testcrypto.sh executable to allow its use from conf.sh. (cherry picked from commit bb1c6bbdc701cdbadfe7c796acf8b5ecd719f1b9) --- bin/tests/system/testcrypto.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) mode change 100644 => 100755 bin/tests/system/testcrypto.sh diff --git a/bin/tests/system/testcrypto.sh b/bin/tests/system/testcrypto.sh old mode 100644 new mode 100755 index 96cc39651e..72237777d9 --- a/bin/tests/system/testcrypto.sh +++ b/bin/tests/system/testcrypto.sh @@ -11,14 +11,16 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -. ../conf.sh +if test -z "$KEYGEN"; then + . ../conf.sh + alg="-a $DEFAULT_ALGORITHM -b $DEFAULT_BITS" +else + alg="" +fi prog=$0 - args="" -alg="-a $DEFAULT_ALGORITHM -b $DEFAULT_BITS" quiet=0 - msg="cryptography" while test "$#" -gt 0; do case $1 in @@ -62,6 +64,11 @@ while test "$#" -gt 0; do shift done +if test -z "$alg"; then + echo "${prog}: no algorithm selected" + exit 1 +fi + if $KEYGEN $args $alg foo > /dev/null 2>&1 then rm -f Kfoo*