aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--GNUmakefile25
1 files changed, 20 insertions, 5 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 07eb372..4a7df7c 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -131,11 +131,26 @@ ifneq "${HSMBULLY}" ""
--pin fnord --so-pin fnord --pkcs11lib $(abspath libpkcs11.so) \
--verbose=9 --fast-and-frivolous --skip-fragmentation --skip-keysizing
+ HSMBULLY_DATABASE=$(abspath hsmbully.pkcs11.db)
+ HSMBULLY_KS_CLIENT=$(abspath hsmbully.client-keystore)
+ HSMBULLY_KS_SERVER=$(abspath hsmbully.server-keystore)
+
+ HSMBULLY_SERVER_BIN=$(wildcard $(abspath ../libhal/tests/test-rpc_server))
+
bully: all
- export PKCS11_DATABASE=$(abspath hsmbully.pkcs11.db); \
- sudo -E rm -f ${PKCS11_DATABASE} ${PKCS11_DATABASE}-journal; \
- (echo fnord; echo fnord) | sudo -E ./p11util --set-so-pin --set-user-pin --pin-from-stdin; \
- sudo -E ${HSMBULLY} ${HSMBULLY_OPTIONS}; \
- sudo -E rm -f ${PKCS11_DATABASE} ${PKCS11_DATABASE}-journal
+ set -x; \
+ sudo rm -f ${HSMBULLY_DATABASE} ${HSMBULLY_DATABASE}-journal ${HSMBULLY_KS_CLIENT} ${HSMBULLY_KS_SERVER}; \
+ if test -x ${HSMBULLY_SERVER_BIN}; \
+ then \
+ sudo CRYPTECH_KEYSTORE=${HSMBULLY_KS_SERVER} ${HSMBULLY_SERVER_BIN} & \
+ pid=$$!; \
+ fi; \
+ (echo fnord; echo fnord) | sudo ./p11util --set-so-pin --set-user-pin --pin-from-stdin; \
+ sudo PKCS11_DATABASE=${HSMBULLY_DATABASE} CRYPTECH_KEYSTORE=${HSMBULLY_KS_CLIENT} ${HSMBULLY} ${HSMBULLY_OPTIONS}; \
+ if test -x ${HSMBULLY_SERVER_BIN}; \
+ then \
+ sudo kill $$pid; \
+ fi; \
+ sudo rm -f ${HSMBULLY_DATABASE} ${HSMBULLY_DATABASE}-journal ${HSMBULLY_KS_CLIENT} ${HSMBULLY_KS_SERVER}
endif