Skip to content

Commit

Permalink
build: Link against the libtpm2sapi library.
Browse files Browse the repository at this point in the history
This commit resolves tpm2-software#7. The include statements in the code have been
fixed up to use the installed headers as well. The bootstrap script
has been updated as well so that it no longer sets up the build in the
TSS source repo. The tools build also no longer builds the static TSS
library.

We still some very brittle dependencies on the sources in the
TPM2.0-TSS source tree but at least now we don't have to do a full
build in the TPM2.0-TSS source tree to link against the libtpm2.a
static library. We do however still build a number of the convenience /
common source files from the tss tree and link those in.

Signed-off-by: Philip Tricca <philip.b.tricca@intel.com>
  • Loading branch information
flihp committed Nov 19, 2015
1 parent 01926dc commit 45d8dd5
Show file tree
Hide file tree
Showing 32 changed files with 33 additions and 57 deletions.
6 changes: 1 addition & 5 deletions bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ TSS_REPO=https://github.com/01org/TPM2.0-TSS.git
TSS_TAG=1.0-alpha_0

if ! test -d TSS_DIR; then
git clone ${TSS_REPO} --branch ${TSS_TAG} ${TSS_DIR} && \
cd ${TSS_DIR} && \
./bootstrap && \
./configure && \
cd ..
git clone ${TSS_REPO} --branch ${TSS_TAG} ${TSS_DIR}
else
echo "${TSS_DIR} already exists, skipping"
fi
Expand Down
22 changes: 1 addition & 21 deletions sapi-tools/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,10 @@ SAMPLE_SRC = \
../tss/test/common/sample/TpmHash.c \
../tss/test/common/sample/TpmHmac.c \
../tss/test/common/sample/sample.h
SYSAPI_SRC = \
../tss/sysapi/include/basetypes.h \
../tss/sysapi/include/endianConv.h \
../tss/sysapi/include/implementation.h \
../tss/sysapi/include/tpm20.h \
../tss/sysapi/include/tpmb.h \
../tss/sysapi/include/tss2_common.h \
../tss/sysapi/include/tss2_sys_api_marshalUnmarshal.h \
../tss/sysapi/include/tss2_sys_api_part3.h \
../tss/sysapi/include/tss2_sysapi_util.h \
../tss/sysapi/include/tss2_sys.h \
../tss/sysapi/include/tss2_tcti.h \
../tss/sysapi/include/tss2_tcti_util.h \
../tss/sysapi/include/tss2_tpm2_types.h

TPMTOOLS_COMMON_SRC = \
../tss/test/tpmclient/tpmclient.h \
$(SAMPLE_SRC) \
$(SYSAPI_SRC) \
$(COMMON_SRC) \
common.cpp common.h

Expand All @@ -82,11 +67,6 @@ INCLUDE_DIRS = -I$(srcdir)/../tss/sysapi/include -I$(srcdir) \
AM_CFLAGS = -DSAPI_CLIENT $(INCLUDE_DIRS)
AM_CXXFLAGS = -DSAPI_CLIENT $(INCLUDE_DIRS)

LIBTPM = ../tss/sysapi/libtpm.a

$(LIBTPM):
$(MAKE) -C $(top_srcdir)/tss

noinst_PROGRAMS = tpm2_listpcrs \
tpm2_quote \
tpm2_takeownership \
Expand Down Expand Up @@ -116,7 +96,7 @@ noinst_PROGRAMS = tpm2_listpcrs \
tpm2_sign \
tpm2_unseal \
tpm2_verifysignature
LDADD = $(LIBTPM) -ltpm2tctisock
LDADD = -ltpm2sapi -ltpm2tctisock
tpm2_listpcrs_SOURCES = $(TPMTOOLS_COMMON_SRC) tpm2_listpcrs.cpp
tpm2_quote_SOURCES = $(TPMTOOLS_COMMON_SRC) tpm2_quote.cpp
tpm2_takeownership_SOURCES = $(TPMTOOLS_COMMON_SRC) tpm2_takeownership.cpp
Expand Down
4 changes: 2 additions & 2 deletions sapi-tools/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@
#include <getopt.h>


