summaryrefslogtreecommitdiff
path: root/tests/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Makefile')
-rw-r--r--tests/Makefile31
1 files changed, 23 insertions, 8 deletions
diff --git a/tests/Makefile b/tests/Makefile
index b664790..2432680 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -14,12 +14,9 @@ export SOFTHSM2_CONF = $(SOFTHSM_DIR)/softhsm2.conf
all: direct-softhsm p11p-softhsm
-p11p-softhsm: testsig.hsm.p11p.pem
+p11p-softhsm: openssl.p11p.cnf testsig.hsm.p11p
echo "$(TEXT)" | ./do-verify.sh $< $(P11P_PROVIDER) ./openssl.p11p.cnf $(SOFTHSM_PROVIDER)
-direct-softhsm: testsig.hsm.pem
- echo "$(TEXT)" | ./do-verify.sh $< $(SOFTHSM_PROVIDER) ./openssl.direct.cnf
-
softhsm-token-setup: softhsm-token-setup.stamp
softhsm-token-setup.stamp: softhsm/tokens testkey.pkcs8
test -x $(SOFTHSM)
@@ -37,19 +34,37 @@ testkey.pkcs8: testkey.pem
testkey.pem:
openssl genrsa -out $@ 2048
-testsig.local.pem: testkey.pem
+testsig.local: testkey.pem
echo "$(TEXT)" | openssl dgst -sha256 -sign testkey.pem -out $@
-testsig.hsm.pem: softhsm-token-setup
+testsig.hsm: softhsm-token-setup
echo "$(TEXT)" | ./do-sign.sh $@ $(SOFTHSM_PROVIDER) ./openssl.direct.cnf
-testsig.hsm.p11p.pem: softhsm-token-setup
+testsig.hsm.p11p: openssl.p11p.cnf softhsm-token-setup
echo "$(TEXT)" | ./do-sign.sh $@ $(P11P_PROVIDER) ./openssl.p11p.cnf $(SOFTHSM_PROVIDER)
+direct-softhsm: testsig.hsm openssl.direct.cnf
+ echo "$(TEXT)" | ./do-verify.sh $< $(SOFTHSM_PROVIDER) ./openssl.direct.cnf
+
+openssl.direct.cnf: openssl.template.cnf
+ sed -e "s!@@P11P_PROVIDER@@!$(SOFTHSM_PROVIDER)!1" <$^ >$@
+
+openssl.p11p.cnf: openssl.template.cnf
+ sed -e "s!@@P11P_PROVIDER@@!$(P11P_PROVIDER)!1" <$^ >$@
+
+
+openssl.template.cnf:
+ printf "openssl_conf = openssl_init\n" >> $@
+ printf "[openssl_init]\nengines=engine_section\n" >> $@
+ printf "[engine_section]\npkcs11 = pkcs11_section\n" >> $@
+ printf "[pkcs11_section]\ndynamic_path = /usr/lib/x86_64-linux-gnu/engines-1.1/pkcs11.so\n" >> $@
+ printf "MODULE_PATH = @@P11P_PROVIDER@@\n" >> $@
+
clean:
-rm -r softhsm
-rm softhsm-token-setup.stamp
-rm testkey.pem testkey.pkcs8
- -rm testsig.*.pem
+ -rm testsig.*
+ -rm openssl.*.cnf
.PHONY: clean