43 lines
1.5 KiB
Diff
43 lines
1.5 KiB
Diff
|
diff --git a/tests/pkcs11/setup-softhsm-tokens.sh b/tests/pkcs11/setup-softhsm-tokens.sh
|
||
|
index 532c86a7..8a15c2e9 100755
|
||
|
--- a/tests/pkcs11/setup-softhsm-tokens.sh
|
||
|
+++ b/tests/pkcs11/setup-softhsm-tokens.sh
|
||
|
@@ -41,8 +41,27 @@ if [ $ret -ne 0 ]; then
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
+find_library_path() {
|
||
|
+ echo "$@"
|
||
|
+ for _lib in "$@" ; do
|
||
|
+ if test -f "$_lib" ; then
|
||
|
+ LIBSOFTHSM_PATH="$_lib"
|
||
|
+ echo "Using libsofthsm path: $_lib"
|
||
|
+ return
|
||
|
+ fi
|
||
|
+ done
|
||
|
+ echo "libsofthsm2.so not found"
|
||
|
+ exit 1
|
||
|
+}
|
||
|
+
|
||
|
+find_library_path \
|
||
|
+ /usr/lib64/libsofthsm2.so \
|
||
|
+ /usr/lib/libsofthsm2.so \
|
||
|
+ /usr/local/lib/softhsm/libsofthsm2.so \
|
||
|
+ /usr/lib/x86_64-linux-gnu/softhsm/libsofthsm2.so
|
||
|
+
|
||
|
#load private key
|
||
|
-cmd='p11tool --provider /usr/lib64/pkcs11/libsofthsm2.so --write --load-privkey "$PRIVKEY" --label "$OBJNAME" --login --set-pin=1234 "pkcs11:token="$OBJNAME""'
|
||
|
+cmd='p11tool --provider $LIBSOFTHSM_PATH --write --load-privkey "$PRIVKEY" --label "$OBJNAME" --login --set-pin=1234 "pkcs11:token="$OBJNAME""'
|
||
|
eval echo "$cmd"
|
||
|
out=$(eval $cmd)
|
||
|
ret=$?
|
||
|
@@ -58,7 +77,7 @@ ls -l $TESTDIR
|
||
|
|
||
|
if [ $LOADPUBLIC -ne 0 ]; then
|
||
|
#load public key
|
||
|
- cmd='p11tool --provider /usr/lib64/pkcs11/libsofthsm2.so --write --load-pubkey "$PUBKEY" --label "$OBJNAME" --login --set-pin=1234 "pkcs11:token="$OBJNAME""'
|
||
|
+ cmd='p11tool --provider $LIBSOFTHSM_PATH --write --load-pubkey "$PUBKEY" --label "$OBJNAME" --login --set-pin=1234 "pkcs11:token="$OBJNAME""'
|
||
|
eval echo "$cmd"
|
||
|
out=$(eval $cmd)
|
||
|
ret=$?
|