#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include "sample.h"
#include "resourcemgr.h"
#include "tpmclient.h"
#include "tss2_sysapi_util.h"
#include <tpm2sapi/tss2_sysapi_util.h>
#include <tpm2tcti/tpmsockets.h>
#include "syscontext.h"
#include "debug.h"
Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_activatecredential.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
#include <ctype.h>
#include <getopt.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include <tpm2tcti/tpmsockets.h>
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_akparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include <ctype.h>
#include <getopt.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include <tpm2tcti/tpmsockets.h>
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_certify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
#include <ctype.h>
#include <getopt.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include <tpm2tcti/tpmsockets.h>
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_create.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include <ctype.h>
#include <getopt.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include <tpm2tcti/tpmsockets.h>
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_createprimary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include <ctype.h>
#include <getopt.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include <tpm2tcti/tpmsockets.h>
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_encryptdecrypt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
#include <ctype.h>
#include <getopt.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include <tpm2tcti/tpmsockets.h>
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_evictcontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include <ctype.h>
#include <getopt.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include <tpm2tcti/tpmsockets.h>
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_getpubak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include <ctype.h>
#include <getopt.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include <tpm2tcti/tpmsockets.h>
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_getpubek.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include <ctype.h>
#include <getopt.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include <tpm2tcti/tpmsockets.h>
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_getrandom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include <getopt.h>
#include <ctype.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include <tpm2tcti/tpmsockets.h>
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include <ctype.h>
#include <getopt.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include <tpm2tcti/tpmsockets.h>
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_hmac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include <ctype.h>
#include <getopt.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include <tpm2tcti/tpmsockets.h>
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_listpcrs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include <ctype.h>
#include <getopt.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include <tpm2tcti/tpmsockets.h>
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include <ctype.h>
#include <getopt.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include <tpm2tcti/tpmsockets.h>
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_loadexternal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include <ctype.h>
#include <getopt.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include <tpm2tcti/tpmsockets.h>
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_makecredential.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include <ctype.h>
#include <getopt.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include <tpm2tcti/tpmsockets.h>
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_nvdefine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include <ctype.h>
#include <getopt.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include <tpm2tcti/tpmsockets.h>
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_nvlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include <ctype.h>
#include <getopt.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include <tpm2tcti/tpmsockets.h>
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_nvread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include <ctype.h>
#include <getopt.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include <tpm2tcti/tpmsockets.h>
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_nvrelease.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include <ctype.h>
#include <getopt.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include <tpm2tcti/tpmsockets.h>
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_nvwrite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include <ctype.h>
#include <getopt.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include <tpm2tcti/tpmsockets.h>
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_quote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
#include <getopt.h>
#include <arpa/inet.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include <tpm2tcti/tpmsockets.h>
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_readpublic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include <ctype.h>
#include <getopt.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include <tpm2tcti/tpmsockets.h>
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_rsadecrypt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include <ctype.h>
#include <getopt.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include <tpm2tcti/tpmsockets.h>
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_rsaencrypt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include <ctype.h>
#include <getopt.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include <tpm2tcti/tpmsockets.h>
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_sign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include <ctype.h>
#include <getopt.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include <tpm2tcti/tpmsockets.h>
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_takeownership.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include <ctype.h>
#include <getopt.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include <tpm2tcti/tpmsockets.h>
#include "common.h"

Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_unseal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include <ctype.h>
#include <getopt.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
//#include "sample.h"
#include <tpm2tcti/tpmsockets.h>
#include "common.h"
Expand Down
2 changes: 1 addition & 1 deletion sapi-tools/tpm2_verifysignature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include <ctype.h>
#include <getopt.h>

#include "tpm20.h"
#include <tpm2sapi/tpm20.h>
#include <tpm2tcti/tpmsockets.h>
#include "common.h"

Expand Down

0 comments on commit 45d8dd5

Please sign in to comment.