forked from opencryptoki/opencryptoki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.am
313 lines (294 loc) · 13.1 KB
/
Makefile.am
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
ACLOCAL_AMFLAGS = -I m4
CLEANFILES =
DISTCLEANFILES = *~ opencryptoki.map.sym opencryptoki_tok.map.sym
MAINTAINERCLEANFILES = test-driver \
Makefile.in aclocal.m4 compile configure config.guess \
config.sub depcomp install-sh ltmain.sh m4/* missing \
depcomp ylwrap
if AIX
EXTRA_DIST = opencryptoki.map opencryptoki_tok.map \
opencryptoki.map.sym opencryptoki_tok.map.sym
SHLIBEXT=a
LNFLAG=fs
KILLALL = ./kill-all
else
EXTRA_DIST = opencryptoki.map opencryptoki_tok.map
SHLIBEXT=so
LNFLAG=nfs
KILLALL = killall
endif
AM_YFLAGS = -d -v
BUILT_SOURCES =
man1_MANS =
man5_MANS =
man7_MANS =
man8_MANS =
sbin_PROGRAMS =
nobase_lib_LTLIBRARIES =
noinst_HEADERS =
noinst_LTLIBRARIES =
noinst_PROGRAMS =
noinst_SCRIPTS =
if ENABLE_LIBRARY
include misc/misc.mk
else
if ENABLE_DAEMON
include misc/misc.mk
endif
endif
if ENABLE_TESTCASES
include testcases/testcases.mk
endif
include man/man.mk
include usr/usr.mk
include tools/tools.mk
include doc/doc.mk
install-data-hook:
if AIX
lsgroup $(pkcs_group) > /dev/null || $(GROUPADD) -a pkcs11
lsuser $(pkcsslotd_user) > /dev/null || $(USERADD) -g $(pkcs_group) -d $(DESTDIR)$(RUN_PATH)/opencryptoki -c "Opencryptoki pkcsslotd user" $(pkcsslotd_user)
else
getent group $(pkcs_group) > /dev/null || $(GROUPADD) -r $(pkcs_group)
getent passwd $(pkcsslotd_user) >/dev/null || $(USERADD) -r -g $(pkcs_group) -d $(RUN_PATH)/opencryptoki -s /sbin/nologin -c "Opencryptoki pkcsslotd user" $(pkcsslotd_user)
endif
$(MKDIR_P) $(DESTDIR)$(RUN_PATH)/opencryptoki/
$(CHOWN) $(pkcsslotd_user):$(pkcs_group) $(DESTDIR)$(RUN_PATH)/opencryptoki/
$(CHGRP) $(pkcs_group) $(DESTDIR)$(RUN_PATH)/opencryptoki/
$(CHMOD) 0710 $(DESTDIR)$(RUN_PATH)/opencryptoki/
$(MKDIR_P) $(DESTDIR)$(localstatedir)/lib/opencryptoki
$(CHGRP) $(pkcs_group) $(DESTDIR)$(localstatedir)/lib/opencryptoki
$(CHMOD) 0770 $(DESTDIR)$(localstatedir)/lib/opencryptoki
if ENABLE_LIBRARY
$(MKDIR_P) $(DESTDIR)$(libdir)/opencryptoki/stdll
$(MKDIR_P) $(DESTDIR)$(libdir)/pkcs11
cd $(DESTDIR)$(libdir)/opencryptoki && \
ln -fs libopencryptoki.$(SHLIBEXT) PKCS11_API.$(SHLIBEXT)
cd $(DESTDIR)$(libdir)/opencryptoki && \
ln -$(LNFLAG) $(sbindir) methods
cd $(DESTDIR)$(libdir)/pkcs11 && \
ln -$(LNFLAG) $(sbindir) methods
cd $(DESTDIR)$(libdir)/pkcs11 && \
ln -fs ../opencryptoki/libopencryptoki.$(SHLIBEXT) PKCS11_API.$(SHLIBEXT)
cd $(DESTDIR)$(libdir)/pkcs11 && \
ln -fs ../opencryptoki/libopencryptoki.$(SHLIBEXT) libopencryptoki.$(SHLIBEXT)
cd $(DESTDIR)$(libdir)/pkcs11 && \
ln -$(LNFLAG) ../opencryptoki/stdll/ stdll
endif
if ENABLE_PKCSHSM_MK_CHANGE
$(MKDIR_P) $(DESTDIR)$(localstatedir)/lib/opencryptoki/HSM_MK_CHANGE
$(CHGRP) $(pkcs_group) $(DESTDIR)$(localstatedir)/lib/opencryptoki/HSM_MK_CHANGE
$(CHMOD) 0770 $(DESTDIR)$(localstatedir)/lib/opencryptoki/HSM_MK_CHANGE
endif
if ENABLE_CCATOK
cd $(DESTDIR)$(libdir)/opencryptoki/stdll && \
ln -fs libpkcs11_cca.$(SHLIBEXT) PKCS11_CCA.$(SHLIBEXT)
$(MKDIR_P) $(DESTDIR)$(localstatedir)/lib/opencryptoki/ccatok/TOK_OBJ
$(CHGRP) $(pkcs_group) $(DESTDIR)$(localstatedir)/lib/opencryptoki/ccatok/TOK_OBJ
$(CHGRP) $(pkcs_group) $(DESTDIR)$(localstatedir)/lib/opencryptoki/ccatok
$(CHMOD) 0770 $(DESTDIR)$(localstatedir)/lib/opencryptoki/ccatok/TOK_OBJ
$(CHMOD) 0770 $(DESTDIR)$(localstatedir)/lib/opencryptoki/ccatok
$(MKDIR_P) $(DESTDIR)$(lockdir)/ccatok
$(CHGRP) $(pkcs_group) $(DESTDIR)$(lockdir)/ccatok
$(CHMOD) 0770 $(DESTDIR)$(lockdir)/ccatok
test -f $(DESTDIR)$(sysconfdir)/opencryptoki || $(MKDIR_P) $(DESTDIR)$(sysconfdir)/opencryptoki || true
test -f $(DESTDIR)$(sysconfdir)/opencryptoki/ccatok.conf || $(INSTALL) -m 644 $(srcdir)/usr/lib/cca_stdll/ccatok.conf $(DESTDIR)$(sysconfdir)/opencryptoki/ccatok.conf || true
endif
if ENABLE_EP11TOK
cd $(DESTDIR)$(libdir)/opencryptoki/stdll && \
ln -fs libpkcs11_ep11.$(SHLIBEXT) PKCS11_EP11.$(SHLIBEXT)
$(MKDIR_P) $(DESTDIR)$(localstatedir)/lib/opencryptoki/ep11tok/TOK_OBJ
$(CHGRP) $(pkcs_group) $(DESTDIR)$(localstatedir)/lib/opencryptoki/ep11tok/TOK_OBJ
$(CHGRP) $(pkcs_group) $(DESTDIR)$(localstatedir)/lib/opencryptoki/ep11tok
$(CHMOD) 0770 $(DESTDIR)$(localstatedir)/lib/opencryptoki/ep11tok/TOK_OBJ
$(CHMOD) 0770 $(DESTDIR)$(localstatedir)/lib/opencryptoki/ep11tok
$(MKDIR_P) $(DESTDIR)$(lockdir)/ep11tok
$(CHGRP) $(pkcs_group) $(DESTDIR)$(lockdir)/ep11tok
$(CHMOD) 0770 $(DESTDIR)$(lockdir)/ep11tok
test -f $(DESTDIR)$(sysconfdir)/opencryptoki || $(MKDIR_P) $(DESTDIR)$(sysconfdir)/opencryptoki || true
test -f $(DESTDIR)$(sysconfdir)/opencryptoki/ep11tok.conf || $(INSTALL) -m 644 $(srcdir)/usr/lib/ep11_stdll/ep11tok.conf $(DESTDIR)$(sysconfdir)/opencryptoki/ep11tok.conf || true
test -f $(DESTDIR)$(sysconfdir)/opencryptoki/ep11cpfilter.conf || $(INSTALL) -m 644 $(srcdir)/usr/lib/ep11_stdll/ep11cpfilter.conf $(DESTDIR)$(sysconfdir)/opencryptoki/ep11cpfilter.conf || true
endif
if ENABLE_P11SAK
test -f $(DESTDIR)$(sysconfdir)/opencryptoki || $(MKDIR_P) $(DESTDIR)$(sysconfdir)/opencryptoki || true
test -f $(DESTDIR)$(sysconfdir)/opencryptoki/p11sak_defined_attrs.conf || $(INSTALL) -g $(pkcs_group) -m 0640 $(srcdir)/usr/sbin/p11sak/p11sak_defined_attrs.conf $(DESTDIR)$(sysconfdir)/opencryptoki/p11sak_defined_attrs.conf || true
endif
if ENABLE_ICATOK
cd $(DESTDIR)$(libdir)/opencryptoki/stdll && \
ln -fs libpkcs11_ica.$(SHLIBEXT) PKCS11_ICA.$(SHLIBEXT)
$(MKDIR_P) $(DESTDIR)$(localstatedir)/lib/opencryptoki/lite/TOK_OBJ
$(CHGRP) $(pkcs_group) $(DESTDIR)$(localstatedir)/lib/opencryptoki/lite/TOK_OBJ
$(CHGRP) $(pkcs_group) $(DESTDIR)$(localstatedir)/lib/opencryptoki/lite
$(CHMOD) 0770 $(DESTDIR)$(localstatedir)/lib/opencryptoki/lite/TOK_OBJ
$(CHMOD) 0770 $(DESTDIR)$(localstatedir)/lib/opencryptoki/lite
$(MKDIR_P) $(DESTDIR)$(lockdir)/lite
$(CHGRP) $(pkcs_group) $(DESTDIR)$(lockdir)/lite
$(CHMOD) 0770 $(DESTDIR)$(lockdir)/lite
endif
if ENABLE_SWTOK
cd $(DESTDIR)$(libdir)/opencryptoki/stdll && \
ln -fs libpkcs11_sw.$(SHLIBEXT) PKCS11_SW.$(SHLIBEXT)
$(MKDIR_P) $(DESTDIR)$(localstatedir)/lib/opencryptoki/swtok/TOK_OBJ
$(CHGRP) $(pkcs_group) $(DESTDIR)$(localstatedir)/lib/opencryptoki/swtok/TOK_OBJ
$(CHGRP) $(pkcs_group) $(DESTDIR)$(localstatedir)/lib/opencryptoki/swtok
$(CHMOD) 0770 $(DESTDIR)$(localstatedir)/lib/opencryptoki/swtok/TOK_OBJ
$(CHMOD) 0770 $(DESTDIR)$(localstatedir)/lib/opencryptoki/swtok
$(MKDIR_P) $(DESTDIR)$(lockdir)/swtok
$(CHGRP) $(pkcs_group) $(DESTDIR)$(lockdir)/swtok
$(CHMOD) 0770 $(DESTDIR)$(lockdir)/swtok
endif
if ENABLE_TPMTOK
$(MKDIR_P) $(DESTDIR)$(localstatedir)/lib/opencryptoki/tpm
cd $(DESTDIR)$(libdir)/opencryptoki/stdll && \
ln -fs libpkcs11_tpm.$(SHLIBEXT) PKCS11_TPM.$(SHLIBEXT)
$(MKDIR_P) $(DESTDIR)$(localstatedir)/lib/opencryptoki/tpm
$(CHGRP) $(pkcs_group) $(DESTDIR)$(localstatedir)/lib/opencryptoki/tpm
$(CHMOD) 0770 $(DESTDIR)$(localstatedir)/lib/opencryptoki/tpm
$(MKDIR_P) $(DESTDIR)$(lockdir)/tpm
$(CHGRP) $(pkcs_group) $(DESTDIR)$(lockdir)/tpm
$(CHMOD) 0770 $(DESTDIR)$(lockdir)/tpm
endif
if ENABLE_ICSFTOK
$(MKDIR_P) $(DESTDIR)$(localstatedir)/lib/opencryptoki/icsf
cd $(DESTDIR)$(libdir)/opencryptoki/stdll && \
ln -fs libpkcs11_icsf.$(SHLIBEXT) PKCS11_ICSF.$(SHLIBEXT)
$(MKDIR_P) $(DESTDIR)$(localstatedir)/lib/opencryptoki/icsf
$(CHGRP) $(pkcs_group) $(DESTDIR)$(localstatedir)/lib/opencryptoki/icsf
$(CHMOD) 0770 $(DESTDIR)$(localstatedir)/lib/opencryptoki/icsf
$(MKDIR_P) $(DESTDIR)$(lockdir)/icsf
$(CHGRP) $(pkcs_group) $(DESTDIR)$(lockdir)/icsf
$(CHMOD) 0770 $(DESTDIR)$(lockdir)/icsf
endif
if ENABLE_DAEMON
test -f $(DESTDIR)$(sysconfdir)/opencryptoki || $(MKDIR_P) $(DESTDIR)$(sysconfdir)/opencryptoki || true
test -f $(DESTDIR)$(sysconfdir)/opencryptoki/opencryptoki.conf || $(INSTALL) -m 644 $(srcdir)/usr/sbin/pkcsslotd/opencryptoki.conf $(DESTDIR)$(sysconfdir)/opencryptoki/opencryptoki.conf || true
test -f $(DESTDIR)$(sysconfdir)/opencryptoki/strength.conf || $(INSTALL) -m 640 -o root -g $(pkcs_group) -T $(srcdir)/doc/strength-example.conf $(DESTDIR)$(sysconfdir)/opencryptoki/strength.conf || true
endif
if !AIX
$(MKDIR_P) $(DESTDIR)/etc/ld.so.conf.d
echo "$(libdir)/opencryptoki" >\
$(DESTDIR)/etc/ld.so.conf.d/opencryptoki-$(target_cpu).conf
echo "$(libdir)/opencryptoki/stdll" >>\
$(DESTDIR)/etc/ld.so.conf.d/opencryptoki-$(target_cpu).conf
@echo "--------------------------------------------------------------"
@echo "Remember you must run ldconfig before using the above settings"
@echo "--------------------------------------------------------------"
endif
$(MKDIR_P) $(DESTDIR)$(lockdir) $(DESTDIR)$(logdir)
$(CHGRP) $(pkcs_group) $(DESTDIR)$(lockdir) $(DESTDIR)$(logdir)
$(CHMOD) 0770 $(DESTDIR)$(lockdir) $(DESTDIR)$(logdir)
uninstall-hook:
if ENABLE_LIBRARY
if test -d $(DESTDIR)$(libdir)/opencryptoki/stdll; then \
cd $(DESTDIR)$(libdir)/opencryptoki && \
rm -f PKCS11_API.$(SHLIBEXT) && \
rm -f methods; fi
if test -d $(DESTDIR)$(libdir)/pkcs11; then \
cd $(DESTDIR)$(libdir)/pkcs11 && \
rm -f methods && \
rm -f PKCS11_API.$(SHLIBEXT) && \
rm -f libopencryptoki.$(SHLIBEXT) && \
rm -f stdll; fi
endif
if ENABLE_CCATOK
if test -d $(DESTDIR)/$(libdir)/opencryptoki/stdll; then \
cd $(DESTDIR)/$(libdir)/opencryptoki/stdll && \
rm -f PKCS11_CCA.$(SHLIBEXT); fi
rm -f $(DESTDIR)$(sysconfdir)/opencryptoki/ccatok.conf
endif
if ENABLE_EP11TOK
if test -d $(DESTDIR)$(libdir)/opencryptoki/stdll; then \
cd $(DESTDIR)$(libdir)/opencryptoki/stdll && \
rm -f PKCS11_EP11.$(SHLIBEXT); fi
rm -f $(DESTDIR)$(sysconfdir)/opencryptoki/ep11tok.conf
rm -f $(DESTDIR)$(sysconfdir)/opencryptoki/ep11cpfilter.conf
endif
if ENABLE_ICATOK
if test -d $(DESTDIR)$(libdir)/opencryptoki/stdll; then \
cd $(DESTDIR)$(libdir)/opencryptoki/stdll && \
rm -f PKCS11_ICA.$(SHLIBEXT); fi
endif
if ENABLE_SWTOK
if test -d $(DESTDIR)$(libdir)/opencryptoki/stdll; then \
cd $(DESTDIR)$(libdir)/opencryptoki/stdll && \
rm -f PKCS11_SW.$(SHLIBEXT); fi
endif
if ENABLE_TPMTOK
if test -d $(DESTDIR)$(libdir)/opencryptoki/stdll; then \
cd $(DESTDIR)$(libdir)/opencryptoki/stdll && \
rm -rf PKCS11_TPM.$(SHLIBEXT); fi
endif
if !AIX
rm -f $(DESTDIR)/etc/ld.so.conf.d/opencryptoki-$(target_cpu).conf
endif
if ENABLE_ICSFTOK
if test -d $(DESTDIR)$(libdir)/opencryptoki/stdll; then \
cd $(DESTDIR)$(libdir)/opencryptoki/stdll && \
rm -rf PKCS11_ICSF.$(SHLIBEXT); fi
endif
if ENABLE_DAEMON
if ENABLE_SYSTEMD
if test -e $(DESTDIR)/usr/lib/tmpfiles.d/opencryptoki.conf; then \
rm -f $(DESTDIR)/usr/lib/tmpfiles.d/opencryptoki.conf; fi
endif
endif
if ENABLE_P11SAK
rm -f $(DESTDIR)$(sysconfdir)/opencryptoki/p11sak_defined_attrs.conf || true
endif
rm -f $(DESTDIR)$(sysconfdir)/opencryptoki/opencryptoki.conf || true
rm -f $(DESTDIR)$(sysconfdir)/opencryptoki/strength.conf || true
if ENABLE_TESTCASES
PKCS11_SO_PIN ?= 76543210
PKCS11_USER_PIN ?= 01234567
PKCS11_VHSM_PIN ?= 1234567890
if AIX
PKCSLIB = '@libdir@/opencryptoki/libopencryptoki.a(libopencryptoki.so.0)'
else
PKCSLIB ?= @libdir@/opencryptoki/libopencryptoki.so
endif
ci-prepare:
$(KILLALL) -HUP pkcsslotd || true
${srcdir}/testcases/ciconfig.sh "$(sysconfdir)/opencryptoki" "$(sysconfdir)/opencryptoki" "$(sysconfdir)/opencryptoki" "${srcdir}/testcases/test_combined_extract.slots"
@sbindir@/pkcsslotd
@sbindir@/pkcsstats --reset-all
for slot in `awk '/^slot (.*)/ { print $$2; }' $(sysconfdir)/opencryptoki/opencryptoki.conf`; do @sbindir@/pkcsconf -c $$slot -t | grep "Flags:" | grep -q TOKEN_INITIALIZED || PKCS11_USER_PIN=$(PKCS11_USER_PIN) PKCS11_SO_PIN=$(PKCS11_SO_PIN) PKCSLIB=$(PKCSLIB) ${srcdir}/testcases/init_token.sh $$slot; done
# cd ${srcdir}/testcases && PKCS11_USER_PIN=$(PKCS11_USER_PIN) PKCS11_VHSM_PIN=$(PKCS11_VHSM_PIN) PKCSLIB=$(PKCSLIB) ./init_vhsm.exp 42
# echo "VHSM_MODE" >> "$(sysconfdir)/opencryptoki/ep11tok42.conf"
installcheck-local: all check
$(KILLALL) -HUP pkcsslotd || true
@sbindir@/pkcsslotd
if test ! -z ${PKCS11_TEST_USER}; then \
chmod 777 ${srcdir}/testcases && \
cd ${srcdir}/testcases && \
su ${PKCS11_TEST_USER} -s /bin/bash -c "PKCS11_SO_PIN=$(PKCS11_SO_PIN) PKCS11_USER_PIN=$(PKCS11_USER_PIN) PKCSLIB=$(PKCSLIB) /bin/bash ./ock_tests.sh || true"; \
else \
cd ${srcdir}/testcases && \
PKCS11_SO_PIN=$(PKCS11_SO_PIN) PKCS11_USER_PIN=$(PKCS11_USER_PIN) PKCSLIB=$(PKCSLIB) ./ock_tests.sh || true; \
fi
$(KILLALL) -HUP pkcsslotd
ci-installcheck: ci-prepare installcheck
$(KILLALL) -HUP pkcsslotd || true
@sbindir@/pkcsslotd
cd ${srcdir}/testcases \
&& export PKCSLIB=$(PKCSLIB) \
&& export PKCS11_USER_PIN=$(PKCS11_USER_PIN) \
&& export PKCS11_SO_PIN=$(PKCS11_SO_PIN) \
&& SBINDIR=@sbindir@ ./misc_tests/p11sak_test.sh | tee log-p11sak.txt \
&& SBINDIR=@sbindir@ ./misc_tests/pkcsconf_test.sh | tee log-pkcsconf.txt
@sbindir@/pkcsstats --all
$(KILLALL) -HUP pkcsslotd
rm ${srcdir}/testcases/test_combined_extract.slots -f
@echo "done"
ci-cleanup:
@sbindir@/pkcsstats --delete-all || true
$(KILLALL) -HUP pkcsslotd || true
# @sbindir@/pkcsslotd
# cd ${srcdir}/testcases && PKCS11_USER_PIN=$(PKCS11_USER_PIN) PKCSLIB=$(PKCLSIB) ./cleanup_vhsm.exp 42
# $(KILLALL) -HUP pkcsslotd
rm ${srcdir}/testcases/test_combined_extract.slots -f
ci-uninstall: uninstall
rm -f $(sysconfdir)/opencryptoki/ep11tok*.conf
rm -rf $(localstatedir)/lib/opencryptoki/*
rm -rf $(lockdir)/*
rm -rf $(logdir)/*
.PHONY: ci-prepare ci-installcheck ci-uninstall
endif