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 bb1c6bbdc7)
This commit is contained in:
Tom Krizek
2022-10-25 14:05:07 +02:00
parent 798f969043
commit 2843d32d00

15
bin/tests/system/testcrypto.sh Normal file → Executable file
View File

@@ -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*