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
|
From 4cf41d367e3248fecee7620501d12449c374c055 Mon Sep 17 00:00:00 2001
From: Alon Bar-Lev <alon.barlev@gmail.com>
Date: Tue, 6 Dec 2016 09:38:06 +0200
Subject: [PATCH] build: -lcrypto is required for tspi
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
---
configure.ac | 13 +++++++++----
lib/Makefile.am | 2 +-
src/cmds/Makefile.am | 2 +-
src/data_mgmt/Makefile.am | 2 +-
src/tpm_mgmt/Makefile.am | 2 +-
5 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/configure.ac b/configure.ac
index 279954a..99f9c4b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -90,14 +90,22 @@ AC_ARG_WITH(openssl,
AC_MSG_ERROR([$OPENSSL_INCLUDE_DIR or $OPENSSL_LIB_DIR doen't exist!])
else
AC_MSG_RESULT([yes])
- CFLAGS="$CFLAGS -L$OPENSSL_LIB_DIR -I$OPENSSL_INCLUDE_DIR"
+ CFLAGS="$CFLAGS -I$OPENSSL_INCLUDE_DIR"
+ LDFLAGS="$LDFLAGS -L$OPENSSL_LIB_DIR"
AC_SUBST([OPENSSL_LIB_DIR])
fi],
[AC_MSG_RESULT([no])
AC_SUBST([OPENSSL_LIB_DIR], []) ] )
+AC_CHECK_LIB(crypto, PEM_read_X509, [OPENSSL_LIB="1"], [AC_MSG_ERROR([openssl lib not found: libcrypto.so])])
+AC_CHECK_HEADER(openssl/evp.h, [OPENSSL_INC="1"], [AC_MSG_ERROR([openssl header not found: openssl/evp.h])])
+
+OLD_LIBS="$LIBS"
+LIBS="$LIBS -lcrypto"
AC_CHECK_LIB(tspi, Tspi_Context_Create, [TSS_LIB="1"], [AC_MSG_ERROR([tss lib not found: libtspi.so])])
AC_CHECK_LIB(tspi, Tspi_TPM_SetOperatorAuth, [TSS_12="1"], [TSS_12="0"])
+AC_SUBST([TSPI_LIBS], ["-ltspi -lcrypto"])
+LIBS="$OLD_LIBS"
if test "$TSS_12" = "1"; then
AM_CONDITIONAL(TSS_LIB_IS_12, true)
AC_MSG_NOTICE([Configuring tpm-tools for TSS 1.2])
@@ -107,9 +115,6 @@ else
fi
AC_CHECK_HEADER(trousers/tss.h, [TSS_INC="1"], [AC_MSG_ERROR([tss header not found: trousers/tss.h])])
-AC_CHECK_LIB(crypto, PEM_read_X509, [OPENSSL_LIB="1"], [AC_MSG_ERROR([openssl lib not found: libcrypto.so])])
-AC_CHECK_HEADER(openssl/evp.h, [OPENSSL_INC="1"], [AC_MSG_ERROR([openssl header not found: openssl/evp.h])])
-
OPENCRYPTOKI="0"
AC_ARG_ENABLE(pkcs11_support,
AC_HELP_STRING([--disable-pkcs11-support], [don't build data_mgmt commands [[default=no]]]),
diff --git a/lib/Makefile.am b/lib/Makefile.am
index c1d7009..af9bc49 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -80,4 +80,4 @@ endif
# Unseal library - for addition to existing apps, counter part of seal cmd
libtpm_unseal_la_SOURCES = tpm_unseal.c
libtpm_unseal_la_LDFLAGS = -shared -version-info 1:0:0
-libtpm_unseal_la_LIBADD = -ltspi libtpm_tspi.la @INTLLIBS@
+libtpm_unseal_la_LIBADD = libtpm_tspi.la -lcrypto @TSPI_LIBS@ @INTLLIBS@
diff --git a/src/cmds/Makefile.am b/src/cmds/Makefile.am
index 27fc9ef..d7508bf 100644
--- a/src/cmds/Makefile.am
+++ b/src/cmds/Makefile.am
@@ -30,7 +30,7 @@ else
AM_CPPFLAGS = -I$(top_srcdir)/include -D_LINUX
endif
-LDADD = $(top_builddir)/lib/libtpm_tspi.la -ltspi $(top_builddir)/lib/libtpm_unseal.la -ltpm_unseal -lcrypto @INTLLIBS@
+LDADD = $(top_builddir)/lib/libtpm_tspi.la $(top_builddir)/lib/libtpm_unseal.la -ltpm_unseal -lcrypto @TSPI_LIBS@ @INTLLIBS@
tpm_sealdata_SOURCES = tpm_sealdata.c
tpm_unsealdata_SOURCES = tpm_unsealdata.c
diff --git a/src/data_mgmt/Makefile.am b/src/data_mgmt/Makefile.am
index de505e4..765a2fa 100644
--- a/src/data_mgmt/Makefile.am
+++ b/src/data_mgmt/Makefile.am
@@ -38,7 +38,7 @@ noinst_HEADERS = data_common.h \
# Common build flags
AM_CPPFLAGS = -I$(top_srcdir)/include -D_LINUX
-LDADD = $(top_builddir)/lib/libtpm_pkcs11.la -ltspi -ldl @INTLLIBS@
+LDADD = $(top_builddir)/lib/libtpm_pkcs11.la @TSPI_LIBS@ -ldl @INTLLIBS@
#
diff --git a/src/tpm_mgmt/Makefile.am b/src/tpm_mgmt/Makefile.am
index 7ca47c9..6205b64 100644
--- a/src/tpm_mgmt/Makefile.am
+++ b/src/tpm_mgmt/Makefile.am
@@ -55,7 +55,7 @@ else
AM_CPPFLAGS = -I$(top_srcdir)/include -D_LINUX
endif
-LDADD = $(top_builddir)/lib/libtpm_tspi.la -ltspi @INTLLIBS@
+LDADD = $(top_builddir)/lib/libtpm_tspi.la @TSPI_LIBS@ @INTLLIBS@
tpm_startup_SOURCES = tpm_startup.c
tpm_reset_SOURCES = tpm_reset.c
--
2.7.3
|