Move TPM1.2 code to src/tpm12 directory

Move all TPM1.2 code to src/tpm12 directory. Adapt the Makefile.am
to point to tpm12 directory for the TPM1.2 sources.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
This commit is contained in:
Stefan Berger 2015-12-07 19:14:30 -05:00 committed by Stefan Berger
parent 61ee460356
commit 23b958af05
85 changed files with 132 additions and 113 deletions

View File

@ -10,7 +10,7 @@ AM_CONFIG_HEADER(config.h)
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([foreign 1.6])
AM_INIT_AUTOMAKE([foreign 1.6 subdir-objects])
LIBTPMS_VER_MAJOR=`echo $PACKAGE_VERSION | awk -F. '{print $1}'`
LIBTPMS_VER_MINOR=`echo $PACKAGE_VERSION | awk -F. '{print $2}'`

View File

@ -6,149 +6,168 @@
lib_LTLIBRARIES=libtpms.la
libtpms_la_LIBADD=
#
# TPM1.2
#
libtpms_la_LDFLAGS = -Wl,--version-script=./libtpms.syms \
-version-info $(LIBTPMS_VERSION_INFO) \
-no-undefined
noinst_LTLIBRARIES = libtpms_tpm12.la
libtpms_la_CFLAGS = -include tpm_library_conf.h -I$(top_srcdir)/include/libtpms \
$(HARDENING_CFLAGS)
libtpms_la_LIBADD = libtpms_tpm12.la
libtpms_tpm12_la_LIBADD =
libtpms_tpm12_la_CFLAGS = -include tpm_library_conf.h \
-I$(top_srcdir)/include/libtpms \
$(HARDENING_CFLAGS)
#Build 1.2 TPM
libtpms_la_CFLAGS += -DTPM_V12
libtpms_tpm12_la_CFLAGS += -DTPM_V12
# build a PC Client TPM
libtpms_la_CFLAGS += -DTPM_PCCLIENT
libtpms_tpm12_la_CFLAGS += -DTPM_PCCLIENT
# upon initialization have the TPM load the volatile state
libtpms_la_CFLAGS += -DTPM_VOLATILE_LOAD
libtpms_tpm12_la_CFLAGS += -DTPM_VOLATILE_LOAD
# build the TPM enabled and activated
libtpms_la_CFLAGS += -DTPM_ENABLE_ACTIVATE
libtpms_tpm12_la_CFLAGS += -DTPM_ENABLE_ACTIVATE
# build with AES support for symmetric crypto
libtpms_la_CFLAGS += -DTPM_AES
libtpms_tpm12_la_CFLAGS += -DTPM_AES
# build with libtpms callback support
libtpms_la_CFLAGS += -DTPM_LIBTPMS_CALLBACKS
libtpms_tpm12_la_CFLAGS += -DTPM_LIBTPMS_CALLBACKS
# let the default NVRAM write to disk
libtpms_la_CFLAGS += -DTPM_NV_DISK
libtpms_tpm12_la_CFLAGS += -DTPM_NV_DISK
# build a POSIX type of TPM
libtpms_la_CFLAGS += -DTPM_POSIX
libtpms_tpm12_la_CFLAGS += -DTPM_POSIX
libtpms_la_CFLAGS += @DEBUG_DEFINES@
libtpms_tpm12_la_CFLAGS += @DEBUG_DEFINES@
CRYPTO_OBJFILES =
libtpms_la_SOURCES = \
tpm_admin.c \
tpm_audit.c \
tpm_auth.c \
tpm_cryptoh.c \
tpm_counter.c \
tpm_daa.c \
tpm_debug.c \
tpm_delegate.c \
tpm_digest.c \
tpm_error.c \
tpm_global.c \
tpm_identity.c \
tpm_init.c \
tpm_libtpms_io.c \
tpm_key.c \
tpm_library.c \
tpm_load.c \
tpm_maint.c \
tpm_memory.c \
tpm_migration.c \
tpm_nonce.c \
tpm_nvfile.c \
tpm_nvram.c \
tpm_owner.c \
tpm_pcr.c \
tpm_permanent.c \
tpm_platform.c \
tpm_process.c \
tpm_secret.c \
tpm_session.c \
tpm_sizedbuffer.c \
tpm_startup.c \
tpm_store.c \
tpm_storage.c \
tpm_ticks.c \
tpm_time.c \
tpm_tis.c \
tpm_transport.c \
tpm_ver.c \
tpm_svnrevision.c
libtpms_tpm12_la_SOURCES = \
tpm12/tpm_admin.c \
tpm12/tpm_audit.c \
tpm12/tpm_auth.c \
tpm12/tpm_cryptoh.c \
tpm12/tpm_counter.c \
tpm12/tpm_daa.c \
tpm12/tpm_debug.c \
tpm12/tpm_delegate.c \
tpm12/tpm_digest.c \
tpm12/tpm_error.c \
tpm12/tpm_global.c \
tpm12/tpm_identity.c \
tpm12/tpm_init.c \
tpm12/tpm_libtpms_io.c \
tpm12/tpm_key.c \
tpm12/tpm_load.c \
tpm12/tpm_maint.c \
tpm12/tpm_memory.c \
tpm12/tpm_migration.c \
tpm12/tpm_nonce.c \
tpm12/tpm_nvfile.c \
tpm12/tpm_nvram.c \
tpm12/tpm_owner.c \
tpm12/tpm_pcr.c \
tpm12/tpm_permanent.c \
tpm12/tpm_platform.c \
tpm12/tpm_process.c \
tpm12/tpm_secret.c \
tpm12/tpm_session.c \
tpm12/tpm_sizedbuffer.c \
tpm12/tpm_startup.c \
tpm12/tpm_store.c \
tpm12/tpm_storage.c \
tpm12/tpm_ticks.c \
tpm12/tpm_time.c \
tpm12/tpm_tis.c \
tpm12/tpm_transport.c \
tpm12/tpm_ver.c \
tpm12/tpm_svnrevision.c
noinst_HEADERS = \
tpm_admin.h \
tpm_audit.h \
tpm_auth.h \
tpm_commands.h \
tpm_constants.h \
tpm_counter.h \
tpm_crypto.h \
tpm_cryptoh.h \
tpm_daa.h \
tpm_debug.h \
tpm_delegate.h \
tpm_digest.h \
tpm_global.h \
tpm_identity.h \
tpm_init.h \
tpm_io.h \
tpm_key.h \
tpm12/tpm_admin.h \
tpm12/tpm_audit.h \
tpm12/tpm_auth.h \
tpm12/tpm_commands.h \
tpm12/tpm_constants.h \
tpm12/tpm_counter.h \
tpm12/tpm_crypto.h \
tpm12/tpm_cryptoh.h \
tpm12/tpm_daa.h \
tpm12/tpm_debug.h \
tpm12/tpm_delegate.h \
tpm12/tpm_digest.h \
tpm12/tpm_global.h \
tpm12/tpm_identity.h \
tpm12/tpm_init.h \
tpm12/tpm_io.h \
tpm12/tpm_key.h \
tpm_library_conf.h \
tpm_library_intern.h \
tpm_load.h \
tpm_maint.h \
tpm_migration.h \
tpm_nonce.h \
tpm_nvfile.h \
tpm_nvram_const.h \
tpm_nvram.h \
tpm_owner.h \
tpm_pcr.h \
tpm_permanent.h \
tpm_platform.h \
tpm_process.h \
tpm_secret.h \
tpm_session.h \
tpm_sizedbuffer.h \
tpm_startup.h \
tpm_storage.h \
tpm_store.h \
tpm_structures.h \
tpm_svnrevision.h \
tpm_ticks.h \
tpm_time.h \
tpm_transport.h \
tpm_ver.h
tpm12/tpm_load.h \
tpm12/tpm_maint.h \
tpm12/tpm_migration.h \
tpm12/tpm_nonce.h \
tpm12/tpm_nvfile.h \
tpm12/tpm_nvram_const.h \
tpm12/tpm_nvram.h \
tpm12/tpm_owner.h \
tpm12/tpm_pcr.h \
tpm12/tpm_permanent.h \
tpm12/tpm_platform.h \
tpm12/tpm_process.h \
tpm12/tpm_secret.h \
tpm12/tpm_session.h \
tpm12/tpm_sizedbuffer.h \
tpm12/tpm_startup.h \
tpm12/tpm_storage.h \
tpm12/tpm_store.h \
tpm12/tpm_structures.h \
tpm12/tpm_svnrevision.h \
tpm12/tpm_ticks.h \
tpm12/tpm_time.h \
tpm12/tpm_transport.h \
tpm12/tpm_ver.h
if LIBTPMS_USE_FREEBL
libtpms_la_SOURCES += tpm_crypto_freebl.c
libtpms_la_LIBADD += -lfreebl -lgmp -lnspr4 -lnssutil3 -lnss3
libtpms_tpm12_la_SOURCES += tpm12/tpm_crypto_freebl.c
libtpms_tpm12_la_LIBADD += -lfreebl -lgmp -lnspr4 -lnssutil3 -lnss3
#work-around broken freebl includes
libtpms_la_CFLAGS += $(shell [ ! -r /usr/include/nss3/alghmac.h ] && \
libtpms_tpm12_la_CFLAGS += $(shell [ ! -r /usr/include/nss3/alghmac.h ] && \
touch alghmac.h && \
echo -I./)
# tpm_crypto_freebl.c: work around #include "blapi.h" : should be <nss3/blapi.h>
libtpms_la_CFLAGS += $(shell nss-config --cflags)
# tpm12/tpm_crypto_freebl.c: work around #include "blapi.h" : should be <nss3/blapi.h>
libtpms_tpm12_la_CFLAGS += $(shell nss-config --cflags)
#including nss3/blapi.h requires a look into nspr4 dir
libtpms_la_CFLAGS += $(shell nspr-config --cflags)
libtpms_tpm12_la_CFLAGS += $(shell nspr-config --cflags)
else
if LIBTPMS_USE_OPENSSL
libtpms_la_SOURCES += tpm_crypto.c
libtpms_la_LIBADD += -lcrypto
libtpms_tpm12_la_SOURCES += tpm12/tpm_crypto.c
libtpms_tpm12_la_LIBADD += -lcrypto
endif # LIBTPMS_USE_OPENSSL
endif # LIBTPMS_USE_FREEBL
#
# Library API layer
#
libtpms_la_SOURCES = \
tpm_library.c
libtpms_la_CFLAGS = \
$(libtpms_tpm12_la_CFLAGS)
libtpms_la_LDFLAGS = -Wl,--version-script=./libtpms.syms \
-version-info $(LIBTPMS_VERSION_INFO) \
-no-undefined
LDFLAGS_ARCH = $(findstring -m32, $(CFLAGS))
LDFLAGS_ARCH += $(findstring -m64, $(CFLAGS))
LDFLAGS_ARCH += $(findstring -m32, $(LDFLAGS))
@ -161,6 +180,6 @@ check-local:
@$(CC) $(LDFLAGS_ARCH) -nostdlib -L./.libs -ltpms 2>/dev/null
EXTRA_DIST = \
tpm_crypto_freebl.c \
tpm_crypto.c \
tpm12/tpm_crypto_freebl.c \
tpm12/tpm_crypto.c \
libtpms.syms

View File

@ -54,15 +54,15 @@
# include <openssl/evp.h>
#endif
#include "tpm_debug.h"
#include "tpm12/tpm_debug.h"
#include "tpm_error.h"
#include "tpm_init.h"
#include "tpm12/tpm_init.h"
#include "tpm_library.h"
#include "tpm_library_intern.h"
#include "tpm_key.h"
#include "tpm12/tpm_key.h"
#include "tpm_memory.h"
#include "tpm_process.h"
#include "tpm_startup.h"
#include "tpm12/tpm_process.h"
#include "tpm12/tpm_startup.h"
#define ROUNDUP(VAL, SIZE) \
( ( (VAL) + (SIZE) - 1 ) / (SIZE) ) * (SIZE)