Skip to content

Commit

Permalink
build: Move TCTI code from tcti/ to src/tss2-tcti/
Browse files Browse the repository at this point in the history
Minor fixups were required to 'include' statements in a few test cases
as well as the pkgconfig files.

Signed-off-by: Philip Tricca <philip.b.tricca@intel.com>
  • Loading branch information
flihp committed Mar 15, 2018
1 parent ee73062 commit b8584ac
Show file tree
Hide file tree
Showing 21 changed files with 44 additions and 41 deletions.
10 changes: 6 additions & 4 deletions Makefile-test.am
Expand Up @@ -137,18 +137,20 @@ test_unit_util_SOURCES = test/unit/util.c
test_unit_tcti_device_CFLAGS = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS)
test_unit_tcti_device_LDADD = $(CMOCKA_LIBS) $(libtss2_mu) $(libutil)
test_unit_tcti_device_LDFLAGS = -Wl,--wrap=read -Wl,-wrap=write
test_unit_tcti_device_SOURCES = test/unit/tcti-device.c tcti/tcti_device.c log/log.h
test_unit_tcti_device_SOURCES = test/unit/tcti-device.c \
src/tss2-tcti/tcti-device.c log/log.h

test_unit_tcti_mssim_CFLAGS = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS) $(URIPARSER_CFLAGS)
test_unit_tcti_mssim_LDADD = $(CMOCKA_LIBS) $(libtss2_mu) $(URIPARSER_LIBS) $(libutil)
test_unit_tcti_mssim_LDFLAGS = -Wl,--wrap=connect,--wrap=read,--wrap=select,--wrap=write
test_unit_tcti_mssim_SOURCES = tcti/tcti-mssim.c tcti/sockets.c \
tcti/sockets.h test/unit/tcti-mssim.c
test_unit_tcti_mssim_SOURCES = src/tss2-tcti/tcti-mssim.c src/tss2-tcti/sockets.c \
src/tss2-tcti/sockets.h test/unit/tcti-mssim.c

test_unit_socket_CFLAGS = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS)
test_unit_socket_LDADD = $(CMOCKA_LIBS) $(libutil) $(libtss2_mu)
test_unit_socket_LDFLAGS = -Wl,--wrap=connect,--wrap=socket
test_unit_socket_SOURCES = test/unit/socket.c tcti/sockets.c tcti/sockets.h
test_unit_socket_SOURCES = test/unit/socket.c src/tss2-tcti/sockets.c \
src/tss2-tcti/sockets.h

test_unit_CommonPreparePrologue_CFLAGS = $(CMOCKA_CFLAGS) $(TESTS_CFLAGS)
test_unit_CommonPreparePrologue_LDFLAGS = -Wl,--unresolved-symbols=ignore-all
Expand Down
43 changes: 22 additions & 21 deletions Makefile.am
Expand Up @@ -94,7 +94,7 @@ tss2_HEADERS = \
libutil = libutil.la
noinst_LTLIBRARIES += $(libutil)
libutil_la_CFLAGS = $(AM_CFLAGS)
libutil_la_SOURCES = log/log.c log/log.h tcti/tcti.c tcti/tcti.h
libutil_la_SOURCES = log/log.c log/log.h src/tss2-tcti/tcti.c src/tss2-tcti/tcti.h

### TCG TSS Marshaling/Unmarshalling spec library ###
libtss2_mu = src/tss2-mu/libtss2-mu.la
Expand All @@ -111,32 +111,33 @@ src_tss2_mu_libtss2_mu_la_SOURCES = $(TSS2_MU_SRC)

### TCG TSS TCTI spec libraries ###
# tcti device library
libtcti_device = tcti/libtcti-device.la
libtss2_tcti_device = src/tss2-tcti/libtss2-tcti-device.la
tss2_HEADERS += $(srcdir)/include/tss2/tss2_tcti_device.h
lib_LTLIBRARIES += $(libtcti_device)
nodist_pkgconfig_DATA += lib/tcti-device.pc
EXTRA_DIST += tcti/tcti_device.map lib/tcti-device.pc.in
lib_LTLIBRARIES += $(libtss2_tcti_device)
nodist_pkgconfig_DATA += lib/tss2-tcti-device.pc
EXTRA_DIST += lib/tss2-tcti-device.map lib/tss2-tcti-device.pc.in

