# For the license, see the LICENSE file in the root directory.
#
+AM_CFLAGS = @AM_CFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@ $(HARDENING_LDFLAGS) $(SANITIZERS) $(FUZZER)
+
lib_LTLIBRARIES=libtpms.la
common_CFLAGS = -include tpm_library_conf.h \
-I$(top_srcdir)/include/libtpms \
- $(HARDENING_CFLAGS)
+ -I$(top_builddir)/include/libtpms \
+ $(AM_CFLAGS) \
+ $(HARDENING_CFLAGS) \
+ $(SANITIZERS) \
+ $(FUZZER)
+
+# build with libtpms callback support
+common_CFLAGS += -DTPM_LIBTPMS_CALLBACKS
+# let the default NVRAM write to disk
+common_CFLAGS += -DTPM_NV_DISK
#
# TPM1.2
libtpms_tpm12_la_CFLAGS += -DTPM_ENABLE_ACTIVATE
# build with AES support for symmetric crypto
libtpms_tpm12_la_CFLAGS += -DTPM_AES
-# build with libtpms callback support
-libtpms_tpm12_la_CFLAGS += -DTPM_LIBTPMS_CALLBACKS
-# let the default NVRAM write to disk
-libtpms_tpm12_la_CFLAGS += -DTPM_NV_DISK
# build a POSIX type of TPM
libtpms_tpm12_la_CFLAGS += -DTPM_POSIX
+# build without maintenance commands
+libtpms_tpm12_la_CFLAGS += -DTPM_NOMAINTENANCE_COMMANDS
libtpms_tpm12_la_CFLAGS += @DEBUG_DEFINES@
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_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_openssl_helpers.c \
tpm12/tpm_owner.c \
tpm12/tpm_pcr.c \
tpm12/tpm_permanent.c \
tpm12/tpm_crypto.h \
tpm12/tpm_cryptoh.h \
tpm12/tpm_daa.h \
- tpm12/tpm_debug.h \
+ tpm_debug.h \
tpm12/tpm_delegate.h \
tpm12/tpm_digest.h \
tpm12/tpm_global.h \
tpm12/tpm_maint.h \
tpm12/tpm_migration.h \
tpm12/tpm_nonce.h \
- tpm12/tpm_nvfile.h \
+ tpm_nvfile.h \
tpm12/tpm_nvram_const.h \
tpm12/tpm_nvram.h \
+ tpm12/tpm_openssl_helpers.h \
tpm12/tpm_owner.h \
tpm12/tpm_pcr.h \
tpm12/tpm_permanent.h \
tpm12/tpm_time.h \
tpm12/tpm_transport.h \
tpm12/tpm_ver.h
-
if LIBTPMS_USE_FREEBL
libtpms_la_LIBADD += libtpms_tpm2.la
-libtpms_tpm2_la_LIBADD =
-
-libtpms_tpm2_la_LDFLAGS = -Wl,--version-script=./libtpms.syms \
- -version-info $(LIBTPMS_VERSION_INFO) \
- -no-undefined
+libtpms_tpm2_la_LIBADD = $(LIBRT_LIBS)
-libtpms_tpm2_la_CFLAGS = $(common_CFLAGS) \
- -Wstrict-aliasing=3
+libtpms_tpm2_la_CFLAGS = $(common_CFLAGS)
libtpms_tpm2_la_CFLAGS += -D_POSIX_
libtpms_tpm2_la_CFLAGS += -DTPM_POSIX
-# build with libtpms callback support
-libtpms_tpm2_la_CFLAGS += -DTPM_LIBTPMS_CALLBACKS
libtpms_tpm2_la_SOURCES = \
+ tpm2/ACT_spt.c \
+ tpm2/ACTCommands.c \
tpm2/AlgorithmCap.c \
tpm2/AlgorithmTests.c \
tpm2/AsymmetricCommands.c \
tpm2/AuditCommands.c \
tpm2/Bits.c \
tpm2/BnConvert.c \
- tpm2/BnEccData.c \
tpm2/BnMath.c \
tpm2/BnMemory.c \
tpm2/Cancel.c \
tpm2/CommandDispatcher.c \
tpm2/ContextCommands.c \
tpm2/Context_spt.c \
+ tpm2/CryptEccData.c \
tpm2/CryptSelfTest.c \
tpm2/CryptUtil.c \
tpm2/DA.c \
+ tpm2/DebugHelpers.c \
tpm2/DictionaryCommands.c \
tpm2/DuplicationCommands.c \
tpm2/EACommands.c \
tpm2/ObjectCommands.c \
tpm2/Object_spt.c \
tpm2/PCR.c \
+ tpm2/PlatformACT.c \
tpm2/PlatformData.c \
tpm2/Policy_spt.c \
tpm2/Power.c \
tpm2/TestingCommands.c \
tpm2/Ticket.c \
tpm2/Time.c \
+ tpm2/TpmAsn1.c \
tpm2/TpmSizeChecks.c \
tpm2/TPMCmdp.c \
tpm2/TpmFail.c \
tpm2/Unique.c \
tpm2/Unmarshal.c \
tpm2/Vendor_TCG_Test.c \
+ tpm2/X509_ECC.c \
+ tpm2/X509_RSA.c \
+ tpm2/X509_spt.c \
tpm_tpm2_interface.c \
tpm_tpm2_tis.c \
\
+ tpm2/BackwardsCompatibilityObject.c \
+ tpm2/LibtpmsCallbacks.c \
tpm2/NVMarshal.c \
tpm2/StateMarshal.c \
tpm2/Volatile.c
noinst_HEADERS += \
+ compiler.h \
+ tpm2/crypto/CryptCmac_fp.h \
tpm2/crypto/CryptDes_fp.h \
tpm2/crypto/CryptEcc.h \
+ tpm2/crypto/CryptEccCrypt_fp.h \
tpm2/crypto/CryptEccKeyExchange_fp.h \
tpm2/crypto/CryptEccMain_fp.h \
tpm2/crypto/CryptEccSignature_fp.h \
- tpm2/crypto/CryptHashData.h \
tpm2/crypto/CryptHash_fp.h \
tpm2/crypto/CryptHash.h \
tpm2/crypto/CryptPrime_fp.h \
tpm2/crypto/CryptRsa_fp.h \
tpm2/crypto/CryptRsa.h \
tpm2/crypto/CryptSelfTest_fp.h \
+ tpm2/crypto/CryptSmac_fp.h \
+ tpm2/crypto/CryptSym.h \
tpm2/crypto/CryptSym_fp.h \
tpm2/crypto/CryptTest.h \
tpm2/crypto/CryptUtil_fp.h \
+ tpm2/ACT.h \
+ tpm2/ACT_spt_fp.h \
+ tpm2/ACT_SetTimeout_fp.h \
tpm2/ActivateCredential_fp.h \
tpm2/AlgorithmCap_fp.h \
tpm2/AlgorithmTests_fp.h \
tpm2/Bits_fp.h \
tpm2/Capabilities.h \
tpm2/CertifyCreation_fp.h \
+ tpm2/CertifyX509_fp.h \
tpm2/Certify_fp.h \
tpm2/ChangeEPS_fp.h \
tpm2/ChangePPS_fp.h \
tpm2/CreateLoaded_fp.h \
tpm2/CreatePrimary_fp.h \
tpm2/CryptSelfTest_fp.h \
- tpm2/CryptUtil_fp.h \
tpm2/DA_fp.h \
+ tpm2/DebugHelpers_fp.h \
tpm2/DictionaryAttackLockReset_fp.h \
tpm2/DictionaryAttackParameters_fp.h \
tpm2/Duplicate_fp.h \
tpm2/EC_Ephemeral_fp.h \
tpm2/EncryptDecrypt2_fp.h \
tpm2/EncryptDecrypt_fp.h \
- tpm2/EncryptDecrypt_spt.h \
tpm2/EncryptDecrypt_spt_fp.h \
tpm2/Entity_fp.h \
tpm2/EventSequenceComplete_fp.h \
tpm2/Hierarchy_fp.h \
tpm2/HMAC_fp.h \
tpm2/HMAC_Start_fp.h \
- tpm2/Implementation.h \
tpm2/Import_fp.h \
tpm2/IncrementalSelfTest_fp.h \
tpm2/InternalRoutines.h \
tpm2/IoBuffers_fp.h \
+ tpm2/KdfTestData.h \
tpm2/LoadExternal_fp.h \
tpm2/Load_fp.h \
tpm2/Locality_fp.h \
+ tpm2/MAC_fp.h \
+ tpm2/MAC_Start_fp.h \
tpm2/MakeCredential_fp.h \
tpm2/Manufacture_fp.h \
tpm2/Marshal_fp.h \
tpm2/MathOnByteBuffers_fp.h \
tpm2/Memory_fp.h \
+ tpm2/MinMax.h \
tpm2/NV_Certify_fp.h \
tpm2/NV_ChangeAuth_fp.h \
tpm2/NV_DefineSpace_fp.h \
tpm2/NV_UndefineSpaceSpecial_fp.h \
tpm2/NV_Write_fp.h \
tpm2/NV_WriteLock_fp.h \
+ tpm2/OIDs.h \
tpm2/ObjectChangeAuth_fp.h \
tpm2/Object_fp.h \
tpm2/Object_spt_fp.h \
tpm2/PCR_Reset_fp.h \
tpm2/PCR_SetAuthPolicy_fp.h \
tpm2/PCR_SetAuthValue_fp.h \
+ tpm2/Platform.h \
+ tpm2/PlatformACT.h \
+ tpm2/PlatformACT_fp.h \
+ tpm2/PlatformClock.h \
tpm2/PlatformData.h \
tpm2/Platform_fp.h \
tpm2/PolicyAuthorize_fp.h \
tpm2/Ticket_fp.h \
tpm2/Time_fp.h \
tpm2/TPMB.h \
+ tpm2/TpmAlgorithmDefines.h \
+ tpm2/TpmAsn1.h \
+ tpm2/TpmAsn1_fp.h \
tpm2/TpmBuildSwitches.h \
tpm2/TpmError.h \
tpm2/TpmFail_fp.h \
+ tpm2/TpmProfile.h \
tpm2/Tpm.h \
tpm2/_TPM_Hash_Data_fp.h \
tpm2/_TPM_Hash_End_fp.h \
tpm2/VendorString.h \
tpm2/Vendor_TCG_Test_fp.h \
tpm2/VerifySignature_fp.h \
+ tpm2/X509.h \
+ tpm2/X509_ECC_fp.h \
+ tpm2/X509_RSA_fp.h \
+ tpm2/X509_spt_fp.h \
tpm2/ZGen_2Phase_fp.h \
\
+ tpm2/BackwardsCompatibility.h \
+ tpm2/BackwardsCompatibilityObject.h \
+ tpm2/LibtpmsCallbacks.h \
tpm2/NVMarshal.h \
tpm2/StateMarshal.h \
+ tpm2/Utils.h \
tpm2/Volatile.h
if LIBTPMS_USE_OPENSSL
libtpms_tpm2_la_SOURCES += \
+ tpm2/crypto/openssl/CryptCmac.c \
tpm2/crypto/openssl/CryptDes.c \
tpm2/crypto/openssl/CryptEccKeyExchange.c \
tpm2/crypto/openssl/CryptEccMain.c \
tpm2/crypto/openssl/CryptEccSignature.c \
tpm2/crypto/openssl/CryptHash.c \
- tpm2/crypto/openssl/CryptHashData.c \
tpm2/crypto/openssl/CryptPrime.c \
tpm2/crypto/openssl/CryptPrimeSieve.c \
tpm2/crypto/openssl/CryptRand.c \
tpm2/crypto/openssl/CryptRsa.c \
+ tpm2/crypto/openssl/CryptSmac.c \
tpm2/crypto/openssl/CryptSym.c \
+ tpm2/crypto/openssl/ExpDCache.c \
+ tpm2/crypto/openssl/Helpers.c \
tpm2/crypto/openssl/TpmToOsslDesSupport.c \
tpm2/crypto/openssl/TpmToOsslMath.c \
tpm2/crypto/openssl/TpmToOsslSupport.c
noinst_HEADERS += \
+ tpm2/crypto/openssl/ConsttimeUtils.h \
tpm2/crypto/openssl/BnConvert_fp.h \
tpm2/crypto/openssl/BnMath_fp.h \
tpm2/crypto/openssl/BnMemory_fp.h \
tpm2/crypto/openssl/BnValues.h \
+ tpm2/crypto/openssl/ExpDCache_fp.h \
+ tpm2/crypto/openssl/Helpers_fp.h \
tpm2/crypto/openssl/LibSupport.h \
tpm2/crypto/openssl/TpmToOsslDesSupport_fp.h \
tpm2/crypto/openssl/TpmToOsslHash.h \
tpm2/crypto/openssl/TpmToOsslSym.h
libtpms_tpm2_la_CFLAGS += \
- -I tpm2 \
- -I tpm2/crypto \
- -I tpm2/crypto/openssl
+ -I $(srcdir)/tpm2 \
+ -I $(srcdir)/tpm2/crypto \
+ -I $(srcdir)/tpm2/crypto/openssl
endif # LIBTPMS_USE_OPENSSL
-# some of the original TPM2 files have been modified; in case of an update
-# we do not want to loose these modifications
-check:
- n=`grep "TPM_LIBTPMS_CALLBACK" $(libtpms_tpm2_la_SOURCES) | wc -l`; \
- exp=18; \
- if test $$n -ne $$exp; then \
- echo "TPM_LIBTPMS_CALLBACK occurrence has changed to $$n from $$exp"; \
- exit 1; \
- fi; \
- n=`grep TPM_BUFFER_MAX tpm2/Implementation.h | grep -E "^#define" | wc -l`; \
- exp=2; \
- if test $$n -ne $$exp; then \
- echo "Lost patches to tpm2/Implementation.h ?"; \
- exit 1; \
- fi
-
-.PHONY: srccheck
-srccheck:
- @n=`grep -i "nuvo" $(libtpms_tpm2_la_SOURCES) | wc -l`; \
- if test $$n -ne 0; then \
- echo "Filter sources!"; \
- exit 1; \
- fi
-
-all: srccheck
-
-check_PROGRAMS = \
- tpm2_nvram_offsetchecks
-
-TESTS = tpm2_nvram_offsetchecks
-
-tpm2_nvram_offsetchecks_SOURCES = \
- tests/tpm2_nvram_offsetchecks.c
-
-tpm2_nvram_offsetchecks_CFLAGS = \
- $(libtpms_tpm2_la_CFLAGS)
-
endif # WITH_TPM2
#
#
libtpms_la_SOURCES = \
- tpm_library.c
+ tpm_debug.c \
+ tpm_library.c \
+ tpm_memory.c \
+ tpm_nvfile.c
libtpms_la_CFLAGS = $(common_CFLAGS)
-libtpms_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libtpms.syms \
- -version-info $(LIBTPMS_VERSION_INFO) \
- -no-undefined
+libtpms_la_LDFLAGS = -version-info $(LIBTPMS_VERSION_INFO) \
+ -no-undefined $(AM_LDFLAGS)
+if HAVE_VERSION_SCRIPT
+libtpms_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libtpms.syms
+endif
-LDFLAGS_ARCH = $(findstring -m32, $(CFLAGS))
-LDFLAGS_ARCH += $(findstring -m64, $(CFLAGS))
-LDFLAGS_ARCH += $(findstring -m32, $(LDFLAGS))
-LDFLAGS_ARCH += $(findstring -m64, $(LDFLAGS))
+LDFLAGS_ARCH = $(findstring -m32, $(AM_CFLAGS))
+LDFLAGS_ARCH += $(findstring -m64, $(AM_CFLAGS))
+LDFLAGS_ARCH += $(findstring -m32, $(AM_LDFLAGS))
+LDFLAGS_ARCH += $(findstring -m64, $(AM_LDFLAGS))
+check-local: SHELL?="/usr/bin/env bash"
check-local:
@case $(host_os) in \
openbsd*) ADDLIBS="-lc" ;; \
+ darwin*|freebsd*) LDFLAGS_OS="-shared" ;; \
*) ADDLIBS="" ;; \
esac; \
- ($(CC) $(LDFLAGS_ARCH) -nostdlib -L./.libs -ltpms $$ADDLIBS 2>/dev/null || \
- (echo "There are undefined symbols in libtpms ($(LDFLAGS_ARCH))";\
- $(CC) $(LDFLAGS_ARCH) -nostdlib -L./.libs -ltpms $$ADDLIBS 2>&1 | grep libtpms))
+ ($(CC) $$LDFLAGS_OS $(LDFLAGS_ARCH) -nostdlib -L./.libs -ltpms $$ADDLIBS 2>/dev/null || \
+ (echo "There are undefined symbols in libtpms ($$LDFLAGS_OS $(LDFLAGS_ARCH))";\
+ $(CC) $$LDFLAGS_OS $(LDFLAGS_ARCH) -nostdlib -L./.libs -ltpms $$ADDLIBS 2>&1 | grep libtpms))
@case $(host_os) in \
openbsd*) ADDLIBS="-lc" ;; \
+ darwin*|freebsd*) LDFLAGS_OS="-shared" ;; \
*) ADDLIBS="" ;; \
esac; \
- $(CC) $(LDFLAGS_ARCH) -nostdlib -L./.libs -ltpms $$ADDLIBS 2>/dev/null
+ $(CC) $$LDFLAGS_OS $(LDFLAGS_ARCH) -nostdlib -L./.libs -ltpms $$ADDLIBS 2>/dev/null
+ rm a.out || true
EXTRA_DIST = \
tpm12/tpm_crypto_freebl.c \
tpm12/tpm_crypto.c \
- libtpms.syms
+ libtpms.syms \
+ test.syms
+
+CLEANFILES = \
+ a.out \
+ *.gcov \
+ *.gcda \
+ *.gcno \
+ tpm12/*.gcov \
+ tpm12/*.gcda \
+ tpm12/*.gcno \
+ tpm2/*.gcov \
+ tpm2/*.gcda \
+ tpm2/*.gcno \
+ tpm2/crypto/openssl/*.gcov \
+ tpm2/crypto/openssl/*.gcda \
+ tpm2/crypto/openssl/*.gcno