-
Notifications
You must be signed in to change notification settings - Fork 100
/
Makefile.am
226 lines (198 loc) · 8.23 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
#;*****************************************************************************;
# Copyright (c) 2018 Fraunhofer SIT sponsored by Infineon Technologies AG
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# 3. Neither the name of tpm2-tss-engine nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
# THE POSSIBILITY OF SUCH DAMAGE.
#;*****************************************************************************;
### Initialize global variables used throughout the file ###
INCLUDE_DIRS = -I$(srcdir)/include -I$(srcdir)/src
ACLOCAL_AMFLAGS = -I m4 --install
AM_CFLAGS = $(INCLUDE_DIRS) $(EXTRA_CFLAGS) $(TSS2_ESYS_CFLAGS) \
$(TSS2_MU_CFLAGS) $(TSS2_TCTILDR_CFLAGS) $(CRYPTO_CFLAGS) \
$(CODE_COVERAGE_CFLAGS)
AM_LDFLAGS = $(EXTRA_LDFLAGS) $(CODE_COVERAGE_LIBS)
AM_LDADD = $(TSS2_ESYS_LIBS) $(TSS2_MU_LIBS) $(TSS2_TCTILDR_LIBS) \
$(CRYPTO_LIBS)
AM_DISTCHECK_CONFIGURE_FLAGS = --with-enginesdir= --with-completionsdir= \
--enable-unit
# Initialize empty variables to be extended throughout
EXTRA_DIST =
CLEANFILES =
bin_PROGRAMS =
### Add ax_* rules ###
# ax_code_coverage
if AUTOCONF_CODE_COVERAGE_2019_01_06
include $(top_srcdir)/aminclude_static.am
clean-local: code-coverage-clean
distclean-local: code-coverage-dist-clean
else
@CODE_COVERAGE_RULES@
endif
# ax_valgrind_check
@VALGRIND_CHECK_RULES@
### OpenSSL Engine ###
openssl_enginedir = $(ENGINESDIR)
openssl_engine_LTLIBRARIES = libtpm2tss.la
include_HEADERS = include/tpm2-tss-engine.h
libtpm2tss_la_SOURCES = src/tpm2-tss-engine.c \
src/tpm2-tss-engine-common.c \
src/tpm2-tss-engine-common.h \
src/tpm2-tss-engine-digest-sign.c \
src/tpm2-tss-engine-err.c \
src/tpm2-tss-engine-err.h \
src/tpm2-tss-engine-ecc.c \
src/tpm2-tss-engine-rand.c \
src/tpm2-tss-engine-rsa.c
libtpm2tss_la_CFLAGS = $(AM_CFLAGS)
libtpm2tss_la_LIBADD = $(AM_LDADD)
libtpm2tss_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined -avoid-version \
-export-symbols-regex '(tpm2tss*|bind_engine|v_check)'
install-exec-local:
([ -e $(DESTDIR)$(openssl_enginedir) ] || \
$(MKDIR_P) $(DESTDIR)$(openssl_enginedir))
# Due to confusions with OpenSSL Naming conventions for engines regarding the
# lib* prefix, we will create a symlink for the engine on install
# see https://github.com/tpm2-software/tpm2-tss-engine/issues/6#issuecomment-422489744
# see https://github.com/openssl/openssl/commit/9ee0ed3de66678a15db126d10b3e4226e835b8f5
install-exec-hook:
(cd $(DESTDIR)$(openssl_enginedir) && \
$(LN_S) -f libtpm2tss.so tpm2tss.so)
uninstall-hook:
(cd $(DESTDIR)$(openssl_enginedir) && \
[ -L tpm2tss.so ] && rm -f tpm2tss.so)
### KeyGenerator ###
bin_PROGRAMS += tpm2tss-genkey
tpm2tss_genkey_SOURCES = src/tpm2tss-genkey.c
tpm2tss_genkey_CFLAGS = $(AM_CFLAGS)
tpm2tss_genkey_LDADD = $(AM_LDADD) libtpm2tss.la
tpm2tss_genkey_LDFLAGS = $(AM_LDFLAGS)
### Tests ###
TESTS = $(TESTS_INTEGRATION) $(TESTS_UNIT)
check_PROGRAMS = $(TESTS_UNIT)
TESTS_UNIT =
TESTS_INTEGRATION =
if INTEGRATION
TESTS_INTEGRATION += $(TESTS_SHELL)
endif #INTEGRATION
TESTS_SHELL = test/ecdsa.sh \
test/ecdsa-emptyauth.sh \
test/ecdsa-handle-flush.sh \
test/rand.sh \
test/rsadecrypt.sh \
test/rsasign.sh \
test/failload.sh \
test/failwrite.sh \
test/rsasign_importtpm.sh \
test/rsasign_importtpmparent.sh \
test/rsasign_parent.sh \
test/rsasign_parent_pass.sh \
test/rsasign_persistent.sh \
test/rsasign_persistent_emptyauth.sh \
test/sserver.sh \
test/sclient.sh
if HAVE_OPENSSL_ECDH
TESTS_SHELL += test/ecdh.sh
endif
if HAVE_OPENSSL_DIGEST_SIGN
TESTS_SHELL += test/ecdsa-restricted.sh \
test/rsasign_restricted.sh
endif
EXTRA_DIST += $(TESTS_SHELL) test/neg-handle.pem
TEST_EXTENSIONS = .sh
SH_LOG_COMPILER = $(srcdir)/test/sh_log_compiler.sh
SH_LOG_FLAGS = $(INTEGRATION_ARGS)
EXTRA_DIST += $(SH_LOG_COMPILER)
if UNIT
TESTS_UNIT += test/error_tpm2-tss-engine-common test/tpm2-tss-engine-common
test_error_tpm2_tss_engine_common_CFLAGS = $(AM_CFLAGS) $(CMOCKA_CFLAGS)
test_error_tpm2_tss_engine_common_LDADD = $(AM_LDADD) $(CMOCKA_LIBS)
test_error_tpm2_tss_engine_common_LDFLAGS = $(AM_LDFLAGS) -Wl,--wrap=Esys_Initialize
test_error_tpm2_tss_engine_common_SOURCES = test/error_tpm2-tss-engine-common.c \
$(libtpm2tss_la_SOURCES)
test_tpm2_tss_engine_common_CFLAGS = $(AM_CFLAGS) $(CMOCKA_CFLAGS) \
-DNEG_HANDLE_PEM=\"$(top_srcdir)/test/neg-handle.pem\"
test_tpm2_tss_engine_common_LDADD = $(AM_LDADD) $(CMOCKA_LIBS)
test_tpm2_tss_engine_common_LDFLAGS = $(AM_LDFLAGS)
test_tpm2_tss_engine_common_SOURCES = test/tpm2-tss-engine-common.c \
$(libtpm2tss_la_SOURCES)
endif #UNIT
# Adding user and developer information
EXTRA_DIST += \
CHANGELOG.md \
CONTRIBUTING.md \
INSTALL.md \
LICENSE \
README.md \
VERSION
# Generate the AUTHORS file from git log
AUTHORS:
$(AM_V_GEN)git log --format='%aN <%aE>' | \
grep -v 'users.noreply.github.com' | sort -u > $@
EXTRA_DIST += AUTHORS
CLEANFILES += AUTHORS
if HAVE_MAN_PAGES
### Man Pages
dist_man_MANS = \
man/man1/tpm2tss-genkey.1 \
man/man3/tpm2tss_tpm2data_write.3 \
man/man3/tpm2tss_rsa_makekey.3 \
man/man3/tpm2tss_rsa_genkey.3 \
man/man3/tpm2tss_ecc_makekey.3 \
man/man3/tpm2tss_ecc_genkey.3 \
man/man3/tpm2tss_ecc_getappdata.3 \
man/man3/tpm2tss_tpm2data_read.3 \
man/man3/tpm2tss_ecc_setappdata.3
endif
if !HAVE_PANDOC
# If pandoc is not enabled, we want to complain that you need pandoc for make dist,
# so hook the target and complain.
dist-hook:
@(>&2 echo "You do not have pandoc, a requirement for the distribution of manpages")
@exit 1
endif
man/man3/tpm2tss_tpm2data_read.3: man/man3/tpm2tss_tpm2data_write.3
$(AM_V_GEN)(rm $@ 2>/dev/null || true) && ln -s tpm2tss_tpm2data_write.3 $@
man/man3/tpm2tss_ecc_setappdata.3: man/man3/tpm2tss_ecc_getappdata.3
$(AM_V_GEN)(rm $@ 2>/dev/null || true) && ln -s tpm2tss_ecc_getappdata.3 $@
man/man1/%.1: man/%.1.md
$(AM_V_GEN)mkdir -p man/man1 && cat $< | $(PANDOC) -s -t man >$@
man/man3/%.3: man/%.3.md
$(AM_V_GEN)mkdir -p man/man3 && cat $< | $(PANDOC) -s -t man >$@
EXTRA_DIST += \
man/tpm2tss-genkey.1.md \
man/tpm2tss_tpm2data_write.3.md \
man/tpm2tss_rsa_makekey.3.md \
man/tpm2tss_rsa_genkey.3.md \
man/tpm2tss_ecc_makekey.3.md \
man/tpm2tss_ecc_genkey.3.md \
man/tpm2tss_ecc_getappdata.3.md
CLEANFILES += \
$(dist_man_MANS)
### Bash Completion
bash_completiondir = $(completionsdir)
bash_completion_DATA = bash-completion/tpm2tss-genkey
EXTRA_DIST += bash-completion/tpm2tss-genkey