tcti_libtcti_device_la_CFLAGS = $(AM_CFLAGS)
src_tss2_tcti_libtss2_tcti_device_la_CFLAGS = $(AM_CFLAGS)
if HAVE_LD_VERSION_SCRIPT
tcti_libtcti_device_la_LDFLAGS = -Wl,--version-script=$(srcdir)/tcti/tcti_device.map
src_tss2_tcti_libtss2_tcti_device_la_LDFLAGS = -Wl,--version-script=$(srcdir)/lib/tss2-tcti-device.map
endif # HAVE_LD_VERSION_SCRIPT
tcti_libtcti_device_la_LIBADD = $(libtss2_mu) $(libutil)
tcti_libtcti_device_la_SOURCES = tcti/tcti_device.c
src_tss2_tcti_libtss2_tcti_device_la_LIBADD = $(libtss2_mu) $(libutil)
src_tss2_tcti_libtss2_tcti_device_la_SOURCES = src/tss2-tcti/tcti-device.c

# tcti library for microsoft simulator
libtcti_mssim = tcti/libtcti-mssim.la
libtss2_tcti_mssim = src/tss2-tcti/libtss2-tcti-mssim.la
tss2_HEADERS += $(srcdir)/include/tss2/tss2_tcti_mssim.h
lib_LTLIBRARIES += $(libtcti_mssim)
nodist_pkgconfig_DATA += lib/tcti-mssim.pc
EXTRA_DIST += lib/tcti-mssim.map lib/tcti-mssim.pc.in
lib_LTLIBRARIES += $(libtss2_tcti_mssim)
nodist_pkgconfig_DATA += lib/tss2-tcti-mssim.pc
EXTRA_DIST += lib/tss2-tcti-mssim.map lib/tss2-tcti-mssim.pc.in

tcti_libtcti_mssim_la_CFLAGS = $(AM_CFLAGS) $(URIPARSER_CFLAGS)
src_tss2_tcti_libtss2_tcti_mssim_la_CFLAGS = $(AM_CFLAGS) $(URIPARSER_CFLAGS)
if HAVE_LD_VERSION_SCRIPT
tcti_libtcti_mssim_la_LDFLAGS = -Wl,--version-script=$(srcdir)/lib/tcti-mssim.map
src_tss2_tcti_libtss2_tcti_mssim_la_LDFLAGS = -Wl,--version-script=$(srcdir)/lib/tss2-tcti-mssim.map
endif # HAVE_LD_VERSION_SCRIPT
tcti_libtcti_mssim_la_LIBADD = $(libtss2_mu) $(URIPARSER_LIBS) $(libutil)
tcti_libtcti_mssim_la_SOURCES = tcti/tcti-mssim.c tcti/sockets.c tcti/sockets.h
src_tss2_tcti_libtss2_tcti_mssim_la_LIBADD = $(libtss2_mu) $(URIPARSER_LIBS) $(libutil)
src_tss2_tcti_libtss2_tcti_mssim_la_SOURCES = src/tss2-tcti/tcti-mssim.c \
src/tss2-tcti/sockets.c src/tss2-tcti/sockets.h

### TCG TSS SAPI spec library ###
libsapi = sysapi/libsapi.la
Expand All @@ -162,15 +163,15 @@ esapi_libesapi_la_CFLAGS = $(AM_CFLAGS) -Wno-unused-variable -Wno-unused-label
-I$(srcdir)/sysapi/include -I$(srcdir)/esapi/esapi_util \
-DESYS_TCTI_DEFAULT_MODULE=$(TCTI_DEFAULT_MODULE) \
-DESYS_TCTI_DEFAULT_CONFIG=$(TCTI_DEFAULT_CONFIG)
esapi_libesapi_la_LIBADD = $(libsapi) $(libtss2_mu) $(libtcti_device) $(libtcti_mssim) $(libutil)
esapi_libesapi_la_LIBADD = $(libsapi) $(libtss2_mu) $(libtss2_tcti_device) $(libtss2_tcti_mssim) $(libutil)
esapi_libesapi_la_LDFLAGS = $(AM_LDFLAGS) -lgcrypt
esapi_libesapi_la_SOURCES = $(ESAPI_SRC)

endif #ESAPI

### Man Pages
man3_MANS = man/man3/Tss2_Tcti_Device_Init.3 man/man3/Tss2_Tcti_Mssim_Init.3
man7_MANS = man/man7/tcti-device.7 man/man7/tcti-mssim.7
man7_MANS = man/man7/tss2-tcti-device.7 man/man7/tss2-tcti-mssim.7

man/man3/%.3 : man/%.3.in $(srcdir)/man/man-postlude.troff
$(AM_V_GEN)$(call make_man,$@,$<,$(srcdir)/man/man-postlude.troff)
Expand All @@ -182,8 +183,8 @@ EXTRA_DIST += \
man/man-postlude.troff \
man/Tss2_Tcti_Device_Init.3.in \
man/Tss2_Tcti_Mssim_Init.3.in \
man/tcti-device.7.in \
man/tcti-mssim.7.in
man/tss2-tcti-device.7.in \
man/tss2-tcti-mssim.7.in

CLEANFILES += \
$(man3_MANS) \
Expand Down
7 changes: 0 additions & 7 deletions lib/tcti-mssim.pc.in

This file was deleted.

File renamed without changes.
6 changes: 3 additions & 3 deletions lib/tcti-device.pc.in → lib/tss2-tcti-device.pc.in
@@ -1,7 +1,7 @@
Name: tcti-device
Name: tss2-tcti-device
Description: TCTI library for communicating with a TPM device node.
URL: https://github.com/tpm2-software/tpm2-tss
Version: @VERSION@
Requires: marshal
Requires: tss2-mu
Cflags: -I@includedir@
Libs: -ltcti-device -L@libdir@
Libs: -ltss2-tcti-device -L@libdir@
File renamed without changes.
7 changes: 7 additions & 0 deletions lib/tss2-tcti-mssim.pc.in
@@ -0,0 +1,7 @@
Name: tss2-tcti-mssim
Description: TCTI library for communicating with the Microsoft TPM2 simulator.
URL: https://github.com/tpm2-software/tpm2-tss
Version: @VERSION@
Requires: tss2-mu
Cflags: -I@includedir@
Libs: -ltss2-tcti-mssim -L@libdir@
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/integration/main-esapi.c
Expand Up @@ -9,7 +9,7 @@
#include "esys_types.h"
#include "esys_iutil.h"
#include "tss2_tcti.h"
#include "tcti/tcti.h"
#include "tss2-tcti/tcti.h"

/** Define a proxy tcti that returns yielded on every second invocation
* thus the corresponding handling code in ESAPI can be tested.
Expand Down
2 changes: 1 addition & 1 deletion test/integration/sys-initialize.int.c
Expand Up @@ -3,7 +3,7 @@
#include "log/log.h"
#include "test.h"
#include "tpm20.h"
#include "tcti/tcti.h"
#include "tss2-tcti/tcti.h"
#include "sysapi/include/sysapi_util.h"

/**
Expand Down
2 changes: 1 addition & 1 deletion test/unit/socket.c
Expand Up @@ -32,7 +32,7 @@
#include <cmocka.h>

#include "tpm20.h"
#include "tcti/sockets.h"
#include "tss2-tcti/sockets.h"

int
__wrap_socket (
Expand Down
2 changes: 1 addition & 1 deletion test/unit/tcti-device.c
Expand Up @@ -7,7 +7,7 @@

#include "tss2_mu.h"
#include "tss2_tcti_device.h"
#include "tcti/tcti.h"
#include "tss2-tcti/tcti.h"

/**
* When passed all NULL values ensure that we get back the expected RC
Expand Down
2 changes: 1 addition & 1 deletion test/unit/tcti-mssim.c
Expand Up @@ -35,7 +35,7 @@

#include "tpm20.h"
#include "tss2_tcti_mssim.h"
#include "tcti/tcti.h"
#include "tss2-tcti/tcti.h"

/*
* This function is implemented in the socket TCTI module but not exposed
Expand Down
2 changes: 1 addition & 1 deletion test/unit/util.c
Expand Up @@ -5,7 +5,7 @@
#include <setjmp.h>
#include <cmocka.h>

#include "tcti/tcti.h"
#include "tss2-tcti/tcti.h"
#define LOGMODULE unit_util
#include "log/log.h"

Expand Down

0 comments on commit b8584ac

Please sign in to comment.