Merge branch '1.x'

Conflicts:
	.gitignore
	Makefile.am
diff --git a/.gitignore b/.gitignore
index 758eaf6..44e2058 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
 *.a
 *.la
 *.lo
+*.log
 *.o
 *.opensdf
 *.pc
@@ -9,6 +10,7 @@
 *.suo
 *.ses
 *.tag
+*.trs
 *vcxproj.user
 .deps/
 .dirstamp
@@ -28,7 +30,8 @@
 install-sh
 libtool
 ltmain.sh
-m4/
+m4/libtool*
+m4/lt*.m4
 man/man[0-9]/*
 Makefile
 Makefile.in
@@ -36,6 +39,12 @@
 NVChip
 src_vars.mk
 resourcemgr/resourcemgr
+test/integration/*
+!test/integration/*.[ch]
+test/integration/get-random
+test/integration/self-test
+test/integration/pcr-extension
+test/integration/asymmetric-encrypt-decrypt
 test/tpmclient/tpmclient
 .klocwork/
 ipch/
@@ -43,10 +52,9 @@
 test-driver
 test-suite.log
 test/*_unit
-test/tcti_device
-test/!*.*
 test/*.pid
-test/*.log
-test/*.trs
 test/ibmtpm*
 test/simulator*
+# ignore all files in test/unit without a file extension
+test/unit/*
+!test/unit/*.[ch]
diff --git a/.travis.yml b/.travis.yml
index 701ce52..18bbb4e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,7 @@
 language: cpp
 compiler:
   - gcc
+  - clang
 
 # This is a lie: we don't need sudo but this is required to get an
 # Ubuntu image with a libc that isn't ancient, and with cmocka libs.
@@ -22,11 +23,11 @@
 script:
   - mkdir ./build
   - pushd ./build
-  - CONFIG_SITE=../lib/default_config.site ../configure --enable-unit
+  - ../configure --enable-unit
   - make -j$(nproc)
-  - make check
   - make simulator-build
   - make simulator-start
+  - make check
   - test/tpmclient/tpmclient
   - make simulator-stop
   - |
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 226fdf0..3b987b0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,26 @@
 
 The format is based on [Keep a Changelog](http://keepachangelog.com/)
 
+## Unreleased
+### Added
+- Library for marshaling TPM2 types: libmarshal.
+- Unit test for device TCTI bug fixes.
+### Changed
+- Converted all cpp files to c, removed dependency on C++ compiler.
+- Cleaned out a number of marshaling functions from the SAPI code. Things
+required by the resource manager were removed from libsapi and moved into
+the 'common directory.
+- README.md updated to add note about deprecation of resourcemgr code. A
+replacement has been in the works for a while but the existing code will
+remain in place until the replacement is ready.
+- Added std=gnu99 to default CONFIG_SITE.
+- Update Linux / Unix OS detection to use non-obsolete macros.
+- Move unit tests from test/ to test/unit/.
+### Fixed
+- Wrong return type for Tss2_Sys_Finalize (API break).
+- NULL dereference bug in device TCTI init function.
+- Two race conditions in the resourcemgr.
+
 ## [1.0] - 2016-11-01
 ### Added
 - Travis-CI integration with GitHub
diff --git a/INSTALL b/INSTALL
index 7253101..806e6d3 100644
--- a/INSTALL
+++ b/INSTALL
@@ -5,7 +5,6 @@
 GNU Automake
 GNU Libtool
 C compiler
-C++ compiler
 C Library Development Libraries and Header Files (for pthreads headers)
 cmocka unit test framework
 pkg-config
@@ -38,6 +37,11 @@
 alternative --prefix option at configure time, and maybe DESTDIR at install
 time if you're packaging for a distro.
 
+NOTE: It may be necessary to run ldconfig (as root) to update the run-time
+bindings before executing a program that links against libsapi or a TCTI
+library (including the resourcemgr):
+$ sudo ldconfig
+
 We now have basic VPATH support which allows us to separate the source
 directory from the build directory. This allows for a developer to do a debug
 build and a regular build from the same sources. Any changes to the source
diff --git a/Makefile.am b/Makefile.am
index 18b5c6c..798000c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -28,40 +28,55 @@
 
 include src_vars.mk
 
+INCLUDE_DIRS    = -I$(srcdir)/include -I$(srcdir)/sysapi/include
 ACLOCAL_AMFLAGS = -I m4
-AM_CFLAGS       = -I$(srcdir)/include
-AM_CXXFLAGS     = $(AM_CFLAGS)
+AM_CFLAGS       = $(INCLUDE_DIRS) $(EXTRA_CFLAGS)
+AM_LDFLAGS      = $(EXTRA_LDFLAGS)
 
 # stuff to build, what that stuff is, and where/if to install said stuff
 noinst_PROGRAMS = $(tpmclient)
-lib_LTLIBRARIES = $(libsapi) $(libtcti_device) $(libtcti_socket)
+lib_LTLIBRARIES = $(libmarshal) $(libsapi) $(libtcti_device) $(libtcti_socket)
+noinst_LTLIBRARIES = test/integration/libtest_utils.la
+check_PROGRAMS = $(TESTS_UNIT) $(TESTS_INTEGRATION)
 
 # unit tests
 if UNIT
-check_PROGRAMS  = \
-    test/tcti_device \
-    test/CommonPreparePrologue_unit \
-    test/GetNumHandles_unit \
-    test/CopyCommandHeader_unit \
-    test/marshal-UINT16_unit \
-    test/unmarshal-UINT16_unit \
-    test/marshal-UINT32_unit \
-    test/unmarshal_UINT32_unit \
-    test/marshal-TPM2B-simple_unit \
-    test/CheckOverflow_unit
+TESTS_UNIT  = \
+    test/unit/CommonPreparePrologue \
+    test/unit/CopyCommandHeader \
+    test/unit/GetNumHandles \
+    test/unit/marshal-TPM2B-simple \
+    test/unit/tcti-device \
+    test/unit/UINT8-marshal \
+    test/unit/UINT16-marshal \
+    test/unit/UINT32-marshal \
+    test/unit/UINT64-marshal
 endif #UNIT
 
+TESTS_INTEGRATION = \
+    test/integration/get-random \
+    test/integration/self-test \
+    test/integration/pcr-extension \
+    test/integration/asymmetric-encrypt-decrypt \
+    test/integration/start-auth-session
+
 TESTS = $(check_PROGRAMS)
 CLEANFILES = \
     $(nodist_pkgconfig_DATA) \
     $(man3_MANS) \
     $(man7_MANS)
 
+AM_TESTS_ENVIRONMENT = \
+    export TPM20TEST_TCTI_NAME="socket"; \
+    export TPM20TEST_SOCKET_ADDRESS="127.0.0.1"; \
+    export TPM20TEST_SOCKET_PORT="2321";
+
 # headers and where to install them
 libsapidir      = $(includedir)/sapi
 libsapi_HEADERS = $(srcdir)/include/sapi/*.h
 libtctidir      = $(includedir)/tcti
 libtcti_HEADERS = $(srcdir)/include/tcti/*.h
+
 # pkg-config files
 pkgconfigdir          = $(libdir)/pkgconfig
 nodist_pkgconfig_DATA = lib/sapi.pc lib/tcti-device.pc lib/tcti-socket.pc
@@ -75,116 +90,93 @@
     man/tcti-socket.7.in
 
 if UNIT
-test_tcti_device_CFLAGS  = $(CMOCKA_CFLAGS) -I$(srcdir)/include -I$(srcdir)/sysapi/include
-test_tcti_device_LDADD   = $(libsapi) $(libtcti_device) $(CMOCKA_LIBS)
-test_tcti_device_SOURCES = test/tcti_device.c test/tcti_device_test.c
+test_unit_tcti_device_CFLAGS  = $(CMOCKA_CFLAGS) $(AM_CFLAGS)
+test_unit_tcti_device_LDADD   = $(CMOCKA_LIBS) $(libmarshal)
+test_unit_tcti_device_LDFLAGS = -Wl,--wrap=read -Wl,-wrap=write
+test_unit_tcti_device_SOURCES = tcti/commonchecks.c tcti/tcti_device.c \
+    test/unit/tcti-device.c
 
-test_CommonPreparePrologue_unit_CFLAGS = $(CMOCKA_CFLAGS) -I$(srcdir)/include \
-    -I$(srcdir)/include/sapi -I$(srcdir)/sysapi/include/
-test_CommonPreparePrologue_unit_LDFLAGS = -Wl,--unresolved-symbols=ignore-all
-test_CommonPreparePrologue_unit_LDADD = $(CMOCKA_LIBS)
-test_CommonPreparePrologue_unit_SOURCES = \
-    test/CommonPreparePrologue_unit.c sysapi/sysapi_util/CommandUtil.c \
-    sysapi/sysapi/ContextManagement.c
+test_unit_CommonPreparePrologue_CFLAGS = $(CMOCKA_CFLAGS) $(AM_CFLAGS)
+test_unit_CommonPreparePrologue_LDFLAGS = -Wl,--unresolved-symbols=ignore-all
+test_unit_CommonPreparePrologue_LDADD = $(CMOCKA_LIBS) $(libsapi)
+test_unit_CommonPreparePrologue_SOURCES = test/unit/CommonPreparePrologue.c
 
-test_GetNumHandles_unit_CFLAGS  = $(CMOCKA_CFLAGS) \
-    -I$(srcdir)/include -I$(srcdir)/sysapi/include
-test_GetNumHandles_unit_LDADD   = $(CMOCKA_LIBS)
-test_GetNumHandles_unit_SOURCES = \
-    test/GetNumHandles_unit.c sysapi/sysapi_util/GetNumHandles.c
+test_unit_GetNumHandles_CFLAGS  = $(CMOCKA_CFLAGS) $(AM_CFLAGS)
+test_unit_GetNumHandles_LDADD   = $(CMOCKA_LIBS) $(libsapi)
+test_unit_GetNumHandles_SOURCES = test/unit/GetNumHandles.c
 
-test_CopyCommandHeader_unit_CFLAGS = $(CMOCKA_CFLAGS) -I$(srcdir)/include \
-    -I$(srcdir)/include/sapi -I$(srcdir)/sysapi/include/
-test_CopyCommandHeader_unit_LDFLAGS = -Wl,--unresolved-symbols=ignore-all
-test_CopyCommandHeader_unit_LDADD = $(CMOCKA_LIBS)
-test_CopyCommandHeader_unit_SOURCES = \
-    test/CopyCommandHeader_unit.c sysapi/sysapi_util/CommandUtil.c \
-    sysapi/sysapi/ContextManagement.c sysapi/sysapi_util/changeEndian.c
+test_unit_CopyCommandHeader_CFLAGS = $(CMOCKA_CFLAGS) $(AM_CFLAGS)
+test_unit_CopyCommandHeader_LDFLAGS = -Wl,--unresolved-symbols=ignore-all
+test_unit_CopyCommandHeader_LDADD = $(CMOCKA_LIBS) $(libsapi)
+test_unit_CopyCommandHeader_SOURCES = test/unit/CopyCommandHeader.c
 
-test_marshal_UINT16_unit_CFLAGS  = $(CMOCKA_CFLAGS) \
-    -I$(srcdir)/include -I$(srcdir)/include/sapi -I$(srcdir)/sysapi/include/
-test_marshal_UINT16_unit_LDADD   = $(CMOCKA_LIBS)
-test_marshal_UINT16_unit_SOURCES = \
-    sysapi/sysapi_util/changeEndian.c \
-    sysapi/sysapi_util/checkoverflow.c \
-    sysapi/sysapi_util/marshal_uint16.c \
-    test/marshal-UINT16_unit.c
+test_unit_marshal_TPM2B_simple_CFLAGS  = $(CMOCKA_CFLAGS) $(AM_CFLAGS)
+test_unit_marshal_TPM2B_simple_LDADD   = $(CMOCKA_LIBS) $(libsapi)
+test_unit_marshal_TPM2B_simple_SOURCES = test/unit/marshal-TPM2B-simple.c
 
-test_unmarshal_UINT16_unit_CFLAGS  = $(CMOCKA_CFLAGS) \
-    -I$(srcdir)/include -I$(srcdir)/include/sapi -I$(srcdir)/sysapi/include/
-test_unmarshal_UINT16_unit_LDADD   = $(CMOCKA_LIBS)
-test_unmarshal_UINT16_unit_SOURCES = \
-    sysapi/sysapi_util/changeEndian.c \
-    sysapi/sysapi_util/checkoverflow.c \
-    sysapi/sysapi_util/unmarshal_uint16.c \
-    test/unmarshal-UINT16_unit.c
+test_unit_UINT8_marshal_CFLAGS  = $(CMOCKA_CFLAGS) $(AM_CFLAGS)
+test_unit_UINT8_marshal_LDADD   = $(CMOCKA_LIBS) $(libmarshal)
+test_unit_UINT8_marshal_SOURCES = test/unit/UINT8-marshal.c
 
-test_marshal_UINT32_unit_CFLAGS  = $(CMOCKA_CFLAGS) \
-    -I$(srcdir)/include -I$(srcdir)/include/sapi -I$(srcdir)/sysapi/include/
-test_marshal_UINT32_unit_LDADD   = $(CMOCKA_LIBS)
-test_marshal_UINT32_unit_SOURCES = \
-    sysapi/sysapi_util/changeEndian.c \
-    sysapi/sysapi_util/checkoverflow.c \
-    sysapi/sysapi_util/marshal_uint32.c \
-    test/marshal-UINT32_unit.c
+test_unit_UINT16_marshal_CFLAGS  = $(CMOCKA_CFLAGS) $(AM_CFLAGS)
+test_unit_UINT16_marshal_LDADD   = $(CMOCKA_LIBS) $(libmarshal)
+test_unit_UINT16_marshal_SOURCES = test/unit/UINT16-marshal.c
 
-test_unmarshal_UINT32_unit_CFLAGS  = $(CMOCKA_CFLAGS) \
-    -I$(srcdir)/include -I$(srcdir)/include/sapi -I$(srcdir)/sysapi/include/
-test_unmarshal_UINT32_unit_LDADD   = $(CMOCKA_LIBS)
-test_unmarshal_UINT32_unit_SOURCES = \
-    sysapi/sysapi_util/changeEndian.c \
-    sysapi/sysapi_util/checkoverflow.c \
-    sysapi/sysapi_util/unmarshal_uint32.c \
-    test/unmarshal-UINT32_unit.c
+test_unit_UINT32_marshal_CFLAGS  = $(CMOCKA_CFLAGS) $(AM_CFLAGS)
+test_unit_UINT32_marshal_LDADD   = $(CMOCKA_LIBS) $(libmarshal)
+test_unit_UINT32_marshal_SOURCES = test/unit/UINT32-marshal.c
 
-test_marshal_TPM2B_simple_unit_CFLAGS  = $(CMOCKA_CFLAGS) \
-    -I$(srcdir)/include -I$(srcdir)/include/sapi -I$(srcdir)/sysapi/include/
-test_marshal_TPM2B_simple_unit_LDADD   = $(CMOCKA_LIBS)
-test_marshal_TPM2B_simple_unit_SOURCES = \
-    sysapi/sysapi_util/changeEndian.c \
-    sysapi/sysapi_util/checkoverflow.c \
-    sysapi/sysapi_util/marshal_uint8.c \
-    sysapi/sysapi_util/unmarshal_uint8.c \
-    sysapi/sysapi_util/marshal_uint16.c \
-    sysapi/sysapi_util/unmarshal_uint16.c \
-    sysapi/sysapi_util/marshal_uint32.c \
-    sysapi/sysapi_util/CopySessionData.c \
-    sysapi/sysapi_util/marshal_simple_tpm2b.c \
-    sysapi/sysapi_util/unmarshal_simple_tpm2b.c \
-    sysapi/sysapi_util/unmarshal_simple_tpm2b_no_size_check.c \
-    test/marshal-TPM2B-simple_unit.c
-
-test_CheckOverflow_unit_CFLAGS  = $(CMOCKA_CFLAGS) \
-    -I$(srcdir)/include -I$(srcdir)/include/sapi -I$(srcdir)/sysapi/include/
-test_CheckOverflow_unit_LDADD   = $(CMOCKA_LIBS)
-test_CheckOverflow_unit_SOURCES = \
-    sysapi/sysapi_util/checkoverflow.c \
-    test/CheckOverflow_unit.c
+test_unit_UINT64_marshal_CFLAGS  = $(CMOCKA_CFLAGS) $(AM_CFLAGS)
+test_unit_UINT64_marshal_LDADD   = $(CMOCKA_LIBS) $(libmarshal)
+test_unit_UINT64_marshal_SOURCES = test/unit/UINT64-marshal.c
 endif # UNIT
 
-# how to build stuff
-sysapi_libsapi_la_CFLAGS  = -I$(srcdir)/sysapi/include $(AM_CFLAGS)
-sysapi_libsapi_la_LDFLAGS = $(LIBRARY_LDFLAGS)
+marshal_libmarshal_la_LDFLAGS = -Wl,--version-script=$(srcdir)/lib/libmarshal.map
+marshal_libmarshal_la_SOURCES = marshal/base-types.c log/log.c
+
+sysapi_libsapi_la_LIBADD  = $(libmarshal)
 sysapi_libsapi_la_SOURCES = $(SYSAPI_C) $(SYSAPIUTIL_C)
 
-tcti_libtcti_device_la_CFLAGS   = $(TCTIDEVICE_INC) $(AM_CFLAGS)
-tcti_libtcti_device_la_LDFLAGS  = $(LIBRARY_LDFLAGS) \
-    -Wl,--version-script=$(srcdir)/tcti/tcti_device.map
-tcti_libtcti_device_la_SOURCES  = $(TCTIDEVICE_C) \
-    sysapi/sysapi_util/changeEndian.c $(TCTICOMMON_C) common/debug.c
+tcti_libtcti_device_la_CFLAGS   = $(AM_CFLAGS)
+tcti_libtcti_device_la_LDFLAGS  = -Wl,--version-script=$(srcdir)/tcti/tcti_device.map
+tcti_libtcti_device_la_LIBADD   = $(libmarshal)
+tcti_libtcti_device_la_SOURCES  = tcti/tcti_device.c tcti/commonchecks.c \
+    common/debug.c
 
-tcti_libtcti_socket_la_CFLAGS   = $(TCTISOCKET_INC) $(AM_CFLAGS)
-tcti_libtcti_socket_la_CXXFLAGS = $(TCTISOCKET_INC) $(AM_CXXFLAGS)
-tcti_libtcti_socket_la_LDFLAGS  = $(LIBRARY_LDFLAGS) \
-    -Wl,--version-script=$(srcdir)/tcti/tcti_socket.map
-tcti_libtcti_socket_la_SOURCES  =  $(TCTISOCKET_C) \
-    sysapi/sysapi_util/changeEndian.c $(TCTISOCKET_CXX) $(TCTICOMMON_C) \
-    common/sockets.cpp common/debug.c
+tcti_libtcti_socket_la_CFLAGS   = $(AM_CFLAGS)
+tcti_libtcti_socket_la_LDFLAGS  = -Wl,--version-script=$(srcdir)/tcti/tcti_socket.map
+tcti_libtcti_socket_la_SOURCES  = tcti/platformcommand.c tcti/tcti_socket.c \
+    sysapi/sysapi_util/changeEndian.c tcti/commonchecks.c common/sockets.c \
+    common/debug.c
 
-test_tpmclient_tpmclient_CFLAGS   = $(TPMCLIENT_INC) $(AM_CFLAGS)
-test_tpmclient_tpmclient_CXXFLAGS = $(TPMCLIENT_INC) $(TCTICOMMON_INC) $(TCTIDEVICE_INC) $(AM_CXXFLAGS) -DNO_RM_TESTS
-test_tpmclient_tpmclient_LDADD    = $(libsapi) $(libtcti_socket) $(libtcti_device)
-test_tpmclient_tpmclient_SOURCES  = $(TPMCLIENT_CXX) $(COMMON_C) $(SAMPLE_C)
+test_tpmclient_tpmclient_CFLAGS   = $(AM_CFLAGS) -DNO_RM_TESTS
+test_tpmclient_tpmclient_LDADD    = $(libsapi) $(libtcti_socket) $(libtcti_device) $(libmarshal)
+test_tpmclient_tpmclient_SOURCES  = test/tpmclient/tpmclient.c $(COMMON_C) $(SAMPLE_C)
+
+test_integration_libtest_utils_la_SOURCES = test/integration/test-options.c \
+    test/integration/context-util.c
+
+test_integration_get_random_LDADD   = $(TESTS_LDADD)
+test_integration_get_random_SOURCES = test/integration/get-random.c \
+    test/integration/main.c
+
+test_integration_self_test_LDADD   = $(TESTS_LDADD)
+test_integration_self_test_SOURCES = test/integration/self-test.c \
+    test/integration/main.c
+
+test_integration_start_auth_session_LDADD = $(TESTS_LDADD)
+test_integration_start_auth_session_SOURCES = test/integration/main.c \
+    test/integration/start-auth-session.c
+
+test_integration_pcr_extension_LDADD   = $(TESTS_LDADD)
+test_integration_pcr_extension_SOURCES = test/integration/pcr-extension.c \
+    test/integration/main.c
+
+test_integration_asymmetric_encrypt_decrypt_LDADD   = $(TESTS_LDADD)
+test_integration_asymmetric_encrypt_decrypt_SOURCES = test/integration/asymmetric-encrypt-decrypt.c \
+    test/integration/main.c
+
+TESTS_LDADD = $(noinst_LTLIBRARIES) $(lib_LTLIBRARIES)
 
 %.pc : %.pc.in
 	$(call make_parent_dir,$@)
@@ -197,8 +189,6 @@
 man/man7/%.7 : man/%.7.in $(srcdir)/man/man-postlude.troff
 	$(call make_man,$@,$<,$(srcdir)/man/man-postlude.troff)
 
-LIBRARY_LDFLAGS = -fPIC -Wl,--no-undefined
-
 # simulator build / run scripts
 CLEANFILES += test/simulator-build.sh test/simulator-run.sh test/simulator.inc
 .PHONY = simulator-build simulator-start simulator-stop clean-local-ibmtpm
@@ -222,25 +212,10 @@
 	test/simulator-run.sh stop
 
 # simple variables
-TCTICOMMON_INC = -I$(srcdir)/include -I$(srcdir)/common \
-    -I$(srcdir)/sysapi/include
-TCTICOMMON_C   = tcti/commonchecks.c
-
-TCTIDEVICE_INC = $(TCTICOMMON_INC)
-TCTIDEVICE_C   = tcti/tcti_device.c
-
-TCTISOCKET_INC = $(TCTICOMMON_INC)
-TCTISOCKET_C   = tcti/platformcommand.c
-TCTISOCKET_CXX = tcti/tcti_socket.cpp
-
-TPMCLIENT_INC = -I$(srcdir)/include -I$(srcdir)/common \
-    -I$(srcdir)/test/tpmclient -I$(srcdir)/sysapi/include \
-    -I$(srcdir)/test/common/sample
-TPMCLIENT_CXX = test/tpmclient/tpmclient.cpp
-
 libsapi = sysapi/libsapi.la
 libtcti_device = tcti/libtcti-device.la
 libtcti_socket = tcti/libtcti-socket.la
+libmarshal = marshal/libmarshal.la
 tpmclient   = test/tpmclient/tpmclient
 
 define make_parent_dir
diff --git a/README.md b/README.md
index dd0ecb9..b32219f 100644
--- a/README.md
+++ b/README.md
@@ -1,29 +1,61 @@
 [![Build Status](https://travis-ci.org/01org/TPM2.0-TSS.svg?branch=master)](https://travis-ci.org/01org/TPM2.0-TSS)
 
-## TPM (Trusted Platform Module) 2.0 Software Stack (TSS):
-
+# Overview
+This repository hosts source code implementing the Trusted Computing Group's (TCG) TPM2 Software Stack (TSS)
 This stack consists of the following layers from top to bottom:
-* _Feature API (FAPI), see [specification 0.12](http://www.trustedcomputinggroup.org/resources/tss_feature_api_specification), (published but still in progress and unimplemented)_
-* _Enhanced System API (ESAPI), (specification in progress and unimplemented)_
-* System API (SAPI), see [1.0 specification](http://www.trustedcomputinggroup.org/resources/tss_system_level_api_and_tpm_command_transmission_interface_specification), (public, 0.97 implementation complete). This layer implements the system layer API level of the TSS 2.0 specification.   These functions can be used to access all TPM 2.0 functions as described in Part 3 of the TPM 2.0 specification.  The usefulness of this code extends to all users of the TPM, even those not planning to use the upper layers of the TSS.
-* TPM Command Transmission Interface (TCTI), used by SAPI to communicate with next lower layer (either the TAB/RM or TPM 2.0 device driver), see [SAPI specification](http://www.trustedcomputinggroup.org/resources/tss_system_level_api_and_tpm_command_transmission_interface_specification)
-* Trusted Access Broker/Resource Manager (TAB/RM), see [0.91 specification](http://www.trustedcomputinggroup.org/resources/tss_tab_and_resource_manager), (public, implementation complete).  This layer sits between the system API library code and the TPM.  It is a daemon that handles all multi-process coordination and manages the TPM's internal resources transparently to applications.
 
-Since the FAPI and ESAPI haven't been implemented yet, this repository only contains the SAPI and layers below it, plus a test application for exercising the SAPI.
+* System API (SAPI) as described in the  [system level API and TPM command transmission interface specification](http://www.trustedcomputinggroup.org/resources/tss_system_level_api_and_tpm_command_transmission_interface_specification).
+This API is a 1-to-1 mapping of the TPM2 commands documented in Part 3 of the TPM2 specification.
+Additionally there are asynchronous versions of each command.
+These asynchronous variants may be useful for integration into event-driven programming environments.
+Both the synchronous and asynchronous API are exposed through a single library: libsapi.
+* TPM Command Transmission Interface (TCTI) that is described in the same specification.
+This API provides a standard interface to transmit / receive TPM command / response buffers.
+It is expected that any number of libraries implementing the TCTI API will be implemented as a way to abstract various platform specific IPC mechanisms.
+Currently this repository provides two TCTI implementations: libtcti-device and libtcti-socket.
+The prior should be used for direct access to the TPM through the Linux kernel driver.
+The later implements the protocol exposed by the Microsoft software TPM2 simulator.
 
-The test application, tpmclient, tests many of the commands against the TPM 2.0 simulator.  The tpmclient application can be altered and used as a sandbox to test and develop any TPM 2.0 command sequences, and provides an excellent development and learning vehicle.
+# Build and Installation Instructions:
+Instructions to build and install TPM2.0-TSS are available in the [INSTALL](INSTALL) file.
 
-## Build and Installation Instructions:
+# Test Suite
+This repository contains a test suite intended to exercise the TCTI and SAPI code.
+This test suite is *not* intended to test a TPM implementation and so this test suite should only be run against a TPM simulator.
+If this test suite is executed against a TPM other than the software simulator it may cause damage to the TPM (NV storage wear out etc).
+You have been warned.
 
-* [Build and test the TPM 2.0 simulator](doc/simulator.md)
-* Build and install TPM2.0-TSS for Linux: see [INSTALL](INSTALL)
-* [Build TPM2.0-TSS for Windows](doc/buildwindows.md)
+## Simulator
+The TPM library specification contains reference code sufficient to construct a software TPM 2.0 simulator.
+This code was provided by Microsoft and they provide a binary download for Windows [here](https://www.microsoft.com/en-us/download/details.aspx?id=52507).
+IBM has repackaged this code with a few Makefiles so that the Microsoft code can be built and run on Linux systems.
+The Linux version of the Microsoft TPM 2.0 simulator can be obtained [here](https://downloads.sourceforge.net/project/ibmswtpm2/ibmtpm532.tar).
+Once you've downloaded and successfully built and execute the simulator it will, by default, be accepting connections on the localhost, port 2321.
 
-## [Run Instructions](doc/run.md)
+Issues building or running the simulator should be reported to the IBM software TPM2 project.
 
-## [Architecture/Block Diagram](doc/arch.md)
+NOTE: The Intel TCG TSS is currently tested against the 532 version of the simulator.
+Compatibility with later versions has not yet been tested.
 
-## [Code Layout](doc/layout.md)
+## Test Suite
+The test suite is implemented in the tpmclient program.
+This is a monolithic C program that exercises various TCTI and SAPI API calls.
+Once the test environment is set up (simulator is built and running), the tpmclient program can be executed:
 
-## Resources
-TPM 2.0 specifications can be found at [Trusted Computing Group](http://www.trustedcomputinggroup.org/).
+```
+$ test/tpmclient/tpmclient
+```
+
+The `tpmclient` program will run either until completion, or until an error occurs.
+Please report failures in a Github 'issue' with a full log of the test run.
+This must include output from the `tpmclient` program.
+This output must include full debug messages which requires that the libraries and binaries be built with debug flags enabled.
+See [INSTALL](INSTALL) for instructions to build with debug flags enabled.
+
+## Test Suite Decomposition
+We are currently working to decompose the existing monolithic `tpmclient` program into individual test programs that can be integrated into an automated test harness.
+This approach has a number of advantages including the ability to run individual tests in isolation as well as reduced overhead, maintenance and automation.
+
+# [Architecture/Block Diagram](doc/arch.md)
+
+# [Code Layout](doc/layout.md)
diff --git a/bootstrap b/bootstrap
index 4406d47..610e817 100755
--- a/bootstrap
+++ b/bootstrap
@@ -21,10 +21,9 @@
   src_listvar "sysapi/sysapi_util" "*.c" "SYSAPIUTIL_C"
   printf "SYSAPI_SRC = \$(SYSAPI_H) \$(SYSAPI_C) \$(SYSAPIUTIL_C)\n"
 
-  src_listvar "common" "*.cpp" "COMMON_CXX"
   src_listvar "common" "*.c" "COMMON_C"
   src_listvar "common" "*.h" "COMMON_H"
-  printf "COMMON_SRC = \$(COMMON_C) \$(COMMON_CXX) \$(COMMON_H)\n"
+  printf "COMMON_SRC = \$(COMMON_C) \$(COMMON_H)\n"
 
   src_listvar "test/common/sample" "*.c" "SAMPLE_C"
   src_listvar "test/common/sample" "*.h" "SAMPLE_H"
diff --git a/sysapi/sysapi_util/checkoverflow.c b/common/checkoverflow.c
similarity index 98%
rename from sysapi/sysapi_util/checkoverflow.c
rename to common/checkoverflow.c
index 391b20c..4bf41fa 100644
--- a/sysapi/sysapi_util/checkoverflow.c
+++ b/common/checkoverflow.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 
diff --git a/common/checkoverflow.h b/common/checkoverflow.h
new file mode 100644
index 0000000..b3dbd92
--- /dev/null
+++ b/common/checkoverflow.h
@@ -0,0 +1,19 @@
+#ifndef CHECKOVERFLOW_H
+#define CHECKOVERFLOW_H
+
+TSS2_RC
+CheckOverflow (
+    UINT8   *buffer,
+    UINT32   bufferSize,
+    UINT8   *nextData,
+    UINT32   size
+    );
+
+TSS2_RC
+CheckDataPointers (
+    UINT8   *buffer,
+    UINT8  **nextData
+    );
+
+#endif /* CHECKOVERFLOW_H */
+
diff --git a/common/debug.c b/common/debug.c
index 4b2071b..af8eeb1 100644
--- a/common/debug.c
+++ b/common/debug.c
@@ -29,7 +29,7 @@
 #include <stdio.h>
 #include <stdlib.h>   // Needed for _wtoi
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "debug.h"
 
 int DebugPrintf( printf_type type, const char *format, ...)
diff --git a/common/debug.h b/common/debug.h
index a69fad6..d270f09 100644
--- a/common/debug.h
+++ b/common/debug.h
@@ -28,8 +28,8 @@
 #ifndef DEBUG_H
 #define DEBUG_H
 
-#include <sapi/tpm20.h>
-#include <tcti/tcti_socket.h>
+#include "sapi/tpm20.h"
+#include "tcti/tcti_socket.h"
 #include <stdio.h>
 #include "sockets.h"
 
diff --git a/common/sockets.cpp b/common/sockets.c
similarity index 88%
rename from common/sockets.cpp
rename to common/sockets.c
index 5e66994..04c95ed 100644
--- a/common/sockets.cpp
+++ b/common/sockets.c
@@ -1,11 +1,13 @@
-#include <tcti/tcti_socket.h>
+#include <unistd.h>
+#include <netinet/in.h>
+
+#include "tcti/tcti_socket.h"
 #include "debug.h"
 #include "sockets.h"
 
-#ifndef _WIN32
 void WSACleanup() {}
 int WSAGetLastError() { return errno; }
-#endif
+int wasInterrupted() { return errno == EINTR; }
 
 void CloseSockets( SOCKET otherSock, SOCKET tpmSock)
 {
@@ -19,11 +21,20 @@
     int length;
     int bytesRead;
 
-    for( bytesRead = 0, length = len; bytesRead != len; length -= iResult, bytesRead += iResult )
+    for( bytesRead = 0, length = len; bytesRead != len; )
     {
         iResult = recv( tpmSock, (char *)&( data[bytesRead] ), length, 0);
-        if ((iResult == SOCKET_ERROR) || (!iResult))
+        if (iResult == SOCKET_ERROR)
+        {
+            if (wasInterrupted())
+                continue;
             return TSS2_TCTI_RC_IO_ERROR;
+        }
+        else if (!iResult)
+            return TSS2_TCTI_RC_IO_ERROR;
+
+        length -= iResult;
+        bytesRead += iResult;
     }
 
     return TSS2_RC_SUCCESS;
@@ -34,11 +45,19 @@
     int iResult = 0;
     int sentLength = 0;
 
-    for( sentLength = 0; sentLength < len; len -= iResult, sentLength += iResult )
+    for( sentLength = 0; sentLength < len; )
     {
         iResult = send( tpmSock, (char *)data, len, MSG_NOSIGNAL );
         if (iResult == SOCKET_ERROR)
-            return TSS2_TCTI_RC_IO_ERROR;
+        {
+            if (wasInterrupted())
+                continue;
+            else
+                return TSS2_TCTI_RC_IO_ERROR;
+        }
+
+        len -= iResult;
+        sentLength += iResult;
     }
 
     return TSS2_RC_SUCCESS;
@@ -54,25 +73,10 @@
              TCTI_LOG_CALLBACK debugfunc,
              void* data )
 {
-    sockaddr_in otherService;
-    sockaddr_in tpmService;
+    struct sockaddr_in otherService = { 0 };
+    struct sockaddr_in tpmService = { 0 };
     int iResult = 0;            // used to return function results
 
-#ifdef _WIN32
-    WSADATA wsaData = {0};
-    static UINT8 socketsEnabled = 0;
-
-    if( socketsEnabled == 0 )
-    {
-        // Initialize Winsock
-        iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
-        if (iResult != 0) {
-            SAFE_CALL( debugfunc, data, NO_PREFIX, "WSAStartup failed: %d\n", iResult);
-            return 1;
-        }
-        socketsEnabled = 1;
-    }
-#endif
     *otherSock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
     if (*otherSock == INVALID_SOCKET)
     {
diff --git a/common/sockets.h b/common/sockets.h
index f7a6d46..bc119ca 100644
--- a/common/sockets.h
+++ b/common/sockets.h
@@ -2,13 +2,11 @@
 extern "C" {
 #endif
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 
-#ifndef _WIN32
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <errno.h>
-#include <unistd.h>
 #include <arpa/inet.h>
 void WSACleanup();
 #define closesocket(serverSock) close(serverSock)
@@ -19,13 +17,6 @@
 int WSAGetLastError();
 #define WINAPI
 #define LPVOID void *
-#else
-// link with Ws2_32.lib
-#pragma comment(lib,"Ws2_32.lib")
-
-#include <ws2tcpip.h>
-
-#endif
 
 int
 InitSockets( const char *hostName,
diff --git a/common/syscontext.c b/common/syscontext.c
index 13a8a8b..b3c0490 100644
--- a/common/syscontext.c
+++ b/common/syscontext.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include "sysapi_util.h"
@@ -58,10 +58,12 @@
         // Initialized the system context structure.
         rval = Tss2_Sys_Initialize( sysContext, contextSize, tctiContext, abiVersion );
 
-        if( rval == TSS2_RC_SUCCESS )
+        if( rval == TSS2_RC_SUCCESS ) {
             return sysContext;
-        else
-            return 0;
+        } else {
+            free (sysContext);
+            return NULL;
+        }
     }
     else
     {
diff --git a/common/syscontext.h b/common/syscontext.h
index 967d66b..5f5ea9a 100644
--- a/common/syscontext.h
+++ b/common/syscontext.h
@@ -28,7 +28,7 @@
 #ifndef SYS_CONTEXT_H
 #define SYS_CONTEXT_H
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include "sysapi_util.h"
diff --git a/common/tcti_util.c b/common/tcti_util.c
index c994a64..9f53532 100644
--- a/common/tcti_util.c
+++ b/common/tcti_util.c
@@ -1,7 +1,6 @@
 #include "tcti_util.h"
 #include "debug.h"
 
-#ifndef _WIN32
 TSS2_RC InitDeviceTctiContext( const TCTI_DEVICE_CONF *driverConfig, TSS2_TCTI_CONTEXT **tctiContext, const char *deviceTctiName )
 {
     size_t size;
@@ -18,7 +17,6 @@
     rval = InitDeviceTcti(*tctiContext, &size, driverConfig );
     return rval;
 }
-#endif //_WIN32
 
 TSS2_RC
 InitSocketTctiContext (const TCTI_SOCKET_CONF  *device_conf,
diff --git a/common/tcti_util.h b/common/tcti_util.h
index 40fd9f4..cd50ce7 100644
--- a/common/tcti_util.h
+++ b/common/tcti_util.h
@@ -1,19 +1,15 @@
 #ifndef TCTI_UTIL_H
 #define TCTI_UTIL_H
 
-#include <sapi/tpm20.h>
-#ifndef _WIN32
-#include <tcti/tcti_device.h>
-#endif //_WIN32
-#include <tcti/tcti_socket.h>
+#include "sapi/tpm20.h"
+#include "tcti/tcti_device.h"
+#include "tcti/tcti_socket.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#ifndef _WIN32
 TSS2_RC InitDeviceTctiContext( const TCTI_DEVICE_CONF *config, TSS2_TCTI_CONTEXT **tctiContext, const char *deviceTctiName );
-#endif //_WIN32
 TSS2_RC InitSocketTctiContext (const TCTI_SOCKET_CONF  *device_conf,
                                TSS2_TCTI_CONTEXT      **tcti_context);
 void TeardownTctiContext(TSS2_TCTI_CONTEXT **tctiContext);
diff --git a/configure.ac b/configure.ac
index 5f7c525..792ffd6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,8 +2,8 @@
         [m4_esyscmd_s([git describe --tags --always --dirty])])
 AC_CONFIG_MACRO_DIR([m4])
 AC_PROG_CC
-AC_PROG_CXX
 LT_INIT()
+AC_C_BIGENDIAN
 AX_PTHREAD([], [AC_MSG_ERROR([requires pthread])])
 AM_INIT_AUTOMAKE([foreign
                   subdir-objects])
@@ -19,4 +19,24 @@
                          [AC_DEFINE([HAVE_CMOCKA],
                                     [1])])])
 AM_CONDITIONAL([UNIT], [test "x$enable_unit" != xno])
+
+AX_ADD_COMPILER_FLAG([-Wall])
+AX_ADD_COMPILER_FLAG([-Werror])
+AX_ADD_COMPILER_FLAG([-std=gnu99])
+AX_ADD_COMPILER_FLAG([-Wformat])
+AX_ADD_COMPILER_FLAG([-Wformat-security])
+AX_ADD_COMPILER_FLAG([-fstack-protector-all])
+AX_ADD_COMPILER_FLAG([-fpic])
+AX_ADD_COMPILER_FLAG([-fPIC])
+AX_ADD_PREPROC_FLAG([-U_FORTIFY_SOURCE])
+AX_ADD_PREPROC_FLAG([-D_FORTIFY_SOURCE=2])
+AX_ADD_LINK_FLAG([-Wl,--no-undefined])
+AX_ADD_LINK_FLAG([-Wl,-z,noexecstack])
+AX_ADD_LINK_FLAG([-Wl,-z,now])
+AX_ADD_LINK_FLAG([-Wl,-z,relro])
+
+# work around GCC bug #53119
+#   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119
+AX_ADD_COMPILER_FLAG([-Wno-missing-braces])
+
 AC_OUTPUT
diff --git a/doc/buildwindows.md b/doc/buildwindows.md
deleted file mode 100644
index 838ee69..0000000
--- a/doc/buildwindows.md
+++ /dev/null
@@ -1,8 +0,0 @@
-## To Build and Test Windows Version of TSS 2.0: 
-1.	Create an environment variable, TSSTOOLS_PATH that points to your Visual Studio C nmake.exe, cl.exe, link.exe, and lib.exe utilities.  NOTE: the path should start and end with double quotes so that any spaces in the path are interpreted properly.
-1.      Add path that points to your nmake.exe program to the PATH variable.  NOTE:  without this the clean target won't work.  And make sure this path starts and ends with double quotes, too.
-1.	In Visual Studio 2010, open the tss.sln solution file.
-1.	Build it.  This will build the System API library (tpm.lib), the TAB/RM daemon (resourcemgr.exe) and the test application (tpmclient.exe).  tpm.lib is linked into both the TAB/RM daemon and the test application.  The test\tpmclient\debug or test\tpmclient\release directories are where the resourcemgr.exe and tpmclient.exe files are located after building, depending on the type of build.
-1.	Start the TPM 2.0 simulator (this assumes you have a working version of this installed).
-1.	Start the TAB/RM daemon, resourcemgr\<debug | release>\resourcemgr.exe.  There are command line parameters for selecting the TPM host and ports and the ports that will be used by applications to communicate with the daemon.  The easiest way is to run everything on the same machine, in which case no command line parameters are needed.  For help with the command line parameters, type "resourcemgr -?".  For comparing to known good output, redirect the resourcemgr output to a file.
-
diff --git a/doc/simulator.md b/doc/simulator.md
deleted file mode 100644
index e2787ec..0000000
--- a/doc/simulator.md
+++ /dev/null
@@ -1,62 +0,0 @@
-##To Build and Test the TPM 2.0 Simulator:
-
-1. Get the TPM 2.0 simulator, 1.24 version, from the TCG web site, trustedcomputinggroup.org, and install it (this is only possible if you or your company is a TCG member):
-  1.	Go to www.trustedcomputinggroup.org 
-  1.	Click on the member login link (you will have to sign up if you aren't already) 
-  1.	Go to groups' TPMWG' Documents ' Filter, and search for "TPM 2.0 VS".  The latest one as of this writing is 1.24.  
-  1.	This will give you the source code, so you will have to follow the instructions for building it.  
-1.	In Visual Studio 2012, open TPMcmd\simulator.sln solution file and build it.
-1.	Copy libeay32.dll (from OpenSSL) into TPMcmd\debug directory.  
-1.	Run TPMcmd\debug\simulator.exe
-1.	To test it the following python script can be used.  
-NOTE: you may have to cut and paste these commands into Python interpreter one by one.  I'm not a python expert, and I couldn't get the script to just run:
-
-        import os
-
-        import sys
-
-        import socket 
-
-        from socket import socket, AF_INET, SOCK_STREAM
-
-        platformSock = socket(AF_INET, SOCK_STREAM)
-
-        platformSock.connect(('localhost', 2322))
-
-        platformSock.send('\0\0\0\1')
-
-        tpmSock = socket(AF_INET, SOCK_STREAM)
-
-        tpmSock.connect(('localhost', 2321))
-
-        \# Send TPM_SEND_COMMAND 
-
-        tpmSock.send('\x00\x00\x00\x08')
-
-        \# Send locality
-
-        tpmSock.send('\x03')
-
-        \# Send # of bytes
-
-        tpmSock.send('\x00\x00\x00\x0c')
-
-        \# Send tag
-
-        tpmSock.send('\x80\x01')
-
-        \# Send command size
-
-        tpmSock.send('\x00\x00\x00\x0c')
-
-        \# Send command code:  TPMStartup
-
-        tpmSock.send('\x00\x00\x01\x44')
-
-        \# Send TPM SU
-
-        tpmSock.send('\x00\x00')
-
-        \# Receive 4  bytes of 0's 
-
-        reply=tpmSock.recv(18)
diff --git a/include/sapi/marshal.h b/include/sapi/marshal.h
new file mode 100644
index 0000000..3f1dd7d
--- /dev/null
+++ b/include/sapi/marshal.h
@@ -0,0 +1,224 @@
+//**********************************************************************;
+// Copyright (c) 2015, Intel Corporation
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+// THE POSSIBILITY OF SUCH DAMAGE.
+//**********************************************************************;
+
+#ifndef MARSHAL_H
+#define MARSHAL_H
+
+#include <stdlib.h>
+#include <sapi/tpm20.h>
+
+#define TSS2_TYPES_RC_LAYER TSS2_ERROR_LEVEL(14)
+#define TSS2_TYPES_RC_BAD_REFERENCE \
+    ((TSS2_RC)(TSS2_TYPES_RC_LAYER | TSS2_BASE_RC_BAD_REFERENCE))
+#define TSS2_TYPES_RC_INSUFFICIENT_BUFFER \
+    ((TSS2_RC)(TSS2_TYPES_RC_LAYER | TSS2_BASE_RC_INSUFFICIENT_BUFFER))
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+TSS2_RC
+BYTE_Marshal (
+    BYTE           src,
+    uint8_t         buffer [],
+    size_t          buffer_size,
+    size_t         *offset
+    );
+
+TSS2_RC
+BYTE_Unmarshal (
+    uint8_t const   buffer[],
+    size_t          buffer_size,
+    size_t         *offset,
+    BYTE           *dest
+    );
+
+TSS2_RC
+INT8_Marshal (
+    INT8            src,
+    uint8_t         buffer [],
+    size_t          buffer_size,
+    size_t         *offset
+    );
+
+TSS2_RC
+INT8_Unmarshal (
+    uint8_t const   buffer[],
+    size_t          buffer_size,
+    size_t         *offset,
+    INT8           *dest
+    );
+
+TSS2_RC
+INT16_Marshal (
+    INT16           src,
+    uint8_t         buffer [],
+    size_t          buffer_size,
+    size_t         *offset
+    );
+
+TSS2_RC
+INT16_Unmarshal (
+    uint8_t const   buffer[],
+    size_t          buffer_size,
+    size_t         *offset,
+    INT16          *dest
+    );
+
+TSS2_RC
+INT32_Marshal (
+    INT32           src,
+    uint8_t         buffer [],
+    size_t          buffer_size,
+    size_t         *offset
+    );
+
+TSS2_RC
+INT32_Unmarshal (
+    uint8_t const   buffer[],
+    size_t          buffer_size,
+    size_t         *offset,
+    INT32          *dest
+    );
+
+TSS2_RC
+INT64_Marshal (
+    INT64           src,
+    uint8_t         buffer [],
+    size_t          buffer_size,
+    size_t         *offset
+    );
+
+TSS2_RC
+INT64_Unmarshal (
+    uint8_t const   buffer[],
+    size_t          buffer_size,
+    size_t         *offset,
+    INT64          *dest
+    );
+
+TSS2_RC
+UINT8_Marshal (
+    UINT8           src,
+    uint8_t         buffer [],
+    size_t          buffer_size,
+    size_t         *offset
+    );
+
+TSS2_RC
+UINT8_Unmarshal (
+    uint8_t const   buffer[],
+    size_t          buffer_size,
+    size_t         *offset,
+    UINT8          *dest
+    );
+
+TSS2_RC
+UINT16_Marshal (
+    UINT16          src,
+    uint8_t         buffer [],
+    size_t          buffer_size,
+    size_t         *offset
+    );
+
+TSS2_RC
+UINT16_Unmarshal (
+    uint8_t const   buffer[],
+    size_t          buffer_size,
+    size_t         *offset,
+    UINT16         *dest
+    );
+
+TSS2_RC
+UINT32_Marshal (
+    UINT32          src,
+    uint8_t         buffer [],
+    size_t          buffer_size,
+    size_t         *offset
+    );
+
+TSS2_RC
+UINT32_Unmarshal (
+    uint8_t const   buffer[],
+    size_t          buffer_size,
+    size_t         *offset,
+    UINT32         *dest
+    );
+
+TSS2_RC
+UINT64_Marshal (
+    UINT64          src,
+    uint8_t         buffer [],
+    size_t          buffer_size,
+    size_t         *offset
+    );
+
+TSS2_RC
+UINT64_Unmarshal (
+    uint8_t const   buffer[],
+    size_t          buffer_size,
+    size_t         *offset,
+    UINT64         *dest
+    );
+
+TSS2_RC
+TPM_CC_Marshal (
+    TPM_CC          src,
+    uint8_t         buffer [],
+    size_t          buffer_size,
+    size_t         *offset
+    );
+
+TSS2_RC
+TPM_CC_Unmarshal (
+    uint8_t const   buffer [],
+    size_t          buffer_size,
+    size_t         *offset,
+    TPM_CC         *dest
+    );
+
+TSS2_RC
+TPM_ST_Marshal (
+    TPM_ST          src,
+    uint8_t         buffer [],
+    size_t          buffer_size,
+    size_t         *offset
+    );
+
+TSS2_RC
+TPM_ST_Unmarshal (
+    uint8_t const   buffer[],
+    size_t          buffer_size,
+    size_t         *offset,
+    TPM_ST         *dest
+    );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MARSHAL_H */
diff --git a/include/sapi/sys_api_part3.h b/include/sapi/sys_api_part3.h
index c6e7e9c..61969a8 100644
--- a/include/sapi/sys_api_part3.h
+++ b/include/sapi/sys_api_part3.h
@@ -30,7 +30,7 @@
 
 #ifndef TSS2_API_VERSION_1_1_1_1
 #error Version mismatch among TSS2 header files. \
-       Do not include this file, #include <tcti/tpm20.h> instead.
+       Do not include this file, #include <sapi/tpm20.h> instead.
 #endif  /* TSS2_API_VERSION_1_1_1_1 */
 
 typedef struct {
diff --git a/include/sapi/tss2_sys.h b/include/sapi/tss2_sys.h
index 5e07fee..cbd87cd 100644
--- a/include/sapi/tss2_sys.h
+++ b/include/sapi/tss2_sys.h
@@ -1,5 +1,5 @@
 //**********************************************************************;
-// Copyright (c) 2015, Intel Corporation
+// Copyright (c) 2015, 2016 Intel Corporation
 // All rights reserved.
 //
 // Redistribution and use in source and binary forms, with or without
@@ -92,7 +92,7 @@
     TSS2_ABI_VERSION *abiVersion
     );
 
-void Tss2_Sys_Finalize(
+TSS2_RC Tss2_Sys_Finalize(
     TSS2_SYS_CONTEXT *sysContext
     );
 
diff --git a/include/sapi/tss2_tcti.h b/include/sapi/tss2_tcti.h
index 1816c74..c9e6d92 100644
--- a/include/sapi/tss2_tcti.h
+++ b/include/sapi/tss2_tcti.h
@@ -54,11 +54,7 @@
 #include "tss2_common.h"
 #include <stddef.h>
 
-#if defined _WIN32
-#include <winsock2.h>
-#include <windows.h>
-typedef HANDLE TSS2_TCTI_POLL_HANDLE;
-#elif defined linux || defined unix
+#if defined(__linux__) || defined(__unix__)
 #include <poll.h>
 typedef struct pollfd TSS2_TCTI_POLL_HANDLE;
 #else
diff --git a/lib/debug_config.site b/lib/debug_config.site
index 6b0d580..934031a 100644
--- a/lib/debug_config.site
+++ b/lib/debug_config.site
@@ -1,2 +1 @@
-CFLAGS="-Wall -Werror -O0 -ggdb3 -DDEBUG -DDEBUG_SOCKETS"
-CXXFLAGS="-Wall -Werror -O0 -fno-operator-names -fpermissive -ggdb3 -DDEBUG -DDEBUG_SOCKETS"
+CFLAGS="-O0 -ggdb3 -DDEBUG_SOCKETS -DMARSHAL_LOG_LEVEL=DEBUG"
diff --git a/lib/default_config.site b/lib/default_config.site
deleted file mode 100644
index 7a7f2aa..0000000
--- a/lib/default_config.site
+++ /dev/null
@@ -1,2 +0,0 @@
-CFLAGS="-Wall -Werror"
-CXXFLAGS="-Wall -Werror"
diff --git a/lib/libmarshal.map b/lib/libmarshal.map
new file mode 100644
index 0000000..30e4705
--- /dev/null
+++ b/lib/libmarshal.map
@@ -0,0 +1,33 @@
+{
+    global:
+        # convenience functions to convert endianness
+        endian_conv_8;
+        endian_conv_16;
+        endian_conv_32;
+        endian_conv_64;
+        # marshalling functions for TPM2 types
+        BYTE_Marshal;
+        BYTE_Unmarshal;
+        INT8_Marshal;
+        INT8_Unmarshal;
+        INT16_Marshal;
+        INT16_Unmarshal;
+        INT32_Marshal;
+        INT32_Unmarshal;
+        INT64_Marshal;
+        INT64_Unmarshal;
+        UINT8_Marshal;
+        UINT8_Unmarshal;
+        UINT16_Marshal;
+        UINT16_Unmarshal;
+        UINT32_Marshal;
+        UINT32_Unmarshal;
+        UINT64_Marshal;
+        UINT64_Unmarshal;
+        TPM_CC_Marshal;
+        TPM_CC_Unmarshal;
+        TPM_ST_Marshal;
+        TPM_ST_Unmarshal;
+    local:
+        *;
+};
diff --git a/lib/sapi.pc.in b/lib/sapi.pc.in
index 169417f..8c5fee1 100644
--- a/lib/sapi.pc.in
+++ b/lib/sapi.pc.in
@@ -3,4 +3,4 @@
 URL: https://github.com/01org/TPM2.0-TSS
 Version: @VERSION@
 Cflags: -I@includedir@/sapi
-Libs: -lsapi
+Libs: -lmarshal -lsapi
diff --git a/log/log.c b/log/log.c
new file mode 100644
index 0000000..40fc890
--- /dev/null
+++ b/log/log.c
@@ -0,0 +1,43 @@
+#include "log.h"
+
+/*
+ * This array of structures defines the mapping from the log_level
+ * enumeration to their string representation.
+ */
+static const struct log_string {
+    log_level   level;
+    const char *string;
+} log_strings [] = {
+    {
+        DEBUG,
+        "DEBUG",
+    },
+    {
+        INFO,
+        "INFO",
+    },
+    {
+        WARNING,
+        "WARNING",
+    },
+    {
+        ERROR,
+        "ERROR",
+    }
+};
+/*
+ * This function converts a member of the log_level enumeration to its
+ * string representation. It's a simple lookup in the log_strings array
+ * defined above.
+ */
+const char*
+level_to_str (log_level level)
+{
+    unsigned int i;
+    for (i = 0; i < sizeof (log_strings) / sizeof (log_strings[0]); ++i) {
+        if (level == log_strings[i].level) {
+            return log_strings[i].string;
+        }
+    }
+    return "unknown";
+}
diff --git a/log/log.h b/log/log.h
new file mode 100644
index 0000000..c3742a0
--- /dev/null
+++ b/log/log.h
@@ -0,0 +1,14 @@
+#ifndef LOG_H
+#define LOG_H
+
+typedef enum {
+    DEBUG,
+    INFO,
+    WARNING,
+    ERROR,
+    OFF
+} log_level;
+
+const char* level_to_str (log_level level);
+
+#endif /* LOG_H */
diff --git a/m4/flags.m4 b/m4/flags.m4
new file mode 100644
index 0000000..d5ed944
--- /dev/null
+++ b/m4/flags.m4
@@ -0,0 +1,50 @@
+dnl AX_ADD_COMPILER_FLAG:
+dnl   A macro to add a CFLAG to the EXTRA_CFLAGS variable. This macro will
+dnl   check to be sure the compiler supprts the flag. Flags can be made
+dnl   mandatory (configure will fail).
+dnl $1: C compiler flag to add to EXTRA_CFLAGS.
+dnl $2: Set to "required" to cause configure failure if flag not supported..
+AC_DEFUN([AX_ADD_COMPILER_FLAG],[
+    AX_CHECK_COMPILE_FLAG([$1],[
+        EXTRA_CFLAGS="$EXTRA_CFLAGS $1"
+        AC_SUBST([EXTRA_CFLAGS])],[
+        AS_IF([test x$2 != xrequired],[
+            AC_MSG_WARN([Optional CFLAG "$1" not supported by your compiler, continuing.])],[
+            AC_MSG_ERROR([Required CFLAG "$1" not supported by your compiler, aborting.])]
+        )]
+    )]
+)
+dnl AX_ADD_PREPROC_FLAG:
+dnl   Add the provided preprocessor flag to the EXTRA_CFLAGS variable. This
+dnl   macro will check to be sure the preprocessor supports the flag.
+dnl   The flag can be made mandatory by provideing the string 'required' as
+dnl   the second parameter.
+dnl $1: Preprocessor flag to add to EXTRA_CFLAGS.
+dnl $2: Set to "required" t ocause configure failure if preprocesor flag
+dnl     is not supported.
+AC_DEFUN([AX_ADD_PREPROC_FLAG],[
+    AX_CHECK_PREPROC_FLAG([$1],[
+        EXTRA_CFLAGS="$EXTRA_CFLAGS $1"
+        AC_SUBST([EXTRA_CFLAGS])],[
+        AS_IF([test x$2 != xrequired],[
+            AC_MSG_WARN([Optional preprocessor flag "$1" not supported by your compiler, continuing.])],[
+            AC_MSG_ERROR([Required preprocessor flag "$1" not supported by your compiler, aborting.])]
+        )]
+    )]
+)
+dnl AX_ADD_LINK_FLAG:
+dnl   A macro to add a LDLAG to the EXTRA_LDFLAGS variable. This macro will
+dnl   check to be sure the linker supprts the flag. Flags can be made
+dnl   mandatory (configure will fail).
+dnl $1: linker flag to add to EXTRA_LDFLAGS.
+dnl $2: Set to "required" to cause configure failure if flag not supported.
+AC_DEFUN([AX_ADD_LINK_FLAG],[
+    AX_CHECK_LINK_FLAG([$1],[
+        EXTRA_LDFLAGS="$EXTRA_LDFLAGS $1"
+        AC_SUBST([EXTRA_LDFLAGS])],[
+        AS_IF([test x$2 != xrequired],[
+            AC_MSG_WARN([Optional LDFLAG "$1" not supported by your linker, continuing.])],[
+            AC_MSG_ERROR([Required LDFLAG "$1" not supported by your linker, aborting.])]
+        )]
+    )]
+)
diff --git a/marshal/base-types.c b/marshal/base-types.c
new file mode 100644
index 0000000..96734df
--- /dev/null
+++ b/marshal/base-types.c
@@ -0,0 +1,240 @@
+//**********************************************************************;
+// Copyright (c) 2015, Intel Corporation
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+// THE POSSIBILITY OF SUCH DAMAGE.
+//**********************************************************************;
+
+#include <inttypes.h>
+#include <string.h>
+
+#include "sapi/marshal.h"
+#include "sapi/tpm20.h"
+
+#include "log.h"
+#include "base-types.h"
+
+#define BASE_MARSHAL(type, marshal_func) \
+TSS2_RC \
+type##_Marshal ( \
+    type           src, \
+    uint8_t        buffer [], \
+    size_t         buffer_size, \
+    size_t        *offset \
+    ) \
+{ \
+    size_t  local_offset = 0; \
+\
+    if (offset != NULL) { \
+        LOG (INFO, "offset non-NULL, initial value: %zu", *offset); \
+        local_offset = *offset; \
+    } \
+\
+    if (buffer == NULL && offset == NULL) { \
+        LOG (WARNING, "buffer and offset parameter are NULL"); \
+        return TSS2_TYPES_RC_BAD_REFERENCE; \
+    } else if (buffer == NULL && offset != NULL) { \
+        *offset += sizeof (src); \
+        LOG (INFO, "buffer NULL and offset non-NULL, updating offset to %zu", \
+             *offset); \
+        return TSS2_RC_SUCCESS; \
+    } else if (buffer_size < local_offset || \
+               buffer_size - local_offset < sizeof (src)) \
+    { \
+        LOG (WARNING, \
+             "buffer_size: %zu with offset: %zu are insufficient for object " \
+             "of size %zu", \
+             buffer_size, \
+             local_offset, \
+             sizeof (src)); \
+        return TSS2_TYPES_RC_INSUFFICIENT_BUFFER; \
+    } \
+\
+    LOG (DEBUG, \
+         "Marshalling " #type " from 0x%" PRIxPTR " to buffer 0x%" PRIxPTR \
+         " at index 0x%zx", \
+         (uintptr_t)&src, \
+         (uintptr_t)buffer, \
+         local_offset); \
+    src = marshal_func (src); \
+    memcpy (&buffer [local_offset], &src, sizeof (src)); \
+    if (offset != NULL) { \
+        *offset = local_offset + sizeof (src); \
+        LOG (DEBUG, "offset parameter non-NULL, updated to %zu", *offset); \
+    } \
+\
+    return TSS2_RC_SUCCESS; \
+}
+
+#define BASE_UNMARSHAL(type, unmarshal_func) \
+TSS2_RC \
+type##_Unmarshal ( \
+    uint8_t const buffer[], \
+    size_t        buffer_size, \
+    size_t       *offset, \
+    type         *dest \
+    ) \
+{ \
+    size_t  local_offset = 0; \
+\
+    if (offset != NULL) { \
+        LOG (INFO, "offset non-NULL, initial value: %zu", *offset); \
+        local_offset = *offset; \
+    } \
+\
+    if (buffer == NULL || (dest == NULL && offset == NULL)) { \
+        LOG (WARNING, "buffer or dest and offset parameter are NULL"); \
+        return TSS2_TYPES_RC_BAD_REFERENCE; \
+    } else if (dest == NULL && offset != NULL) { \
+        *offset += sizeof (type); \
+        LOG (INFO, \
+             "buffer NULL and offset non-NULL, updating offset to %zu", \
+             *offset); \
+        return TSS2_RC_SUCCESS; \
+    } else if (buffer_size < local_offset || \
+               sizeof (*dest) > buffer_size - local_offset) \
+    { \
+        LOG (WARNING, \
+             "buffer_size: %zu with offset: %zu are insufficient for object " \
+             "of size %zu", \
+             buffer_size, \
+             local_offset, \
+             sizeof (*dest)); \
+        return TSS2_TYPES_RC_INSUFFICIENT_BUFFER; \
+    } \
+\
+    LOG (DEBUG, \
+         "Unmarshalling " #type " from 0x%" PRIxPTR " to buffer 0x%" PRIxPTR \
+         " at index 0x%zx", \
+         (uintptr_t)buffer, \
+         (uintptr_t)dest, \
+         local_offset); \
+    type tmp = 0; \
+    memcpy (&tmp, &buffer [local_offset], sizeof (tmp)); \
+    *dest = unmarshal_func (tmp); \
+    if (offset != NULL) { \
+        *offset = local_offset + sizeof (*dest); \
+        LOG (DEBUG, "offset parameter non-NULL, updated to %zu", *offset); \
+    } \
+\
+    return TSS2_RC_SUCCESS; \
+}
+
+/*
+ * These macros expand to (un)marshal functions for each of the base types
+ * the specification part 2, table 3: Definition of Base Types.
+ */
+BASE_MARSHAL   (BYTE,   HOST_TO_BE_8);
+BASE_UNMARSHAL (BYTE,   BE_TO_HOST_8);
+BASE_MARSHAL   (INT8,   HOST_TO_BE_8);
+BASE_UNMARSHAL (INT8,   BE_TO_HOST_8);
+BASE_MARSHAL   (INT16,  HOST_TO_BE_16);
+BASE_UNMARSHAL (INT16,  BE_TO_HOST_16);
+BASE_MARSHAL   (INT32,  HOST_TO_BE_32);
+BASE_UNMARSHAL (INT32,  BE_TO_HOST_32);
+BASE_MARSHAL   (INT64,  HOST_TO_BE_64);
+BASE_UNMARSHAL (INT64,  BE_TO_HOST_64);
+BASE_MARSHAL   (UINT8,  HOST_TO_BE_8);
+BASE_UNMARSHAL (UINT8,  BE_TO_HOST_8);
+BASE_MARSHAL   (UINT16, HOST_TO_BE_16);
+BASE_UNMARSHAL (UINT16, BE_TO_HOST_16);
+BASE_MARSHAL   (UINT32, HOST_TO_BE_32);
+BASE_UNMARSHAL (UINT32, BE_TO_HOST_32);
+BASE_MARSHAL   (UINT64, HOST_TO_BE_64);
+BASE_UNMARSHAL (UINT64, BE_TO_HOST_64);
+
+UINT8
+endian_conv_8 (UINT8 value)
+{
+    return value;
+}
+UINT16
+endian_conv_16 (UINT16 value)
+{
+    return ((value & (0xff))      << 8) | \
+           ((value & (0xff << 8)) >> 8);
+}
+UINT32
+endian_conv_32 (UINT32 value)
+{
+    return ((value & (0xff))       << 24) | \
+           ((value & (0xff << 8))  << 8)  | \
+           ((value & (0xff << 16)) >> 8)  | \
+           ((value & (0xff << 24)) >> 24);
+}
+UINT64
+endian_conv_64 (UINT64 value)
+{
+    return ((value & (0xffULL))       << 56) | \
+           ((value & (0xffULL << 8))  << 40) | \
+           ((value & (0xffULL << 16)) << 24) | \
+           ((value & (0xffULL << 24)) << 8)  | \
+           ((value & (0xffULL << 32)) >> 8)  | \
+           ((value & (0xffULL << 40)) >> 24) | \
+           ((value & (0xffULL << 48)) >> 40) | \
+           ((value & (0xffULL << 56)) >> 56);
+}
+TSS2_RC
+TPM_CC_Marshal (
+    TPM_CC          src,
+    uint8_t         buffer [],
+    size_t          buffer_size,
+    size_t         *offset
+    )
+{
+    LOG (DEBUG, "Marshalling TPM_CC as UINT32");
+    return UINT32_Marshal (src, buffer, buffer_size, offset);
+}
+TSS2_RC
+TPM_CC_Unmarshal (
+    uint8_t const   buffer [],
+    size_t          buffer_size,
+    size_t         *offset,
+    TPM_CC         *dest
+    )
+{
+    LOG (DEBUG, "Unmarshalling TPM_CC as UINT32");
+    return UINT32_Unmarshal (buffer, buffer_size, offset, dest);
+}
+TSS2_RC
+TPM_ST_Marshal (
+    TPM_ST          src,
+    uint8_t         buffer [],
+    size_t          buffer_size,
+    size_t         *offset
+    )
+{
+    LOG (DEBUG, "Marshalling TPM_ST as UINT16");
+    return UINT16_Marshal ((UINT16)src, buffer, buffer_size, offset);
+}
+TSS2_RC
+TPM_ST_Unmarshal (
+    uint8_t const   buffer[],
+    size_t          buffer_size,
+    size_t         *offset,
+    TPM_ST         *dest
+    )
+{
+    LOG (DEBUG, "Unmarshalling TPM_ST as UINT16");
+    return UINT16_Unmarshal (buffer, buffer_size, offset, (UINT16*)dest);
+}
diff --git a/marshal/base-types.h b/marshal/base-types.h
new file mode 100644
index 0000000..b05f839
--- /dev/null
+++ b/marshal/base-types.h
@@ -0,0 +1,73 @@
+//**********************************************************************;
+// Copyright (c) 2015, Intel Corporation
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+// THE POSSIBILITY OF SUCH DAMAGE.
+//**********************************************************************;
+
+#ifndef BASE_TYPES_H
+#define BASE_TYPES_H
+
+#include "sapi/tpm20.h"
+
+/*
+ * These no-op functions are used on big endian (BE) systems for the host
+ * to / from BE macros. We need them so that we have a valid function
+ * pointers for the base type marshalling function template.
+ */
+static inline UINT8  noop_8  (UINT8 value)  { return value; };
+static inline UINT16 noop_16 (UINT16 value) { return value; };
+static inline UINT32 noop_32 (UINT32 value) { return value; };
+static inline UINT64 noop_64 (UINT64 value) { return value; };
+/*
+ * These functions are used to convert the endianness of base types. We
+ * use them on little endian (LE) systems for the host to / from BE macros.
+ */
+UINT8  endian_conv_8  (UINT8 value);
+UINT16 endian_conv_16 (UINT16 value);
+UINT32 endian_conv_32 (UINT32 value);
+UINT64 endian_conv_64 (UINT64 value);
+/*
+ * These macros should be used in any place where a base type needs to be
+ * converted from the host byte order (host) to a big endian representation.
+ */
+#if defined(WORDS_BIGENDIAN)
+#define HOST_TO_BE_8(value)  noop_8  (value)
+#define HOST_TO_BE_16(value) noop_16 (value)
+#define HOST_TO_BE_32(value) noop_32 (value)
+#define HOST_TO_BE_64(value) noop_64 (value)
+#define BE_TO_HOST_8(value)  noop_8  (value)
+#define BE_TO_HOST_16(value) noop_16 (value)
+#define BE_TO_HOST_32(value) noop_32 (value)
+#define BE_TO_HOST_64(value) noop_64 (value)
+#else
+#define HOST_TO_BE_8(value)  endian_conv_8  (value)
+#define HOST_TO_BE_16(value) endian_conv_16 (value)
+#define HOST_TO_BE_32(value) endian_conv_32 (value)
+#define HOST_TO_BE_64(value) endian_conv_64 (value)
+#define BE_TO_HOST_8(value)  endian_conv_8  (value)
+#define BE_TO_HOST_16(value) endian_conv_16 (value)
+#define BE_TO_HOST_32(value) endian_conv_32 (value)
+#define BE_TO_HOST_64(value) endian_conv_64 (value)
+#endif /* WORDS_BIGENDIAN */
+#endif /* BASE_TYPES_H  */
diff --git a/marshal/log.h b/marshal/log.h
new file mode 100644
index 0000000..40d3b5d
--- /dev/null
+++ b/marshal/log.h
@@ -0,0 +1,34 @@
+#ifndef TSS2T_LOG_H
+
+#include "log/log.h"
+
+#include <stdio.h>
+
+#ifndef MARSHAL_LOG_LEVEL
+#define MARSHAL_LOG_LEVEL WARNING
+#endif
+
+/*
+ * This is a logging macro specific to the marshal module. The only thing
+ * that makes it unique to this module though is the 'marshal' prefix. The
+ * format for these messages is:
+ * module:level:file:line:message
+ * where:
+ * - module : the name of the code module where the message originates
+ * - level  : a string name for the logging level, see log.c
+ * - file   : the name of the file where the message comes from
+ * - line   : the line number where the LOG macro is invoked
+ * - message: a textual message describing the event being logged
+ * NOTE: this macro appends a newline to the message
+ */
+#define LOG(level, fmt, ...) \
+    if (level >= MARSHAL_LOG_LEVEL) do { \
+        fprintf (stderr, \
+                 "%s:marshal:%s:%d " fmt "\n", \
+                 level_to_str (level), \
+                 __FILE__, \
+                 __LINE__, \
+                 ##__VA_ARGS__); \
+    } while (0)
+
+#endif /* TSS2T_LOG_H */
diff --git a/script/simulator.inc b/script/simulator.inc
index 857ee42..07af421 100644
--- a/script/simulator.inc
+++ b/script/simulator.inc
@@ -4,5 +4,5 @@
 SIM_NAME=ibmtpm${SIM_VER}
 SIM_FILE=${SIM_NAME}.tar
 SIM_SHA=abc0b420257917ccb42a9750588565d5e84a2b4e99a6f9f46c3dad1f9912864f
-SIM_URL=http://downloads.sourceforge.net/project/ibmswtpm2/${SIM_FILE}
+SIM_URL=https://downloads.sourceforge.net/project/ibmswtpm2/${SIM_FILE}
 SIM_SRC_DIR=${SIM_DIR}/src
diff --git a/sysapi/include/sys_api_marshalUnmarshal.h b/sysapi/include/sys_api_marshalUnmarshal.h
index 789a5d5..4cb0c3e 100644
--- a/sysapi/include/sys_api_marshalUnmarshal.h
+++ b/sysapi/include/sys_api_marshalUnmarshal.h
@@ -28,24 +28,96 @@
 #ifndef TSS2_SYS_API_MARSHAL_UNMARSHAL_H
 #define TSS2_SYS_API_MARSHAL_UNMARSHAL_H
 
+#include "sapi/marshal.h"
+
+/*
+ * The MARSHAL_ADAPTER macro generates code that adapts the old Marshal_* API
+ * to the new libmarshal replacements.
+ */
+#define MARSHAL_ADAPTER(type, inBuffPtr, maxCommandSize, nextData, src, rval) \
+    do { \
+        if (*rval != TSS2_RC_SUCCESS) { \
+            break;\
+        } \
+        size_t index = *nextData - inBuffPtr; \
+        *rval = type##_Marshal (src, \
+                                inBuffPtr, \
+                                maxCommandSize, \
+                                &index); \
+        *nextData = inBuffPtr + index; \
+    } while (0)
+/*
+ * The UNMARSHAL_ADAPTER macro generates code that adapts the old Unmarshal_*
+ * API to the new libmarshal replacements.
+ */
+#define UNMARSHAL_ADAPTER(type, outBuffPtr, maxResponseSize, nextData, dest, rval) \
+    do { \
+        if (*rval != TSS2_RC_SUCCESS) \
+            break; \
+        size_t index = *nextData - outBuffPtr; \
+        *rval = type##_Unmarshal (outBuffPtr, \
+                                  maxResponseSize, \
+                                  &index, \
+                                  dest); \
+        *nextData = outBuffPtr + index; \
+    } while (0)
 void Marshal_Simple_TPM2B( UINT8 *inBuffPtr, UINT32 maxCommandSize, UINT8 **nextData, TPM2B *value, TSS2_RC *rval );
 void Unmarshal_Simple_TPM2B( UINT8 *outBuffPtr, UINT32 maxResponseSize, UINT8 **nextData, TPM2B *value, TSS2_RC *rval );
 void Unmarshal_Simple_TPM2B_NoSizeCheck( UINT8 *outBuffPtr, UINT32 maxResponseSize, UINT8 **nextData, TPM2B *value, TSS2_RC *rval );
-void Marshal_UINT64( UINT8 *inBuffPtr, UINT32 maxCommandSize, UINT8 **nextData, UINT64 value, TSS2_RC *rval );
-void Marshal_UINT32( UINT8 *inBuffPtr, UINT32 maxCommandSize, UINT8 **nextData, UINT32 value, TSS2_RC *rval );
-void Marshal_UINT16( UINT8 *inBuffPtr, UINT32 maxCommandSize, UINT8 **nextData, UINT16 value, TSS2_RC *rval );
-void Marshal_UINT8( UINT8 *inBuffPtr, UINT32 maxCommandSize, UINT8 **nextData, UINT8 value, TSS2_RC *rval );
-void Unmarshal_UINT64( UINT8 *outBuffPtr, UINT32 maxResponseSize, UINT8 **nextData, UINT64 *value, TSS2_RC *rval );
-void Unmarshal_UINT32( UINT8 *outBuffPtr, UINT32 maxResponseSize, UINT8 **nextData, UINT32 *value, TSS2_RC *rval );
-void Unmarshal_UINT16( UINT8 *outBuffPtr, UINT32 maxResponseSize, UINT8 **nextData, UINT16 *value, TSS2_RC *rval );
-void Unmarshal_UINT8( UINT8 *outBuffPtr, UINT32 maxResponseSize, UINT8 **nextData, UINT8 *value, TSS2_RC *rval );
+/*
+ * These macros expand to adapter macros. They're meant to be a layer
+ * adapting the existing Marshal_* API to the new stuff going into
+ * libmarshal. The type being marshalled is the first parameter to the
+ * MARSHAL_ADAPTER macro.
+ * - inBuffPtr (UINT8*): Pointer to the beginning of the buffer where the
+ *     response buffer resides.
+ * - maxCommandSize (size_t): the size of the memory region pointed to by
+ *     inBuffPtr.
+ * - nextData (UINT8**): Pointer to the location in buffer referenced by
+ *     inBuffPtr where then next value will be marshalled to.
+ * - src (type): The instance of the type being marshalled.
+ * - rval (TSS2_RC*): Pointer to TSS2_RC instace where the response code
+ *     is stored.
+ */
+#define Marshal_TPM_ST(inBuffPtr, maxCommandSize, nextData, src, rval) \
+    MARSHAL_ADAPTER(TPM_ST, inBuffPtr, maxCommandSize, nextData, src, rval)
+#define Marshal_UINT64(inBuffPtr, maxCommandSize, nextData, src, rval) \
+    MARSHAL_ADAPTER(UINT64, inBuffPtr, maxCommandSize, nextData, src, rval)
+#define Marshal_UINT32(inBuffPtr, maxCommandSize, nextData, src, rval) \
+    MARSHAL_ADAPTER(UINT32, inBuffPtr, maxCommandSize, nextData, src, rval)
+#define Marshal_UINT16(inBuffPtr, maxCommandSize, nextData, src, rval) \
+    MARSHAL_ADAPTER(UINT16, inBuffPtr, maxCommandSize, nextData, src, rval)
+#define Marshal_UINT8(inBuffPtr, maxCommandSize, nextData, src, rval) \
+    MARSHAL_ADAPTER(UINT8, inBuffPtr, maxCommandSize, nextData, src, rval)
+/*
+ * These macros expand to adapter macros. They're meant to be a layer
+ * adapting the existing Unmarshal_* API to the new stuff going into
+ * libmarshal. The type being unmarshalled is the first parameter to the
+ * UNMARSHAL_ADAPTER macro.
+ * - outBuffPtr (UINT8*): Pointer to the beginning of the buffer where the
+ *     response buffer resides.
+ * - maxResponseSize (size_t): the size of the memory region pointed to by
+ *     outBuffPtr.
+ * - nextData (UINT8**): Pointer to the location in buffer referenced by
+ *     outBuffPtr where then next value will be unmarshalled from.
+ * - dest (type*): Pointer to an instance of the type being unmarshalled
+ *     where the unmarshalled data will be stored.
+ * - rval (TSS2_RC*): Pointer to TSS2_RC instace where the response code
+ *     is stored
+ */
+#define Unmarshal_TPM_ST(outBuffPtr, maxResponseSize, nextData, dest, rval) \
+    UNMARSHAL_ADAPTER(TPM_ST, outBuffPtr, maxResponseSize, nextData, dest, rval)
+#define Unmarshal_UINT64(outBuffPtr, maxResponseSize, nextData, dest, rval) \
+    UNMARSHAL_ADAPTER(UINT64, outBuffPtr, maxResponseSize, nextData, dest, rval)
+#define Unmarshal_UINT32(outBuffPtr, maxResponseSize, nextData, dest, rval) \
+    UNMARSHAL_ADAPTER(UINT32, outBuffPtr, maxResponseSize, nextData, dest, rval)
+#define Unmarshal_UINT16(outBuffPtr, maxResponseSize, nextData, dest, rval) \
+    UNMARSHAL_ADAPTER(UINT16, outBuffPtr, maxResponseSize, nextData, dest, rval)
+#define Unmarshal_UINT8(outBuffPtr, maxResponseSize, nextData, dest, rval) \
+    UNMARSHAL_ADAPTER(UINT8, outBuffPtr, maxResponseSize, nextData, dest, rval)
 void Marshal_TPMS_EMPTY( TSS2_SYS_CONTEXT *sysContext, TPMS_EMPTY *empty );
 void Unmarshal_TPMS_EMPTY( TSS2_SYS_CONTEXT *sysContext, TPMS_EMPTY *empty );
 
-TSS2_RC CheckOverflow( UINT8 *buffer, UINT32 bufferSize, UINT8 *nextData, UINT32 size );
-TSS2_RC CheckDataPointers( UINT8 *buffer, UINT8 **nextData );
-
-
 // Macro for unmarshalling/marshalling in SYSAPI code.  We needed access to generic base functions in resource manager and
 // other places
 #define UNMARSHAL_SIMPLE_TPM2B( sysContext, value ) \
@@ -60,22 +132,6 @@
 #define MARSHAL_SIMPLE_TPM2B( sysContext, value ) \
     Marshal_Simple_TPM2B( SYS_CONTEXT->tpmInBuffPtr, SYS_CONTEXT->maxCommandSize, &( SYS_CONTEXT->nextData ), value, &(SYS_CONTEXT->rval ) )
 
-#define Marshal_INT8( sysContext, var ) Marshal_int8_t( sysContext, (int8_t *)var )
-
-#define Unmarshal_INT8( sysContext, var ) Unmarshal_int8_t( sysContext, (int8_t *)var )
-
-#define Marshal_BOOL( sysContext, var ) Marshal_int( sysContext, (int *)var )
-
-#define Unmarshal_BOOL( sysContext, var ) Unmarshal_int( sysContext, (int *)var )
-
-#define Marshal_INT16( sysContext, var ) Marshal_int16_t( sysContext, (int16_t *)var )
-
-#define Unmarshal_INT16( sysContext, var ) Unmarshal_int16_t( sysContext, (int16_t *)var )
-
-#define Marshal_INT64( sysContext, var ) Marshal_int64_t( sysContext, (int64_t *)var )
-
-#define Unmarshal_INT64( sysContext, var ) Unmarshal_int64_t( sysContext, (int64_t *)var )
-
 #define Marshal_TPM_ALGORITHM_ID( sysContext, var ) Marshal_UINT32( sysContext, (UINT32 *)var )
 
 #define Unmarshal_TPM_ALGORITHM_ID( sysContext, var ) Unmarshal_UINT32( sysContext, (UINT32 *)var )
diff --git a/sysapi/include/sysapi_util.h b/sysapi/include/sysapi_util.h
index 3ed15ac..39cdcd7 100644
--- a/sysapi/include/sysapi_util.h
+++ b/sysapi/include/sysapi_util.h
@@ -41,6 +41,12 @@
 enum cmdStates { CMD_STAGE_INITIALIZE, CMD_STAGE_PREPARE, CMD_STAGE_SEND_COMMAND, CMD_STAGE_RECEIVE_RESPONSE, CMD_STAGE_ALL = 0xff };
 
 typedef struct {
+  TPM_ST  tag;
+  UINT32  size;
+  TPM_RC  rsp_code;
+} TPM20_Rsp_Header;
+
+typedef struct {
     //
     // These are inputs to system API functions.
     //
@@ -52,6 +58,8 @@
     UINT8 *tpmOutBuffPtr;           // Input: Pointer to response buffer
     UINT32 maxResponseSize;         // Input: max size of response buffer area
 
+    TPM20_Rsp_Header rsp_header;
+
     //
     // These are set by system API and used by helper functions to calculate cpHash,
     // rpHash, and for auditing.
@@ -63,7 +71,6 @@
     UINT32 rpBufferUsedSize;
     UINT8 *rpBuffer;
     UINT8 previousStage;            // Used to check for sequencing errors.
-    TPM_RC responseCode;
     UINT8 authsCount;
     UINT8 numResponseHandles;
     struct
@@ -120,18 +127,6 @@
   UINT32 responseCode;
 } TPM20_ErrorResponse;
 
-typedef struct {
-  TPM_ST tag;
-  UINT32 commandSize;
-  UINT32 commandCode;
-} TPM20_Cmd_Header;
-
-typedef struct {
-  TPM_ST tag;
-  UINT32 responseSize;
-  UINT32 responseCode;
-} TPM20_Rsp_Header;
-
 #pragma pack(pop)
 
 typedef struct {
diff --git a/sysapi/include/tcti_util.h b/sysapi/include/tcti_util.h
index 83f64a8..99c3dcf 100644
--- a/sysapi/include/tcti_util.h
+++ b/sysapi/include/tcti_util.h
@@ -39,7 +39,7 @@
 #ifndef TSS2_TCTI_UTIL_H
 #define TSS2_TCTI_UTIL_H
 
-#if defined linux || defined unix
+#if defined(__linux__) || defined(__unix__)
 #include <sys/socket.h>
 #define SOCKET int
 #endif
diff --git a/sysapi/sysapi/ContextManagement.c b/sysapi/sysapi/ContextManagement.c
index 13d41c0..4abf7c1 100644
--- a/sysapi/sysapi/ContextManagement.c
+++ b/sysapi/sysapi/ContextManagement.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 size_t Tss2_Sys_GetContextSize(size_t maxCommandSize)
diff --git a/sysapi/sysapi/DecryptParam.c b/sysapi/sysapi/DecryptParam.c
index e62d9d0..3d40ced 100644
--- a/sysapi/sysapi/DecryptParam.c
+++ b/sysapi/sysapi/DecryptParam.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TSS2_RC Tss2_Sys_GetDecryptParam(
diff --git a/sysapi/sysapi/EncryptParam.c b/sysapi/sysapi/EncryptParam.c
index 0714aec..6a141f0 100644
--- a/sysapi/sysapi/EncryptParam.c
+++ b/sysapi/sysapi/EncryptParam.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TSS2_RC Tss2_Sys_GetEncryptParam(
diff --git a/sysapi/sysapi/GetCommandCode.c b/sysapi/sysapi/GetCommandCode.c
index b722c7a..5351343 100644
--- a/sysapi/sysapi/GetCommandCode.c
+++ b/sysapi/sysapi/GetCommandCode.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TSS2_RC Tss2_Sys_GetCommandCode(
diff --git a/sysapi/sysapi/GetCpBuffer.c b/sysapi/sysapi/GetCpBuffer.c
index 23e4a7a..5f7436b 100644
--- a/sysapi/sysapi/GetCpBuffer.c
+++ b/sysapi/sysapi/GetCpBuffer.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_GetCpBuffer(
diff --git a/sysapi/sysapi/GetRpBuffer.c b/sysapi/sysapi/GetRpBuffer.c
index c392568..3bf4ebf 100644
--- a/sysapi/sysapi/GetRpBuffer.c
+++ b/sysapi/sysapi/GetRpBuffer.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_GetRpBuffer(
diff --git a/sysapi/sysapi/GetTctiContext.c b/sysapi/sysapi/GetTctiContext.c
index d41121a..99dc86a 100644
--- a/sysapi/sysapi/GetTctiContext.c
+++ b/sysapi/sysapi/GetTctiContext.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TSS2_RC Tss2_Sys_GetTctiContext(
diff --git a/sysapi/sysapi/Tss2_Sys_ActivateCredential.c b/sysapi/sysapi/Tss2_Sys_ActivateCredential.c
index 055a306..f2548c0 100644
--- a/sysapi/sysapi/Tss2_Sys_ActivateCredential.c
+++ b/sysapi/sysapi/Tss2_Sys_ActivateCredential.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_ActivateCredential_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_Certify.c b/sysapi/sysapi/Tss2_Sys_Certify.c
index d4bf692..7df4978 100644
--- a/sysapi/sysapi/Tss2_Sys_Certify.c
+++ b/sysapi/sysapi/Tss2_Sys_Certify.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_Certify_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_CertifyCreation.c b/sysapi/sysapi/Tss2_Sys_CertifyCreation.c
index 5b5fafe..82de555 100644
--- a/sysapi/sysapi/Tss2_Sys_CertifyCreation.c
+++ b/sysapi/sysapi/Tss2_Sys_CertifyCreation.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_CertifyCreation_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_ChangeEPS.c b/sysapi/sysapi/Tss2_Sys_ChangeEPS.c
index fb3d0e1..fc4dd8b 100644
--- a/sysapi/sysapi/Tss2_Sys_ChangeEPS.c
+++ b/sysapi/sysapi/Tss2_Sys_ChangeEPS.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_ChangeEPS_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_ChangePPS.c b/sysapi/sysapi/Tss2_Sys_ChangePPS.c
index 1e5217a..34ae0c2 100644
--- a/sysapi/sysapi/Tss2_Sys_ChangePPS.c
+++ b/sysapi/sysapi/Tss2_Sys_ChangePPS.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_ChangePPS_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_Clear.c b/sysapi/sysapi/Tss2_Sys_Clear.c
index 47a6cb9..a0c58cd 100644
--- a/sysapi/sysapi/Tss2_Sys_Clear.c
+++ b/sysapi/sysapi/Tss2_Sys_Clear.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_Clear_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_ClearControl.c b/sysapi/sysapi/Tss2_Sys_ClearControl.c
index ffcacc3..574cebb 100644
--- a/sysapi/sysapi/Tss2_Sys_ClearControl.c
+++ b/sysapi/sysapi/Tss2_Sys_ClearControl.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_ClearControl_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_ClockRateAdjust.c b/sysapi/sysapi/Tss2_Sys_ClockRateAdjust.c
index 355ccc7..5621047 100644
--- a/sysapi/sysapi/Tss2_Sys_ClockRateAdjust.c
+++ b/sysapi/sysapi/Tss2_Sys_ClockRateAdjust.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_ClockRateAdjust_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_ClockSet.c b/sysapi/sysapi/Tss2_Sys_ClockSet.c
index 3c2fa29..79e9646 100644
--- a/sysapi/sysapi/Tss2_Sys_ClockSet.c
+++ b/sysapi/sysapi/Tss2_Sys_ClockSet.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_ClockSet_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_Commit.c b/sysapi/sysapi/Tss2_Sys_Commit.c
index 65d2f69..794abbf 100644
--- a/sysapi/sysapi/Tss2_Sys_Commit.c
+++ b/sysapi/sysapi/Tss2_Sys_Commit.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_Commit_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_ContextLoad.c b/sysapi/sysapi/Tss2_Sys_ContextLoad.c
index 4399749..3858b3f 100644
--- a/sysapi/sysapi/Tss2_Sys_ContextLoad.c
+++ b/sysapi/sysapi/Tss2_Sys_ContextLoad.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_ContextLoad_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_ContextSave.c b/sysapi/sysapi/Tss2_Sys_ContextSave.c
index baf6a20..d929f2f 100644
--- a/sysapi/sysapi/Tss2_Sys_ContextSave.c
+++ b/sysapi/sysapi/Tss2_Sys_ContextSave.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_ContextSave_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_Create.c b/sysapi/sysapi/Tss2_Sys_Create.c
index b85cd70..3997fb8 100644
--- a/sysapi/sysapi/Tss2_Sys_Create.c
+++ b/sysapi/sysapi/Tss2_Sys_Create.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_Create_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_CreatePrimary.c b/sysapi/sysapi/Tss2_Sys_CreatePrimary.c
index d494969..b7e1b08 100644
--- a/sysapi/sysapi/Tss2_Sys_CreatePrimary.c
+++ b/sysapi/sysapi/Tss2_Sys_CreatePrimary.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_CreatePrimary_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_DictionaryAttackLockReset.c b/sysapi/sysapi/Tss2_Sys_DictionaryAttackLockReset.c
index db25879..2be5148 100644
--- a/sysapi/sysapi/Tss2_Sys_DictionaryAttackLockReset.c
+++ b/sysapi/sysapi/Tss2_Sys_DictionaryAttackLockReset.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_DictionaryAttackLockReset_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_DictionaryAttackParameters.c b/sysapi/sysapi/Tss2_Sys_DictionaryAttackParameters.c
index a4c4bea..af3d272 100644
--- a/sysapi/sysapi/Tss2_Sys_DictionaryAttackParameters.c
+++ b/sysapi/sysapi/Tss2_Sys_DictionaryAttackParameters.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_DictionaryAttackParameters_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_Duplicate.c b/sysapi/sysapi/Tss2_Sys_Duplicate.c
index eab1e23..67d275b 100644
--- a/sysapi/sysapi/Tss2_Sys_Duplicate.c
+++ b/sysapi/sysapi/Tss2_Sys_Duplicate.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_Duplicate_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_ECC_Parameters.c b/sysapi/sysapi/Tss2_Sys_ECC_Parameters.c
index 6088c3d..07a6a31 100644
--- a/sysapi/sysapi/Tss2_Sys_ECC_Parameters.c
+++ b/sysapi/sysapi/Tss2_Sys_ECC_Parameters.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_ECC_Parameters_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_ECDH_KeyGen.c b/sysapi/sysapi/Tss2_Sys_ECDH_KeyGen.c
index af84b40..0f20fa0 100644
--- a/sysapi/sysapi/Tss2_Sys_ECDH_KeyGen.c
+++ b/sysapi/sysapi/Tss2_Sys_ECDH_KeyGen.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_ECDH_KeyGen_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_ECDH_ZGen.c b/sysapi/sysapi/Tss2_Sys_ECDH_ZGen.c
index 3d53110..528da8d 100644
--- a/sysapi/sysapi/Tss2_Sys_ECDH_ZGen.c
+++ b/sysapi/sysapi/Tss2_Sys_ECDH_ZGen.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_ECDH_ZGen_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_EC_Ephemeral.c b/sysapi/sysapi/Tss2_Sys_EC_Ephemeral.c
index c56be07..3e6f558 100644
--- a/sysapi/sysapi/Tss2_Sys_EC_Ephemeral.c
+++ b/sysapi/sysapi/Tss2_Sys_EC_Ephemeral.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_EC_Ephemeral_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_EncryptDecrypt.c b/sysapi/sysapi/Tss2_Sys_EncryptDecrypt.c
index 5eb8d4d..1569e42 100644
--- a/sysapi/sysapi/Tss2_Sys_EncryptDecrypt.c
+++ b/sysapi/sysapi/Tss2_Sys_EncryptDecrypt.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_EncryptDecrypt_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_EventSequenceComplete.c b/sysapi/sysapi/Tss2_Sys_EventSequenceComplete.c
index 95168c5..7fea5a3 100644
--- a/sysapi/sysapi/Tss2_Sys_EventSequenceComplete.c
+++ b/sysapi/sysapi/Tss2_Sys_EventSequenceComplete.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_EventSequenceComplete_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_EvictControl.c b/sysapi/sysapi/Tss2_Sys_EvictControl.c
index 85de728..fb5377d 100644
--- a/sysapi/sysapi/Tss2_Sys_EvictControl.c
+++ b/sysapi/sysapi/Tss2_Sys_EvictControl.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_EvictControl_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_FieldUpgradeData.c b/sysapi/sysapi/Tss2_Sys_FieldUpgradeData.c
index 81358d4..fedb598 100644
--- a/sysapi/sysapi/Tss2_Sys_FieldUpgradeData.c
+++ b/sysapi/sysapi/Tss2_Sys_FieldUpgradeData.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_FieldUpgradeData_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_FieldUpgradeStart.c b/sysapi/sysapi/Tss2_Sys_FieldUpgradeStart.c
index 7953c50..0374808 100644
--- a/sysapi/sysapi/Tss2_Sys_FieldUpgradeStart.c
+++ b/sysapi/sysapi/Tss2_Sys_FieldUpgradeStart.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_FieldUpgradeStart_Prepare(
diff --git a/sysapi/sysapi/Finalize.c b/sysapi/sysapi/Tss2_Sys_Finalize.c
similarity index 92%
rename from sysapi/sysapi/Finalize.c
rename to sysapi/sysapi/Tss2_Sys_Finalize.c
index 63b1b00..06863af 100644
--- a/sysapi/sysapi/Finalize.c
+++ b/sysapi/sysapi/Tss2_Sys_Finalize.c
@@ -1,5 +1,5 @@
 //**********************************************************************;
-// Copyright (c) 2015, Intel Corporation
+// Copyright (c) 2015, 2016, Intel Corporation
 // All rights reserved.
 //
 // Redistribution and use in source and binary forms, with or without
@@ -25,13 +25,13 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
-void Tss2_Sys_Finalize(
+TSS2_RC Tss2_Sys_Finalize(
     TSS2_SYS_CONTEXT *sysContext
     )
 {
-	// Nothing to do here.
+    return TSS2_RC_SUCCESS;
 }
 
diff --git a/sysapi/sysapi/Tss2_Sys_FirmwareRead.c b/sysapi/sysapi/Tss2_Sys_FirmwareRead.c
index 335c96b..c45432a 100644
--- a/sysapi/sysapi/Tss2_Sys_FirmwareRead.c
+++ b/sysapi/sysapi/Tss2_Sys_FirmwareRead.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_FirmwareRead_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_FlushContext.c b/sysapi/sysapi/Tss2_Sys_FlushContext.c
index 22d5d0b..bf981da 100644
--- a/sysapi/sysapi/Tss2_Sys_FlushContext.c
+++ b/sysapi/sysapi/Tss2_Sys_FlushContext.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_FlushContext_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_GetCapability.c b/sysapi/sysapi/Tss2_Sys_GetCapability.c
index 2fe3f12..37fee1e 100644
--- a/sysapi/sysapi/Tss2_Sys_GetCapability.c
+++ b/sysapi/sysapi/Tss2_Sys_GetCapability.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_GetCapability_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_GetCommandAuditDigest.c b/sysapi/sysapi/Tss2_Sys_GetCommandAuditDigest.c
index 1b06537..bdd3c33 100644
--- a/sysapi/sysapi/Tss2_Sys_GetCommandAuditDigest.c
+++ b/sysapi/sysapi/Tss2_Sys_GetCommandAuditDigest.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_GetCommandAuditDigest_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_GetRandom.c b/sysapi/sysapi/Tss2_Sys_GetRandom.c
index 0e14282..32b8ce7 100644
--- a/sysapi/sysapi/Tss2_Sys_GetRandom.c
+++ b/sysapi/sysapi/Tss2_Sys_GetRandom.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_GetRandom_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_GetSessionAuditDigest.c b/sysapi/sysapi/Tss2_Sys_GetSessionAuditDigest.c
index 662c3cb..c23e5ff 100644
--- a/sysapi/sysapi/Tss2_Sys_GetSessionAuditDigest.c
+++ b/sysapi/sysapi/Tss2_Sys_GetSessionAuditDigest.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_GetSessionAuditDigest_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_GetTestResult.c b/sysapi/sysapi/Tss2_Sys_GetTestResult.c
index bf09fed..c4b44a3 100644
--- a/sysapi/sysapi/Tss2_Sys_GetTestResult.c
+++ b/sysapi/sysapi/Tss2_Sys_GetTestResult.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_GetTestResult_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_GetTime.c b/sysapi/sysapi/Tss2_Sys_GetTime.c
index bfd0b89..f878946 100644
--- a/sysapi/sysapi/Tss2_Sys_GetTime.c
+++ b/sysapi/sysapi/Tss2_Sys_GetTime.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_GetTime_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_HMAC.c b/sysapi/sysapi/Tss2_Sys_HMAC.c
index 8d78e74..0145976 100644
--- a/sysapi/sysapi/Tss2_Sys_HMAC.c
+++ b/sysapi/sysapi/Tss2_Sys_HMAC.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_HMAC_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_HMAC_Start.c b/sysapi/sysapi/Tss2_Sys_HMAC_Start.c
index 3586555..94b184c 100644
--- a/sysapi/sysapi/Tss2_Sys_HMAC_Start.c
+++ b/sysapi/sysapi/Tss2_Sys_HMAC_Start.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_HMAC_Start_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_Hash.c b/sysapi/sysapi/Tss2_Sys_Hash.c
index a69d374..f04d6a8 100644
--- a/sysapi/sysapi/Tss2_Sys_Hash.c
+++ b/sysapi/sysapi/Tss2_Sys_Hash.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_Hash_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_HashSequenceStart.c b/sysapi/sysapi/Tss2_Sys_HashSequenceStart.c
index 10c0274..ef33bbc 100644
--- a/sysapi/sysapi/Tss2_Sys_HashSequenceStart.c
+++ b/sysapi/sysapi/Tss2_Sys_HashSequenceStart.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_HashSequenceStart_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_HierarchyChangeAuth.c b/sysapi/sysapi/Tss2_Sys_HierarchyChangeAuth.c
index 038a969..9ab91a5 100644
--- a/sysapi/sysapi/Tss2_Sys_HierarchyChangeAuth.c
+++ b/sysapi/sysapi/Tss2_Sys_HierarchyChangeAuth.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_HierarchyChangeAuth_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_HierarchyControl.c b/sysapi/sysapi/Tss2_Sys_HierarchyControl.c
index 798426d..8661945 100644
--- a/sysapi/sysapi/Tss2_Sys_HierarchyControl.c
+++ b/sysapi/sysapi/Tss2_Sys_HierarchyControl.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_HierarchyControl_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_Import.c b/sysapi/sysapi/Tss2_Sys_Import.c
index 7405c2b..e58fbe1 100644
--- a/sysapi/sysapi/Tss2_Sys_Import.c
+++ b/sysapi/sysapi/Tss2_Sys_Import.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_Import_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_IncrementalSelfTest.c b/sysapi/sysapi/Tss2_Sys_IncrementalSelfTest.c
index 2f099ff..9848281 100644
--- a/sysapi/sysapi/Tss2_Sys_IncrementalSelfTest.c
+++ b/sysapi/sysapi/Tss2_Sys_IncrementalSelfTest.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_IncrementalSelfTest_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_Load.c b/sysapi/sysapi/Tss2_Sys_Load.c
index c107d4f..29259ff 100644
--- a/sysapi/sysapi/Tss2_Sys_Load.c
+++ b/sysapi/sysapi/Tss2_Sys_Load.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_Load_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_LoadExternal.c b/sysapi/sysapi/Tss2_Sys_LoadExternal.c
index 59fc977..22a173b 100644
--- a/sysapi/sysapi/Tss2_Sys_LoadExternal.c
+++ b/sysapi/sysapi/Tss2_Sys_LoadExternal.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_LoadExternal_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_MakeCredential.c b/sysapi/sysapi/Tss2_Sys_MakeCredential.c
index 3812a13..b45e171 100644
--- a/sysapi/sysapi/Tss2_Sys_MakeCredential.c
+++ b/sysapi/sysapi/Tss2_Sys_MakeCredential.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_MakeCredential_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_NV_Certify.c b/sysapi/sysapi/Tss2_Sys_NV_Certify.c
index f89d20d..f95db93 100644
--- a/sysapi/sysapi/Tss2_Sys_NV_Certify.c
+++ b/sysapi/sysapi/Tss2_Sys_NV_Certify.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_NV_Certify_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_NV_ChangeAuth.c b/sysapi/sysapi/Tss2_Sys_NV_ChangeAuth.c
index 622f296..c1b4224 100644
--- a/sysapi/sysapi/Tss2_Sys_NV_ChangeAuth.c
+++ b/sysapi/sysapi/Tss2_Sys_NV_ChangeAuth.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_NV_ChangeAuth_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_NV_DefineSpace.c b/sysapi/sysapi/Tss2_Sys_NV_DefineSpace.c
index dd9b512..8a9e796 100644
--- a/sysapi/sysapi/Tss2_Sys_NV_DefineSpace.c
+++ b/sysapi/sysapi/Tss2_Sys_NV_DefineSpace.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_NV_DefineSpace_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_NV_Extend.c b/sysapi/sysapi/Tss2_Sys_NV_Extend.c
index b72607c..44763f3 100644
--- a/sysapi/sysapi/Tss2_Sys_NV_Extend.c
+++ b/sysapi/sysapi/Tss2_Sys_NV_Extend.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_NV_Extend_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_NV_GlobalWriteLock.c b/sysapi/sysapi/Tss2_Sys_NV_GlobalWriteLock.c
index c76a877..6879758 100644
--- a/sysapi/sysapi/Tss2_Sys_NV_GlobalWriteLock.c
+++ b/sysapi/sysapi/Tss2_Sys_NV_GlobalWriteLock.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_NV_GlobalWriteLock_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_NV_Increment.c b/sysapi/sysapi/Tss2_Sys_NV_Increment.c
index 5ded20c..67679ce 100644
--- a/sysapi/sysapi/Tss2_Sys_NV_Increment.c
+++ b/sysapi/sysapi/Tss2_Sys_NV_Increment.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_NV_Increment_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_NV_Read.c b/sysapi/sysapi/Tss2_Sys_NV_Read.c
index eb40bff..d6753d6 100644
--- a/sysapi/sysapi/Tss2_Sys_NV_Read.c
+++ b/sysapi/sysapi/Tss2_Sys_NV_Read.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_NV_Read_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_NV_ReadLock.c b/sysapi/sysapi/Tss2_Sys_NV_ReadLock.c
index c147ec4..efaec97 100644
--- a/sysapi/sysapi/Tss2_Sys_NV_ReadLock.c
+++ b/sysapi/sysapi/Tss2_Sys_NV_ReadLock.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_NV_ReadLock_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_NV_ReadPublic.c b/sysapi/sysapi/Tss2_Sys_NV_ReadPublic.c
index 7f6405f..1ebe450 100644
--- a/sysapi/sysapi/Tss2_Sys_NV_ReadPublic.c
+++ b/sysapi/sysapi/Tss2_Sys_NV_ReadPublic.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_NV_ReadPublic_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_NV_SetBits.c b/sysapi/sysapi/Tss2_Sys_NV_SetBits.c
index c4c234f..ba1baf1 100644
--- a/sysapi/sysapi/Tss2_Sys_NV_SetBits.c
+++ b/sysapi/sysapi/Tss2_Sys_NV_SetBits.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_NV_SetBits_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_NV_UndefineSpace.c b/sysapi/sysapi/Tss2_Sys_NV_UndefineSpace.c
index 5df2004..ee19b77 100644
--- a/sysapi/sysapi/Tss2_Sys_NV_UndefineSpace.c
+++ b/sysapi/sysapi/Tss2_Sys_NV_UndefineSpace.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_NV_UndefineSpace_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_NV_UndefineSpaceSpecial.c b/sysapi/sysapi/Tss2_Sys_NV_UndefineSpaceSpecial.c
index c10ad71..d57f84b 100644
--- a/sysapi/sysapi/Tss2_Sys_NV_UndefineSpaceSpecial.c
+++ b/sysapi/sysapi/Tss2_Sys_NV_UndefineSpaceSpecial.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_NV_UndefineSpaceSpecial_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_NV_Write.c b/sysapi/sysapi/Tss2_Sys_NV_Write.c
index 43ced26..30125c6 100644
--- a/sysapi/sysapi/Tss2_Sys_NV_Write.c
+++ b/sysapi/sysapi/Tss2_Sys_NV_Write.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_NV_Write_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_NV_WriteLock.c b/sysapi/sysapi/Tss2_Sys_NV_WriteLock.c
index ae834da..8a10375 100644
--- a/sysapi/sysapi/Tss2_Sys_NV_WriteLock.c
+++ b/sysapi/sysapi/Tss2_Sys_NV_WriteLock.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_NV_WriteLock_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_ObjectChangeAuth.c b/sysapi/sysapi/Tss2_Sys_ObjectChangeAuth.c
index 5868a5f..91ae244 100644
--- a/sysapi/sysapi/Tss2_Sys_ObjectChangeAuth.c
+++ b/sysapi/sysapi/Tss2_Sys_ObjectChangeAuth.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_ObjectChangeAuth_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_PCR_Allocate.c b/sysapi/sysapi/Tss2_Sys_PCR_Allocate.c
index db8535f..bc9400f 100644
--- a/sysapi/sysapi/Tss2_Sys_PCR_Allocate.c
+++ b/sysapi/sysapi/Tss2_Sys_PCR_Allocate.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_PCR_Allocate_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_PCR_Event.c b/sysapi/sysapi/Tss2_Sys_PCR_Event.c
index befc2a6..0d84412 100644
--- a/sysapi/sysapi/Tss2_Sys_PCR_Event.c
+++ b/sysapi/sysapi/Tss2_Sys_PCR_Event.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_PCR_Event_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_PCR_Extend.c b/sysapi/sysapi/Tss2_Sys_PCR_Extend.c
index cc7a686..ca040e4 100644
--- a/sysapi/sysapi/Tss2_Sys_PCR_Extend.c
+++ b/sysapi/sysapi/Tss2_Sys_PCR_Extend.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_PCR_Extend_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_PCR_Read.c b/sysapi/sysapi/Tss2_Sys_PCR_Read.c
index e5daccb..d98fe6a 100644
--- a/sysapi/sysapi/Tss2_Sys_PCR_Read.c
+++ b/sysapi/sysapi/Tss2_Sys_PCR_Read.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_PCR_Read_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_PCR_Reset.c b/sysapi/sysapi/Tss2_Sys_PCR_Reset.c
index 312e5f5..04e60de 100644
--- a/sysapi/sysapi/Tss2_Sys_PCR_Reset.c
+++ b/sysapi/sysapi/Tss2_Sys_PCR_Reset.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_PCR_Reset_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_PCR_SetAuthPolicy.c b/sysapi/sysapi/Tss2_Sys_PCR_SetAuthPolicy.c
index 30eba83..68b484e 100644
--- a/sysapi/sysapi/Tss2_Sys_PCR_SetAuthPolicy.c
+++ b/sysapi/sysapi/Tss2_Sys_PCR_SetAuthPolicy.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_PCR_SetAuthPolicy_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_PCR_SetAuthValue.c b/sysapi/sysapi/Tss2_Sys_PCR_SetAuthValue.c
index 54d4549..94b1da3 100644
--- a/sysapi/sysapi/Tss2_Sys_PCR_SetAuthValue.c
+++ b/sysapi/sysapi/Tss2_Sys_PCR_SetAuthValue.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_PCR_SetAuthValue_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_PP_Commands.c b/sysapi/sysapi/Tss2_Sys_PP_Commands.c
index bbdd411..c6427b7 100644
--- a/sysapi/sysapi/Tss2_Sys_PP_Commands.c
+++ b/sysapi/sysapi/Tss2_Sys_PP_Commands.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_PP_Commands_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_PolicyAuthValue.c b/sysapi/sysapi/Tss2_Sys_PolicyAuthValue.c
index 56b5fb0..de764ea 100644
--- a/sysapi/sysapi/Tss2_Sys_PolicyAuthValue.c
+++ b/sysapi/sysapi/Tss2_Sys_PolicyAuthValue.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_PolicyAuthValue_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_PolicyAuthorize.c b/sysapi/sysapi/Tss2_Sys_PolicyAuthorize.c
index 712a180..47498e7 100644
--- a/sysapi/sysapi/Tss2_Sys_PolicyAuthorize.c
+++ b/sysapi/sysapi/Tss2_Sys_PolicyAuthorize.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_PolicyAuthorize_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_PolicyCommandCode.c b/sysapi/sysapi/Tss2_Sys_PolicyCommandCode.c
index f958026..eb315fd 100644
--- a/sysapi/sysapi/Tss2_Sys_PolicyCommandCode.c
+++ b/sysapi/sysapi/Tss2_Sys_PolicyCommandCode.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_PolicyCommandCode_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_PolicyCounterTimer.c b/sysapi/sysapi/Tss2_Sys_PolicyCounterTimer.c
index 9846f45..c879cfb 100644
--- a/sysapi/sysapi/Tss2_Sys_PolicyCounterTimer.c
+++ b/sysapi/sysapi/Tss2_Sys_PolicyCounterTimer.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_PolicyCounterTimer_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_PolicyCpHash.c b/sysapi/sysapi/Tss2_Sys_PolicyCpHash.c
index c445342..fb141cb 100644
--- a/sysapi/sysapi/Tss2_Sys_PolicyCpHash.c
+++ b/sysapi/sysapi/Tss2_Sys_PolicyCpHash.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_PolicyCpHash_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_PolicyDuplicationSelect.c b/sysapi/sysapi/Tss2_Sys_PolicyDuplicationSelect.c
index 493b764..4a54242 100644
--- a/sysapi/sysapi/Tss2_Sys_PolicyDuplicationSelect.c
+++ b/sysapi/sysapi/Tss2_Sys_PolicyDuplicationSelect.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_PolicyDuplicationSelect_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_PolicyGetDigest.c b/sysapi/sysapi/Tss2_Sys_PolicyGetDigest.c
index 2410f65..f5028b5 100644
--- a/sysapi/sysapi/Tss2_Sys_PolicyGetDigest.c
+++ b/sysapi/sysapi/Tss2_Sys_PolicyGetDigest.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_PolicyGetDigest_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_PolicyLocality.c b/sysapi/sysapi/Tss2_Sys_PolicyLocality.c
index 63e30d4..41560d1 100644
--- a/sysapi/sysapi/Tss2_Sys_PolicyLocality.c
+++ b/sysapi/sysapi/Tss2_Sys_PolicyLocality.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_PolicyLocality_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_PolicyNV.c b/sysapi/sysapi/Tss2_Sys_PolicyNV.c
index 6c7ba72..b59e22c 100644
--- a/sysapi/sysapi/Tss2_Sys_PolicyNV.c
+++ b/sysapi/sysapi/Tss2_Sys_PolicyNV.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_PolicyNV_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_PolicyNVWritten.c b/sysapi/sysapi/Tss2_Sys_PolicyNVWritten.c
index bd6b6ed..d1ef64b 100644
--- a/sysapi/sysapi/Tss2_Sys_PolicyNVWritten.c
+++ b/sysapi/sysapi/Tss2_Sys_PolicyNVWritten.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_PolicyNvWritten_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_PolicyNameHash.c b/sysapi/sysapi/Tss2_Sys_PolicyNameHash.c
index d98f518..0521ca5 100644
--- a/sysapi/sysapi/Tss2_Sys_PolicyNameHash.c
+++ b/sysapi/sysapi/Tss2_Sys_PolicyNameHash.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_PolicyNameHash_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_PolicyOR.c b/sysapi/sysapi/Tss2_Sys_PolicyOR.c
index 0bd1b3b..d2398de 100644
--- a/sysapi/sysapi/Tss2_Sys_PolicyOR.c
+++ b/sysapi/sysapi/Tss2_Sys_PolicyOR.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_PolicyOR_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_PolicyPCR.c b/sysapi/sysapi/Tss2_Sys_PolicyPCR.c
index 85b40bc..3d7674e 100644
--- a/sysapi/sysapi/Tss2_Sys_PolicyPCR.c
+++ b/sysapi/sysapi/Tss2_Sys_PolicyPCR.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_PolicyPCR_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_PolicyPassword.c b/sysapi/sysapi/Tss2_Sys_PolicyPassword.c
index ca049cc..d061bc9 100644
--- a/sysapi/sysapi/Tss2_Sys_PolicyPassword.c
+++ b/sysapi/sysapi/Tss2_Sys_PolicyPassword.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_PolicyPassword_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_PolicyPhysicalPresence.c b/sysapi/sysapi/Tss2_Sys_PolicyPhysicalPresence.c
index 15b3416..cc76d07 100644
--- a/sysapi/sysapi/Tss2_Sys_PolicyPhysicalPresence.c
+++ b/sysapi/sysapi/Tss2_Sys_PolicyPhysicalPresence.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_PolicyPhysicalPresence_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_PolicyRestart.c b/sysapi/sysapi/Tss2_Sys_PolicyRestart.c
index d24f81b..63f81e5 100644
--- a/sysapi/sysapi/Tss2_Sys_PolicyRestart.c
+++ b/sysapi/sysapi/Tss2_Sys_PolicyRestart.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_PolicyRestart_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_PolicySecret.c b/sysapi/sysapi/Tss2_Sys_PolicySecret.c
index 6e61c6b..c629128 100644
--- a/sysapi/sysapi/Tss2_Sys_PolicySecret.c
+++ b/sysapi/sysapi/Tss2_Sys_PolicySecret.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_PolicySecret_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_PolicySigned.c b/sysapi/sysapi/Tss2_Sys_PolicySigned.c
index c77366c..448d615 100644
--- a/sysapi/sysapi/Tss2_Sys_PolicySigned.c
+++ b/sysapi/sysapi/Tss2_Sys_PolicySigned.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_PolicySigned_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_PolicyTicket.c b/sysapi/sysapi/Tss2_Sys_PolicyTicket.c
index cd359e6..61c48f7 100644
--- a/sysapi/sysapi/Tss2_Sys_PolicyTicket.c
+++ b/sysapi/sysapi/Tss2_Sys_PolicyTicket.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_PolicyTicket_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_Quote.c b/sysapi/sysapi/Tss2_Sys_Quote.c
index 3e751d3..09f8152 100644
--- a/sysapi/sysapi/Tss2_Sys_Quote.c
+++ b/sysapi/sysapi/Tss2_Sys_Quote.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_Quote_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_RSA_Decrypt.c b/sysapi/sysapi/Tss2_Sys_RSA_Decrypt.c
index 4953629..dead046 100644
--- a/sysapi/sysapi/Tss2_Sys_RSA_Decrypt.c
+++ b/sysapi/sysapi/Tss2_Sys_RSA_Decrypt.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_RSA_Decrypt_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_RSA_Encrypt.c b/sysapi/sysapi/Tss2_Sys_RSA_Encrypt.c
index 7ace07c..f7dcd2a 100644
--- a/sysapi/sysapi/Tss2_Sys_RSA_Encrypt.c
+++ b/sysapi/sysapi/Tss2_Sys_RSA_Encrypt.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_RSA_Encrypt_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_ReadClock.c b/sysapi/sysapi/Tss2_Sys_ReadClock.c
index bf8b683..f2b6618 100644
--- a/sysapi/sysapi/Tss2_Sys_ReadClock.c
+++ b/sysapi/sysapi/Tss2_Sys_ReadClock.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_ReadClock_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_ReadPublic.c b/sysapi/sysapi/Tss2_Sys_ReadPublic.c
index 06a682e..c1bf763 100644
--- a/sysapi/sysapi/Tss2_Sys_ReadPublic.c
+++ b/sysapi/sysapi/Tss2_Sys_ReadPublic.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_ReadPublic_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_Rewrap.c b/sysapi/sysapi/Tss2_Sys_Rewrap.c
index 5034755..436a588 100644
--- a/sysapi/sysapi/Tss2_Sys_Rewrap.c
+++ b/sysapi/sysapi/Tss2_Sys_Rewrap.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_Rewrap_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_SelfTest.c b/sysapi/sysapi/Tss2_Sys_SelfTest.c
index d1f71c6..451cd83 100644
--- a/sysapi/sysapi/Tss2_Sys_SelfTest.c
+++ b/sysapi/sysapi/Tss2_Sys_SelfTest.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_SelfTest_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_SequenceComplete.c b/sysapi/sysapi/Tss2_Sys_SequenceComplete.c
index b5603f4..98c3bab 100644
--- a/sysapi/sysapi/Tss2_Sys_SequenceComplete.c
+++ b/sysapi/sysapi/Tss2_Sys_SequenceComplete.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_SequenceComplete_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_SequenceUpdate.c b/sysapi/sysapi/Tss2_Sys_SequenceUpdate.c
index f94bdd6..96778d8 100644
--- a/sysapi/sysapi/Tss2_Sys_SequenceUpdate.c
+++ b/sysapi/sysapi/Tss2_Sys_SequenceUpdate.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_SequenceUpdate_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_SetAlgorithmSet.c b/sysapi/sysapi/Tss2_Sys_SetAlgorithmSet.c
index 0791930..39ccca1 100644
--- a/sysapi/sysapi/Tss2_Sys_SetAlgorithmSet.c
+++ b/sysapi/sysapi/Tss2_Sys_SetAlgorithmSet.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_SetAlgorithmSet_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_SetCommandCodeAuditStatus.c b/sysapi/sysapi/Tss2_Sys_SetCommandCodeAuditStatus.c
index 4ca642a..005ad4d 100644
--- a/sysapi/sysapi/Tss2_Sys_SetCommandCodeAuditStatus.c
+++ b/sysapi/sysapi/Tss2_Sys_SetCommandCodeAuditStatus.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_SetCommandCodeAuditStatus_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_SetPrimaryPolicy.c b/sysapi/sysapi/Tss2_Sys_SetPrimaryPolicy.c
index 829513f..e6544f7 100644
--- a/sysapi/sysapi/Tss2_Sys_SetPrimaryPolicy.c
+++ b/sysapi/sysapi/Tss2_Sys_SetPrimaryPolicy.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_SetPrimaryPolicy_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_Shutdown.c b/sysapi/sysapi/Tss2_Sys_Shutdown.c
index d5f34f4..c0d2359 100644
--- a/sysapi/sysapi/Tss2_Sys_Shutdown.c
+++ b/sysapi/sysapi/Tss2_Sys_Shutdown.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_Shutdown_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_Sign.c b/sysapi/sysapi/Tss2_Sys_Sign.c
index 6a333c3..3f9faa7 100644
--- a/sysapi/sysapi/Tss2_Sys_Sign.c
+++ b/sysapi/sysapi/Tss2_Sys_Sign.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_Sign_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_StartAuthSession.c b/sysapi/sysapi/Tss2_Sys_StartAuthSession.c
index 48a0660..8b6c64e 100644
--- a/sysapi/sysapi/Tss2_Sys_StartAuthSession.c
+++ b/sysapi/sysapi/Tss2_Sys_StartAuthSession.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_StartAuthSession_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_Startup.c b/sysapi/sysapi/Tss2_Sys_Startup.c
index c81a5f4..510611b 100644
--- a/sysapi/sysapi/Tss2_Sys_Startup.c
+++ b/sysapi/sysapi/Tss2_Sys_Startup.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_Startup_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_StirRandom.c b/sysapi/sysapi/Tss2_Sys_StirRandom.c
index 2602681..cff83b6 100644
--- a/sysapi/sysapi/Tss2_Sys_StirRandom.c
+++ b/sysapi/sysapi/Tss2_Sys_StirRandom.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_StirRandom_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_TestParms.c b/sysapi/sysapi/Tss2_Sys_TestParms.c
index cded748..e5b254e 100644
--- a/sysapi/sysapi/Tss2_Sys_TestParms.c
+++ b/sysapi/sysapi/Tss2_Sys_TestParms.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_TestParms_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_Unseal.c b/sysapi/sysapi/Tss2_Sys_Unseal.c
index 7a77f5b..90ef181 100644
--- a/sysapi/sysapi/Tss2_Sys_Unseal.c
+++ b/sysapi/sysapi/Tss2_Sys_Unseal.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_Unseal_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_Vendor_TCG_Test.c b/sysapi/sysapi/Tss2_Sys_Vendor_TCG_Test.c
index 892b967..5f7be58 100644
--- a/sysapi/sysapi/Tss2_Sys_Vendor_TCG_Test.c
+++ b/sysapi/sysapi/Tss2_Sys_Vendor_TCG_Test.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_Vendor_TCG_Test_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_VerifySignature.c b/sysapi/sysapi/Tss2_Sys_VerifySignature.c
index 777d2c0..c241bff 100644
--- a/sysapi/sysapi/Tss2_Sys_VerifySignature.c
+++ b/sysapi/sysapi/Tss2_Sys_VerifySignature.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_VerifySignature_Prepare(
diff --git a/sysapi/sysapi/Tss2_Sys_ZGen_2Phase.c b/sysapi/sysapi/Tss2_Sys_ZGen_2Phase.c
index 7e08e6d..26573af 100644
--- a/sysapi/sysapi/Tss2_Sys_ZGen_2Phase.c
+++ b/sysapi/sysapi/Tss2_Sys_ZGen_2Phase.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TPM_RC Tss2_Sys_ZGen_2Phase_Prepare(
diff --git a/sysapi/sysapi/authorizations.c b/sysapi/sysapi/authorizations.c
index 4259513..c8206e2 100644
--- a/sysapi/sysapi/authorizations.c
+++ b/sysapi/sysapi/authorizations.c
@@ -25,7 +25,8 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "marshal/base-types.h"
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TSS2_RC Tss2_Sys_SetCmdAuths(
@@ -66,7 +67,7 @@
             if( cmdAuthsArray->cmdAuthsCount > 0 )
             {
                 // Change command tag.
-                ( (TPM20_Header_In *)( SYS_CONTEXT->tpmInBuffPtr ) )->tag = CHANGE_ENDIAN_WORD( TPM_ST_SESSIONS );
+                ( (TPM20_Header_In *)( SYS_CONTEXT->tpmInBuffPtr ) )->tag = HOST_TO_BE_16( TPM_ST_SESSIONS );
 
                 // Calculate size needed for authorization area
                 // and check for any null pointers.
@@ -96,7 +97,7 @@
                 if( rval == TSS2_RC_SUCCESS )
                 {
                     authSize += sizeof( UINT32 ); // authorization size field
-                    newCmdSize = (UINT64)authSize + (UINT64)CHANGE_ENDIAN_DWORD( ( (TPM20_Header_In *)( SYS_CONTEXT->tpmInBuffPtr ) )->commandSize );
+                    newCmdSize = (UINT64)authSize + (UINT64)BE_TO_HOST_32( ( (TPM20_Header_In *)( SYS_CONTEXT->tpmInBuffPtr ) )->commandSize );
 
                     if( newCmdSize > (UINT64)( SYS_CONTEXT->maxCommandSize ) )
                     {
@@ -120,7 +121,7 @@
                             SYS_CONTEXT->cpBuffer += authSize;
 
                             // Now update the command size.
-                            ( (TPM20_Header_In *)( SYS_CONTEXT->tpmInBuffPtr ) )->commandSize = CHANGE_ENDIAN_DWORD( (UINT32)newCmdSize );
+                            ( (TPM20_Header_In *)( SYS_CONTEXT->tpmInBuffPtr ) )->commandSize = HOST_TO_BE_32( (UINT32)newCmdSize );
 
                             SYS_CONTEXT->authsCount = cmdAuthsArray->cmdAuthsCount;
                         }
@@ -145,7 +146,7 @@
         rval = TSS2_SYS_RC_BAD_REFERENCE;
     }
     else if( SYS_CONTEXT->previousStage != CMD_STAGE_RECEIVE_RESPONSE ||
-            CHANGE_ENDIAN_DWORD( ( (TPM20_Header_Out *)( SYS_CONTEXT->tpmOutBuffPtr ) )->responseCode ) != TPM_RC_SUCCESS ||
+             SYS_CONTEXT->rsp_header.rsp_code != TPM_RC_SUCCESS ||
             SYS_CONTEXT->authAllowed == 0 )
     {
         rval = TSS2_SYS_RC_BAD_SEQUENCE;
@@ -172,38 +173,38 @@
                 otherData = SYS_CONTEXT->tpmOutBuffPtr;
                 otherData = (UINT8 *)otherData + sizeof( TPM20_Header_Out ) - 1;
                 otherData = (UINT8 *)otherData + SYS_CONTEXT->numResponseHandles * sizeof( TPM_HANDLE );
-                otherData = (UINT8 *)otherData + CHANGE_ENDIAN_DWORD( *( SYS_CONTEXT->rspParamsSize ) );
+                otherData = (UINT8 *)otherData + BE_TO_HOST_32( *( SYS_CONTEXT->rspParamsSize ) );
                 otherData = (UINT8 *)otherData + sizeof( UINT32 );
 
                 otherDataSaved = otherData;
 
-                if( TPM_ST_SESSIONS == CHANGE_ENDIAN_WORD( ( (TPM20_Header_Out *)( SYS_CONTEXT->tpmOutBuffPtr ) )->tag ) )
+                if( TPM_ST_SESSIONS == SYS_CONTEXT->rsp_header.tag )
                 {
                     for( i = 0; i < rspAuthsArray->rspAuthsCount; i++ )
                     {
                         // Before copying, make sure that we aren't going to go past the output buffer + the response size.
-                        if( (UINT8 *)otherData > ( SYS_CONTEXT->tpmOutBuffPtr + CHANGE_ENDIAN_DWORD( ( (TPM20_Header_Out *)( SYS_CONTEXT->tpmOutBuffPtr ) )->responseSize ) ) )
+                        if( (UINT8 *)otherData > ( SYS_CONTEXT->tpmOutBuffPtr + SYS_CONTEXT->rsp_header.size) )
                         {
                             rval = TSS2_SYS_RC_MALFORMED_RESPONSE;
                             break;
                         }
 
-                        otherData = (UINT8 *)otherData + sizeof( UINT16 ) + CHANGE_ENDIAN_WORD( *(UINT16 *)otherData ); // Nonce
-                        if( (UINT8 *)otherData > ( SYS_CONTEXT->tpmOutBuffPtr + CHANGE_ENDIAN_DWORD( ( (TPM20_Header_Out *)( SYS_CONTEXT->tpmOutBuffPtr ) )->responseSize ) ) )
+                        otherData = (UINT8 *)otherData + sizeof( UINT16 ) + BE_TO_HOST_16( *(UINT16 *)otherData ); // Nonce
+                        if( (UINT8 *)otherData > ( SYS_CONTEXT->tpmOutBuffPtr + SYS_CONTEXT->rsp_header.size) )
                         {
                             rval = TSS2_SYS_RC_MALFORMED_RESPONSE;
                             break;
                         }
 
                         otherData = (UINT8 *)otherData + 1;  // session attributes.
-                        if( (UINT8 *)otherData > ( SYS_CONTEXT->tpmOutBuffPtr + CHANGE_ENDIAN_DWORD( ( (TPM20_Header_Out *)( SYS_CONTEXT->tpmOutBuffPtr ) )->responseSize ) ) )
+                        if( (UINT8 *)otherData > ( SYS_CONTEXT->tpmOutBuffPtr + SYS_CONTEXT->rsp_header.size) )
                         {
                             rval = TSS2_SYS_RC_MALFORMED_RESPONSE;
                             break;
                         }
 
-                        otherData = (UINT8 *)otherData + sizeof( UINT16 ) + CHANGE_ENDIAN_WORD( *(UINT16 *)otherData ); // hmac
-                        if( (UINT8 *)otherData > ( SYS_CONTEXT->tpmOutBuffPtr + CHANGE_ENDIAN_DWORD( ( (TPM20_Header_Out *)( SYS_CONTEXT->tpmOutBuffPtr ) )->responseSize ) ) )
+                        otherData = (UINT8 *)otherData + sizeof( UINT16 ) + BE_TO_HOST_16( *(UINT16 *)otherData ); // hmac
+                        if( (UINT8 *)otherData > ( SYS_CONTEXT->tpmOutBuffPtr + SYS_CONTEXT->rsp_header.size) )
                         {
                             rval = TSS2_SYS_RC_MALFORMED_RESPONSE;
                             break;
@@ -230,7 +231,7 @@
                             // Get start of authorization area.
                             otherData = otherDataSaved;
                             rval = CopySessionsDataOut( rspAuthsArray, otherData,
-                                    CHANGE_ENDIAN_WORD( ( (TPM20_Header_Out *)( SYS_CONTEXT->tpmOutBuffPtr ) )->tag ),
+                                    SYS_CONTEXT->rsp_header.tag,
                                     SYS_CONTEXT->tpmOutBuffPtr, SYS_CONTEXT->maxResponseSize );
                         }
                     }
diff --git a/sysapi/sysapi/execute.c b/sysapi/sysapi/execute.c
index 98521e7..d588430 100644
--- a/sysapi/sysapi/execute.c
+++ b/sysapi/sysapi/execute.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 TSS2_RC Tss2_Sys_ExecuteAsync(
@@ -44,9 +44,9 @@
     }
     else
     {
-        rval = (*( TCTI_CONTEXT )->transmit)( SYS_CONTEXT->tctiContext,
-            CHANGE_ENDIAN_DWORD( ((TPM20_Header_In *)SYS_CONTEXT->tpmInBuffPtr )->commandSize),
-            SYS_CONTEXT->tpmInBuffPtr );
+        rval = tss2_tcti_transmit (SYS_CONTEXT->tctiContext,
+                                   CHANGE_ENDIAN_DWORD( ((TPM20_Header_In *)SYS_CONTEXT->tpmInBuffPtr )->commandSize),
+                                   SYS_CONTEXT->tpmInBuffPtr);
     }
 
     if( rval == TSS2_RC_SUCCESS )
@@ -76,9 +76,10 @@
     else
     {
         responseSize = SYS_CONTEXT->maxResponseSize;
-
-        rval = (*( TCTI_CONTEXT )->receive)
-                ( SYS_CONTEXT->tctiContext, (size_t *)&responseSize, SYS_CONTEXT->tpmOutBuffPtr, timeout );
+        rval = tss2_tcti_receive (SYS_CONTEXT->tctiContext,
+                                  &responseSize,
+                                  SYS_CONTEXT->tpmOutBuffPtr,
+                                  timeout);
     }
 
     if( rval == TSS2_RC_SUCCESS )
@@ -95,34 +96,43 @@
         {
             SYS_CONTEXT->rval = TSS2_RC_SUCCESS;
 
-            // Unmarshal the tag, response size, and response code here so that nextData pointer
-            // is set up for getting response handles.  This avoids having to put special code
-            // in each Part 3 command's Complete function for this.
+            /*
+             * Unmarshal the tag, response size, and response code as soon
+             * as possible. Later processing code should get this data from
+             * the TPM20_Rsp_Header in the context structure. No need to
+             * unmarshal this stuff again.
+             */
             SYS_CONTEXT->nextData = SYS_CONTEXT->tpmOutBuffPtr;
-
-            Unmarshal_UINT16( SYS_CONTEXT->tpmOutBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), 0, &(SYS_CONTEXT->rval) );
-            Unmarshal_UINT32( SYS_CONTEXT->tpmOutBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), (UINT32 *)&responseSize, &(SYS_CONTEXT->rval) );
-
-            if( responseSize < ( sizeof( TPM20_Header_Out ) - 1 ) )
+            Unmarshal_TPM_ST (SYS_CONTEXT->tpmOutBuffPtr,
+                              SYS_CONTEXT->maxCommandSize,
+                              &SYS_CONTEXT->nextData,
+                              &SYS_CONTEXT->rsp_header.tag,
+                              &SYS_CONTEXT->rval);
+            Unmarshal_UINT32 (SYS_CONTEXT->tpmOutBuffPtr,
+                              SYS_CONTEXT->maxCommandSize,
+                              &SYS_CONTEXT->nextData,
+                              &SYS_CONTEXT->rsp_header.size,
+                              &(SYS_CONTEXT->rval) );
+            Unmarshal_UINT32 (SYS_CONTEXT->tpmOutBuffPtr,
+                              SYS_CONTEXT->maxCommandSize,
+                              &SYS_CONTEXT->nextData,
+                              &SYS_CONTEXT->rsp_header.rsp_code,
+                              &SYS_CONTEXT->rval);
+            if (SYS_CONTEXT->rsp_header.size < sizeof(TPM20_Header_Out) - 1)
             {
                 rval = SYS_CONTEXT->rval = TSS2_SYS_RC_INSUFFICIENT_RESPONSE;
             }
             else
             {
-                Unmarshal_UINT32( SYS_CONTEXT->tpmOutBuffPtr, SYS_CONTEXT->maxCommandSize, &(SYS_CONTEXT->nextData), &rval, &(SYS_CONTEXT->rval) );
-
-                // Return TPM return code if no other errors have occured.
-                if( rval == TSS2_RC_SUCCESS )
-                {
+                if (SYS_CONTEXT->rsp_header.rsp_code == TSS2_RC_SUCCESS) {
                     if( SYS_CONTEXT->rval != TPM_RC_SUCCESS )
                     {
                         tpmError = 1;
-                        SYS_CONTEXT->responseCode = rval = SYS_CONTEXT->rval;
+                        rval = SYS_CONTEXT->rval;
                     }
-                }
-                else
-                {
-                    SYS_CONTEXT->rval = rval;
+                } else {
+                    rval = SYS_CONTEXT->rsp_header.rsp_code;
+                    SYS_CONTEXT->rval = SYS_CONTEXT->rsp_header.rsp_code;
                 }
             }
         }
@@ -137,7 +147,6 @@
         else
         {
             SYS_CONTEXT->previousStage = CMD_STAGE_RECEIVE_RESPONSE;
-            SYS_CONTEXT->responseCode = SYS_CONTEXT->rval;
         }
     }
     else if( rval == TSS2_TCTI_RC_INSUFFICIENT_BUFFER )
diff --git a/sysapi/sysapi_util/CommandUtil.c b/sysapi/sysapi_util/CommandUtil.c
index 51a8abf..36a0314 100644
--- a/sysapi/sysapi_util/CommandUtil.c
+++ b/sysapi/sysapi_util/CommandUtil.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 //-----------------------------------------------------------------------------
@@ -93,8 +93,13 @@
 void CopyCommandHeader( _TSS2_SYS_CONTEXT_BLOB *sysContext, TPM_CC commandCode )
 {
    SYS_CONTEXT->rval = TSS2_RC_SUCCESS;
+    SYS_CONTEXT->nextData = SYS_CONTEXT->tpmInBuffPtr;
 
-  ((TPM20_Header_In *) sysContext->tpmInBuffPtr)->tag = CHANGE_ENDIAN_WORD( TPM_ST_NO_SESSIONS );
+    Marshal_TPM_ST (SYS_CONTEXT->tpmInBuffPtr,
+                    SYS_CONTEXT->maxCommandSize,
+                    &(SYS_CONTEXT->nextData),
+                    TPM_ST_NO_SESSIONS,
+                    &(SYS_CONTEXT->rval));
 
   ((TPM20_Header_In *) sysContext->tpmInBuffPtr)->commandCode = CHANGE_ENDIAN_DWORD( commandCode );
 
@@ -184,13 +189,18 @@
 // Common to all _Complete
 TSS2_RC CommonComplete( TSS2_SYS_CONTEXT *sysContext )
 {
-    UINT32 rspSize = CHANGE_ENDIAN_DWORD( ( (TPM20_Header_Out *)( SYS_CONTEXT->tpmOutBuffPtr )  )->responseSize );
+    UINT32 rspSize;
 
     if( sysContext == NULL )
     {
         return TSS2_SYS_RC_BAD_REFERENCE;
     }
-    else if( SYS_CONTEXT->previousStage != CMD_STAGE_RECEIVE_RESPONSE || SYS_CONTEXT->rval != TSS2_RC_SUCCESS )
+    else
+    {
+        rspSize = CHANGE_ENDIAN_DWORD( ( (TPM20_Header_Out *)( SYS_CONTEXT->tpmOutBuffPtr )  )->responseSize );
+    }
+
+    if( SYS_CONTEXT->previousStage != CMD_STAGE_RECEIVE_RESPONSE || SYS_CONTEXT->rval != TSS2_RC_SUCCESS )
     {
         SYS_CONTEXT->rval = TSS2_SYS_RC_BAD_SEQUENCE;
     }
@@ -200,10 +210,17 @@
     }
     else
     {
+        TPM_ST tag = 0;
         SYS_CONTEXT->nextData = (UINT8 *)( SYS_CONTEXT->rspParamsSize );
 
         // Save response params size if command has authorization area.
-        if( CHANGE_ENDIAN_WORD( ( (TPM20_Header_Out *)( SYS_CONTEXT->tpmOutBuffPtr )  )->tag ) == TPM_ST_SESSIONS )
+        UINT8 *tmp_ptr = SYS_CONTEXT->tpmOutBuffPtr;
+        Unmarshal_TPM_ST (SYS_CONTEXT->tpmOutBuffPtr,
+                          SYS_CONTEXT->maxResponseSize,
+                          &tmp_ptr,
+                          &tag,
+                          &(SYS_CONTEXT->rval));
+        if( tag == TPM_ST_SESSIONS )
         {
             Unmarshal_UINT32( SYS_CONTEXT->tpmOutBuffPtr, SYS_CONTEXT->maxResponseSize, &( SYS_CONTEXT->nextData ),
                     &( SYS_CONTEXT->rpBufferUsedSize ), &(SYS_CONTEXT->rval ) );
@@ -227,7 +244,6 @@
     TSS2_SYS_RSP_AUTHS *rspAuthsArray
     )
 {
-    TSS2_RC     rval = TSS2_RC_SUCCESS;
     UINT32      responseSize;
 
     if( SYS_CONTEXT->rval != TSS2_RC_SUCCESS )
@@ -238,13 +254,13 @@
         SYS_CONTEXT->rval = Tss2_Sys_SetCmdAuths( sysContext, cmdAuthsArray );
     }
 
-    if( rval == TSS2_RC_SUCCESS )
+    if( SYS_CONTEXT->rval == TSS2_RC_SUCCESS )
     {
         SYS_CONTEXT->rval = FinishCommand( SYS_CONTEXT, cmdAuthsArray, &responseSize );
 
         if ( SYS_CONTEXT->rval == TSS2_RC_SUCCESS )
         {
-            if( SYS_CONTEXT->responseCode == TPM_RC_SUCCESS )
+            if( SYS_CONTEXT->rsp_header.rsp_code == TPM_RC_SUCCESS )
             {
                 if( CHANGE_ENDIAN_WORD( ( (TPM20_Header_Out *)( SYS_CONTEXT->tpmOutBuffPtr )  )->tag ) == TPM_ST_SESSIONS &&
                         rspAuthsArray != 0 )
diff --git a/sysapi/sysapi_util/CompareSizedByteBuffer.c b/sysapi/sysapi_util/CompareSizedByteBuffer.c
index 70c208a..af2dd82 100644
--- a/sysapi/sysapi_util/CompareSizedByteBuffer.c
+++ b/sysapi/sysapi_util/CompareSizedByteBuffer.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 
diff --git a/sysapi/sysapi_util/ConcatSizedByteBuffer.c b/sysapi/sysapi_util/ConcatSizedByteBuffer.c
index a369d22..dc74b49 100644
--- a/sysapi/sysapi_util/ConcatSizedByteBuffer.c
+++ b/sysapi/sysapi_util/ConcatSizedByteBuffer.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 
diff --git a/sysapi/sysapi_util/CopySessionData.c b/sysapi/sysapi_util/CopySessionData.c
index b1f6244..cb74dea 100644
--- a/sysapi/sysapi_util/CopySessionData.c
+++ b/sysapi/sysapi_util/CopySessionData.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 #define SESSION_MARSHAL_UINT32( buffer, size, currentPtr, value, rval, exitLoc ) \
diff --git a/sysapi/sysapi_util/GetDigestSize.c b/sysapi/sysapi_util/GetDigestSize.c
index f04b294..a192df4 100644
--- a/sysapi/sysapi_util/GetDigestSize.c
+++ b/sysapi/sysapi_util/GetDigestSize.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 
diff --git a/sysapi/sysapi_util/GetNumHandles.c b/sysapi/sysapi_util/GetNumHandles.c
index 9c0975b..f0ee288 100644
--- a/sysapi/sysapi_util/GetNumHandles.c
+++ b/sysapi/sysapi_util/GetNumHandles.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 COMMAND_HANDLES commandArray[] =
diff --git a/sysapi/sysapi_util/Marshal_TPM2B_ECC_POINT.c b/sysapi/sysapi_util/Marshal_TPM2B_ECC_POINT.c
index c1619d2..3d45349 100644
--- a/sysapi/sysapi_util/Marshal_TPM2B_ECC_POINT.c
+++ b/sysapi/sysapi_util/Marshal_TPM2B_ECC_POINT.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPM2B_ECC_POINT(
diff --git a/sysapi/sysapi_util/Marshal_TPM2B_NV_PUBLIC.c b/sysapi/sysapi_util/Marshal_TPM2B_NV_PUBLIC.c
index cef18de..0667748 100644
--- a/sysapi/sysapi_util/Marshal_TPM2B_NV_PUBLIC.c
+++ b/sysapi/sysapi_util/Marshal_TPM2B_NV_PUBLIC.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPM2B_NV_PUBLIC(
diff --git a/sysapi/sysapi_util/Marshal_TPM2B_PUBLIC.c b/sysapi/sysapi_util/Marshal_TPM2B_PUBLIC.c
index 5365dd4..b1dad73 100644
--- a/sysapi/sysapi_util/Marshal_TPM2B_PUBLIC.c
+++ b/sysapi/sysapi_util/Marshal_TPM2B_PUBLIC.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPM2B_PUBLIC(
diff --git a/sysapi/sysapi_util/Marshal_TPM2B_SENSITIVE.c b/sysapi/sysapi_util/Marshal_TPM2B_SENSITIVE.c
index e6834b2..68ede3e 100644
--- a/sysapi/sysapi_util/Marshal_TPM2B_SENSITIVE.c
+++ b/sysapi/sysapi_util/Marshal_TPM2B_SENSITIVE.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPM2B_SENSITIVE(
diff --git a/sysapi/sysapi_util/Marshal_TPM2B_SENSITIVE_CREATE.c b/sysapi/sysapi_util/Marshal_TPM2B_SENSITIVE_CREATE.c
index 76e4358..0c07d8d 100644
--- a/sysapi/sysapi_util/Marshal_TPM2B_SENSITIVE_CREATE.c
+++ b/sysapi/sysapi_util/Marshal_TPM2B_SENSITIVE_CREATE.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPM2B_SENSITIVE_CREATE(
diff --git a/sysapi/sysapi_util/Marshal_TPMA_ALGORITHM.c b/sysapi/sysapi_util/Marshal_TPMA_ALGORITHM.c
index c4292ff..843e6f1 100644
--- a/sysapi/sysapi_util/Marshal_TPMA_ALGORITHM.c
+++ b/sysapi/sysapi_util/Marshal_TPMA_ALGORITHM.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMA_ALGORITHM(
diff --git a/sysapi/sysapi_util/Marshal_TPMA_LOCALITY.c b/sysapi/sysapi_util/Marshal_TPMA_LOCALITY.c
index fa5461c..afe8009 100644
--- a/sysapi/sysapi_util/Marshal_TPMA_LOCALITY.c
+++ b/sysapi/sysapi_util/Marshal_TPMA_LOCALITY.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMA_LOCALITY(
diff --git a/sysapi/sysapi_util/Marshal_TPMA_NV.c b/sysapi/sysapi_util/Marshal_TPMA_NV.c
index 90761a1..e1e2dc5 100644
--- a/sysapi/sysapi_util/Marshal_TPMA_NV.c
+++ b/sysapi/sysapi_util/Marshal_TPMA_NV.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMA_NV(
diff --git a/sysapi/sysapi_util/Marshal_TPMA_OBJECT.c b/sysapi/sysapi_util/Marshal_TPMA_OBJECT.c
index eb069b8..3c4bb8d 100644
--- a/sysapi/sysapi_util/Marshal_TPMA_OBJECT.c
+++ b/sysapi/sysapi_util/Marshal_TPMA_OBJECT.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMA_OBJECT(
diff --git a/sysapi/sysapi_util/Marshal_TPMA_SESSION.c b/sysapi/sysapi_util/Marshal_TPMA_SESSION.c
index eab6b2f..82b3238 100644
--- a/sysapi/sysapi_util/Marshal_TPMA_SESSION.c
+++ b/sysapi/sysapi_util/Marshal_TPMA_SESSION.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMA_SESSION(
diff --git a/sysapi/sysapi_util/Marshal_TPML_ALG.c b/sysapi/sysapi_util/Marshal_TPML_ALG.c
index 0f42add..bc06908 100644
--- a/sysapi/sysapi_util/Marshal_TPML_ALG.c
+++ b/sysapi/sysapi_util/Marshal_TPML_ALG.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPML_ALG(
diff --git a/sysapi/sysapi_util/Marshal_TPML_CC.c b/sysapi/sysapi_util/Marshal_TPML_CC.c
index e59463d..5c9ba11 100644
--- a/sysapi/sysapi_util/Marshal_TPML_CC.c
+++ b/sysapi/sysapi_util/Marshal_TPML_CC.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPML_CC(
diff --git a/sysapi/sysapi_util/Marshal_TPML_DIGEST.c b/sysapi/sysapi_util/Marshal_TPML_DIGEST.c
index ad2f8eb..99971ed 100644
--- a/sysapi/sysapi_util/Marshal_TPML_DIGEST.c
+++ b/sysapi/sysapi_util/Marshal_TPML_DIGEST.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPML_DIGEST(
diff --git a/sysapi/sysapi_util/Marshal_TPML_DIGEST_VALUES.c b/sysapi/sysapi_util/Marshal_TPML_DIGEST_VALUES.c
index c395794..396863d 100644
--- a/sysapi/sysapi_util/Marshal_TPML_DIGEST_VALUES.c
+++ b/sysapi/sysapi_util/Marshal_TPML_DIGEST_VALUES.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPML_DIGEST_VALUES(
diff --git a/sysapi/sysapi_util/Marshal_TPML_PCR_SELECTION.c b/sysapi/sysapi_util/Marshal_TPML_PCR_SELECTION.c
index 3d10c3a..6a88925 100644
--- a/sysapi/sysapi_util/Marshal_TPML_PCR_SELECTION.c
+++ b/sysapi/sysapi_util/Marshal_TPML_PCR_SELECTION.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPML_PCR_SELECTION(
diff --git a/sysapi/sysapi_util/Marshal_TPMS_AUTH_COMMAND.c b/sysapi/sysapi_util/Marshal_TPMS_AUTH_COMMAND.c
index d5f8f0e..e173f8b 100644
--- a/sysapi/sysapi_util/Marshal_TPMS_AUTH_COMMAND.c
+++ b/sysapi/sysapi_util/Marshal_TPMS_AUTH_COMMAND.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMS_AUTH_COMMAND(
diff --git a/sysapi/sysapi_util/Marshal_TPMS_CLOCK_INFO.c b/sysapi/sysapi_util/Marshal_TPMS_CLOCK_INFO.c
index 5f96cc1..4f34dbd 100644
--- a/sysapi/sysapi_util/Marshal_TPMS_CLOCK_INFO.c
+++ b/sysapi/sysapi_util/Marshal_TPMS_CLOCK_INFO.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMS_CLOCK_INFO(
diff --git a/sysapi/sysapi_util/Marshal_TPMS_CONTEXT.c b/sysapi/sysapi_util/Marshal_TPMS_CONTEXT.c
index ffb225e..0d98195 100644
--- a/sysapi/sysapi_util/Marshal_TPMS_CONTEXT.c
+++ b/sysapi/sysapi_util/Marshal_TPMS_CONTEXT.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMS_CONTEXT(
diff --git a/sysapi/sysapi_util/Marshal_TPMS_CONTEXT_DATA.c b/sysapi/sysapi_util/Marshal_TPMS_CONTEXT_DATA.c
index e8e500b..279ebd0 100644
--- a/sysapi/sysapi_util/Marshal_TPMS_CONTEXT_DATA.c
+++ b/sysapi/sysapi_util/Marshal_TPMS_CONTEXT_DATA.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMS_CONTEXT_DATA(
diff --git a/sysapi/sysapi_util/Marshal_TPMS_ECC_PARMS.c b/sysapi/sysapi_util/Marshal_TPMS_ECC_PARMS.c
index c4db677..a23f5e2 100644
--- a/sysapi/sysapi_util/Marshal_TPMS_ECC_PARMS.c
+++ b/sysapi/sysapi_util/Marshal_TPMS_ECC_PARMS.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMS_ECC_PARMS(
diff --git a/sysapi/sysapi_util/Marshal_TPMS_ECC_POINT.c b/sysapi/sysapi_util/Marshal_TPMS_ECC_POINT.c
index c4d0deb..fb6aa77 100644
--- a/sysapi/sysapi_util/Marshal_TPMS_ECC_POINT.c
+++ b/sysapi/sysapi_util/Marshal_TPMS_ECC_POINT.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMS_ECC_POINT(
diff --git a/sysapi/sysapi_util/Marshal_TPMS_EMPTY.c b/sysapi/sysapi_util/Marshal_TPMS_EMPTY.c
index 9799576..1a67aa7 100644
--- a/sysapi/sysapi_util/Marshal_TPMS_EMPTY.c
+++ b/sysapi/sysapi_util/Marshal_TPMS_EMPTY.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMS_EMPTY(
diff --git a/sysapi/sysapi_util/Marshal_TPMS_KEYEDHASH_PARMS.c b/sysapi/sysapi_util/Marshal_TPMS_KEYEDHASH_PARMS.c
index c1d6239..82f3a35 100644
--- a/sysapi/sysapi_util/Marshal_TPMS_KEYEDHASH_PARMS.c
+++ b/sysapi/sysapi_util/Marshal_TPMS_KEYEDHASH_PARMS.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMS_KEYEDHASH_PARMS(
diff --git a/sysapi/sysapi_util/Marshal_TPMS_NV_PIN_COUNTER_PARAMETERS.c b/sysapi/sysapi_util/Marshal_TPMS_NV_PIN_COUNTER_PARAMETERS.c
index 4b04a51..e075912 100644
--- a/sysapi/sysapi_util/Marshal_TPMS_NV_PIN_COUNTER_PARAMETERS.c
+++ b/sysapi/sysapi_util/Marshal_TPMS_NV_PIN_COUNTER_PARAMETERS.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMS_NV_PIN_COUNTER_PARAMETERS(
diff --git a/sysapi/sysapi_util/Marshal_TPMS_NV_PUBLIC.c b/sysapi/sysapi_util/Marshal_TPMS_NV_PUBLIC.c
index 1f39f67..cc3a7ed 100644
--- a/sysapi/sysapi_util/Marshal_TPMS_NV_PUBLIC.c
+++ b/sysapi/sysapi_util/Marshal_TPMS_NV_PUBLIC.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMS_NV_PUBLIC(
diff --git a/sysapi/sysapi_util/Marshal_TPMS_PCR_SELECT.c b/sysapi/sysapi_util/Marshal_TPMS_PCR_SELECT.c
index e5a6682..c3824a9 100644
--- a/sysapi/sysapi_util/Marshal_TPMS_PCR_SELECT.c
+++ b/sysapi/sysapi_util/Marshal_TPMS_PCR_SELECT.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMS_PCR_SELECT(
diff --git a/sysapi/sysapi_util/Marshal_TPMS_PCR_SELECTION.c b/sysapi/sysapi_util/Marshal_TPMS_PCR_SELECTION.c
index 989250b..2d63b40 100644
--- a/sysapi/sysapi_util/Marshal_TPMS_PCR_SELECTION.c
+++ b/sysapi/sysapi_util/Marshal_TPMS_PCR_SELECTION.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMS_PCR_SELECTION(
diff --git a/sysapi/sysapi_util/Marshal_TPMS_RSA_PARMS.c b/sysapi/sysapi_util/Marshal_TPMS_RSA_PARMS.c
index d43d2a7..915d372 100644
--- a/sysapi/sysapi_util/Marshal_TPMS_RSA_PARMS.c
+++ b/sysapi/sysapi_util/Marshal_TPMS_RSA_PARMS.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMS_RSA_PARMS(
diff --git a/sysapi/sysapi_util/Marshal_TPMS_SCHEME_ECDAA.c b/sysapi/sysapi_util/Marshal_TPMS_SCHEME_ECDAA.c
index 83daaac..afe4657 100644
--- a/sysapi/sysapi_util/Marshal_TPMS_SCHEME_ECDAA.c
+++ b/sysapi/sysapi_util/Marshal_TPMS_SCHEME_ECDAA.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMS_SCHEME_ECDAA(
diff --git a/sysapi/sysapi_util/Marshal_TPMS_SCHEME_HASH.c b/sysapi/sysapi_util/Marshal_TPMS_SCHEME_HASH.c
index abeb4bf..aec99af 100644
--- a/sysapi/sysapi_util/Marshal_TPMS_SCHEME_HASH.c
+++ b/sysapi/sysapi_util/Marshal_TPMS_SCHEME_HASH.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMS_SCHEME_HASH(
diff --git a/sysapi/sysapi_util/Marshal_TPMS_SCHEME_XOR.c b/sysapi/sysapi_util/Marshal_TPMS_SCHEME_XOR.c
index 3dd207a..e8cca97 100644
--- a/sysapi/sysapi_util/Marshal_TPMS_SCHEME_XOR.c
+++ b/sysapi/sysapi_util/Marshal_TPMS_SCHEME_XOR.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMS_SCHEME_XOR(
diff --git a/sysapi/sysapi_util/Marshal_TPMS_SENSITIVE_CREATE.c b/sysapi/sysapi_util/Marshal_TPMS_SENSITIVE_CREATE.c
index f0763c4..4a04463 100644
--- a/sysapi/sysapi_util/Marshal_TPMS_SENSITIVE_CREATE.c
+++ b/sysapi/sysapi_util/Marshal_TPMS_SENSITIVE_CREATE.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMS_SENSITIVE_CREATE(
diff --git a/sysapi/sysapi_util/Marshal_TPMS_SIGNATURE_ECC.c b/sysapi/sysapi_util/Marshal_TPMS_SIGNATURE_ECC.c
index 9565fee..4a83826 100644
--- a/sysapi/sysapi_util/Marshal_TPMS_SIGNATURE_ECC.c
+++ b/sysapi/sysapi_util/Marshal_TPMS_SIGNATURE_ECC.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMS_SIGNATURE_ECC(
diff --git a/sysapi/sysapi_util/Marshal_TPMS_SIGNATURE_RSA.c b/sysapi/sysapi_util/Marshal_TPMS_SIGNATURE_RSA.c
index a15cc25..f50a0e3 100644
--- a/sysapi/sysapi_util/Marshal_TPMS_SIGNATURE_RSA.c
+++ b/sysapi/sysapi_util/Marshal_TPMS_SIGNATURE_RSA.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMS_SIGNATURE_RSA(
diff --git a/sysapi/sysapi_util/Marshal_TPMS_SYMCIPHER_PARMS.c b/sysapi/sysapi_util/Marshal_TPMS_SYMCIPHER_PARMS.c
index fd860d8..8b9851b 100644
--- a/sysapi/sysapi_util/Marshal_TPMS_SYMCIPHER_PARMS.c
+++ b/sysapi/sysapi_util/Marshal_TPMS_SYMCIPHER_PARMS.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMS_SYMCIPHER_PARMS(
diff --git a/sysapi/sysapi_util/Marshal_TPMS_TIME_INFO.c b/sysapi/sysapi_util/Marshal_TPMS_TIME_INFO.c
index f1bc71a..5798179 100644
--- a/sysapi/sysapi_util/Marshal_TPMS_TIME_INFO.c
+++ b/sysapi/sysapi_util/Marshal_TPMS_TIME_INFO.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMS_TIME_INFO(
diff --git a/sysapi/sysapi_util/Marshal_TPMT_ECC_SCHEME.c b/sysapi/sysapi_util/Marshal_TPMT_ECC_SCHEME.c
index 2083ece..93131b8 100644
--- a/sysapi/sysapi_util/Marshal_TPMT_ECC_SCHEME.c
+++ b/sysapi/sysapi_util/Marshal_TPMT_ECC_SCHEME.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMT_ECC_SCHEME(
diff --git a/sysapi/sysapi_util/Marshal_TPMT_HA.c b/sysapi/sysapi_util/Marshal_TPMT_HA.c
index 99f2610..e5caaa4 100644
--- a/sysapi/sysapi_util/Marshal_TPMT_HA.c
+++ b/sysapi/sysapi_util/Marshal_TPMT_HA.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMT_HA(
diff --git a/sysapi/sysapi_util/Marshal_TPMT_KDF_SCHEME.c b/sysapi/sysapi_util/Marshal_TPMT_KDF_SCHEME.c
index 38ba49e..f847f83 100644
--- a/sysapi/sysapi_util/Marshal_TPMT_KDF_SCHEME.c
+++ b/sysapi/sysapi_util/Marshal_TPMT_KDF_SCHEME.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMT_KDF_SCHEME(
diff --git a/sysapi/sysapi_util/Marshal_TPMT_KEYEDHASH_SCHEME.c b/sysapi/sysapi_util/Marshal_TPMT_KEYEDHASH_SCHEME.c
index dd1ea5a..5c7dc7a 100644
--- a/sysapi/sysapi_util/Marshal_TPMT_KEYEDHASH_SCHEME.c
+++ b/sysapi/sysapi_util/Marshal_TPMT_KEYEDHASH_SCHEME.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMT_KEYEDHASH_SCHEME(
diff --git a/sysapi/sysapi_util/Marshal_TPMT_PUBLIC.c b/sysapi/sysapi_util/Marshal_TPMT_PUBLIC.c
index 99c0f39..71f9ed1 100644
--- a/sysapi/sysapi_util/Marshal_TPMT_PUBLIC.c
+++ b/sysapi/sysapi_util/Marshal_TPMT_PUBLIC.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMT_PUBLIC(
diff --git a/sysapi/sysapi_util/Marshal_TPMT_PUBLIC_PARMS.c b/sysapi/sysapi_util/Marshal_TPMT_PUBLIC_PARMS.c
index 538144e..426fac7 100644
--- a/sysapi/sysapi_util/Marshal_TPMT_PUBLIC_PARMS.c
+++ b/sysapi/sysapi_util/Marshal_TPMT_PUBLIC_PARMS.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMT_PUBLIC_PARMS(
diff --git a/sysapi/sysapi_util/Marshal_TPMT_RSA_DECRYPT.c b/sysapi/sysapi_util/Marshal_TPMT_RSA_DECRYPT.c
index 7f4aaa6..3add334 100644
--- a/sysapi/sysapi_util/Marshal_TPMT_RSA_DECRYPT.c
+++ b/sysapi/sysapi_util/Marshal_TPMT_RSA_DECRYPT.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMT_RSA_DECRYPT(
diff --git a/sysapi/sysapi_util/Marshal_TPMT_RSA_SCHEME.c b/sysapi/sysapi_util/Marshal_TPMT_RSA_SCHEME.c
index 279ecc1..9f8588a 100644
--- a/sysapi/sysapi_util/Marshal_TPMT_RSA_SCHEME.c
+++ b/sysapi/sysapi_util/Marshal_TPMT_RSA_SCHEME.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMT_RSA_SCHEME(
diff --git a/sysapi/sysapi_util/Marshal_TPMT_SENSITIVE.c b/sysapi/sysapi_util/Marshal_TPMT_SENSITIVE.c
index ab641d9..f5e27dd 100644
--- a/sysapi/sysapi_util/Marshal_TPMT_SENSITIVE.c
+++ b/sysapi/sysapi_util/Marshal_TPMT_SENSITIVE.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMT_SENSITIVE(
diff --git a/sysapi/sysapi_util/Marshal_TPMT_SIGNATURE.c b/sysapi/sysapi_util/Marshal_TPMT_SIGNATURE.c
index 956d0d9..0209b06 100644
--- a/sysapi/sysapi_util/Marshal_TPMT_SIGNATURE.c
+++ b/sysapi/sysapi_util/Marshal_TPMT_SIGNATURE.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMT_SIGNATURE(
diff --git a/sysapi/sysapi_util/Marshal_TPMT_SIG_SCHEME.c b/sysapi/sysapi_util/Marshal_TPMT_SIG_SCHEME.c
index 5f3a0a9..d47def6 100644
--- a/sysapi/sysapi_util/Marshal_TPMT_SIG_SCHEME.c
+++ b/sysapi/sysapi_util/Marshal_TPMT_SIG_SCHEME.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMT_SIG_SCHEME(
diff --git a/sysapi/sysapi_util/Marshal_TPMT_SYM_DEF.c b/sysapi/sysapi_util/Marshal_TPMT_SYM_DEF.c
index 1751c8f..69a1fb4 100644
--- a/sysapi/sysapi_util/Marshal_TPMT_SYM_DEF.c
+++ b/sysapi/sysapi_util/Marshal_TPMT_SYM_DEF.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMT_SYM_DEF(
diff --git a/sysapi/sysapi_util/Marshal_TPMT_SYM_DEF_OBJECT.c b/sysapi/sysapi_util/Marshal_TPMT_SYM_DEF_OBJECT.c
index e2c57fa..1c717a3 100644
--- a/sysapi/sysapi_util/Marshal_TPMT_SYM_DEF_OBJECT.c
+++ b/sysapi/sysapi_util/Marshal_TPMT_SYM_DEF_OBJECT.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMT_SYM_DEF_OBJECT(
diff --git a/sysapi/sysapi_util/Marshal_TPMT_TK_AUTH.c b/sysapi/sysapi_util/Marshal_TPMT_TK_AUTH.c
index 37d7b6d..644cac6 100644
--- a/sysapi/sysapi_util/Marshal_TPMT_TK_AUTH.c
+++ b/sysapi/sysapi_util/Marshal_TPMT_TK_AUTH.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMT_TK_AUTH(
diff --git a/sysapi/sysapi_util/Marshal_TPMT_TK_CREATION.c b/sysapi/sysapi_util/Marshal_TPMT_TK_CREATION.c
index cbb829f..86447d5 100644
--- a/sysapi/sysapi_util/Marshal_TPMT_TK_CREATION.c
+++ b/sysapi/sysapi_util/Marshal_TPMT_TK_CREATION.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMT_TK_CREATION(
diff --git a/sysapi/sysapi_util/Marshal_TPMT_TK_HASHCHECK.c b/sysapi/sysapi_util/Marshal_TPMT_TK_HASHCHECK.c
index c2b0c22..e874130 100644
--- a/sysapi/sysapi_util/Marshal_TPMT_TK_HASHCHECK.c
+++ b/sysapi/sysapi_util/Marshal_TPMT_TK_HASHCHECK.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMT_TK_HASHCHECK(
diff --git a/sysapi/sysapi_util/Marshal_TPMT_TK_VERIFIED.c b/sysapi/sysapi_util/Marshal_TPMT_TK_VERIFIED.c
index 59a0ad5..4e08264 100644
--- a/sysapi/sysapi_util/Marshal_TPMT_TK_VERIFIED.c
+++ b/sysapi/sysapi_util/Marshal_TPMT_TK_VERIFIED.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMT_TK_VERIFIED(
diff --git a/sysapi/sysapi_util/Marshal_TPMU_ASYM_SCHEME.c b/sysapi/sysapi_util/Marshal_TPMU_ASYM_SCHEME.c
index e964f29..bd2444a 100644
--- a/sysapi/sysapi_util/Marshal_TPMU_ASYM_SCHEME.c
+++ b/sysapi/sysapi_util/Marshal_TPMU_ASYM_SCHEME.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMU_ASYM_SCHEME(
diff --git a/sysapi/sysapi_util/Marshal_TPMU_HA.c b/sysapi/sysapi_util/Marshal_TPMU_HA.c
index 0cd479a..ce2a4ff 100644
--- a/sysapi/sysapi_util/Marshal_TPMU_HA.c
+++ b/sysapi/sysapi_util/Marshal_TPMU_HA.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMU_HA(
diff --git a/sysapi/sysapi_util/Marshal_TPMU_KDF_SCHEME.c b/sysapi/sysapi_util/Marshal_TPMU_KDF_SCHEME.c
index 4f89081..3492f22 100644
--- a/sysapi/sysapi_util/Marshal_TPMU_KDF_SCHEME.c
+++ b/sysapi/sysapi_util/Marshal_TPMU_KDF_SCHEME.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMU_KDF_SCHEME(
diff --git a/sysapi/sysapi_util/Marshal_TPMU_PUBLIC_ID.c b/sysapi/sysapi_util/Marshal_TPMU_PUBLIC_ID.c
index 2710aa6..3e425bf 100644
--- a/sysapi/sysapi_util/Marshal_TPMU_PUBLIC_ID.c
+++ b/sysapi/sysapi_util/Marshal_TPMU_PUBLIC_ID.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMU_PUBLIC_ID(
diff --git a/sysapi/sysapi_util/Marshal_TPMU_PUBLIC_PARMS.c b/sysapi/sysapi_util/Marshal_TPMU_PUBLIC_PARMS.c
index 5cd3190..6828519 100644
--- a/sysapi/sysapi_util/Marshal_TPMU_PUBLIC_PARMS.c
+++ b/sysapi/sysapi_util/Marshal_TPMU_PUBLIC_PARMS.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMU_PUBLIC_PARMS(
diff --git a/sysapi/sysapi_util/Marshal_TPMU_SCHEME_KEYEDHASH.c b/sysapi/sysapi_util/Marshal_TPMU_SCHEME_KEYEDHASH.c
index 8ed05bd..decc8c9 100644
--- a/sysapi/sysapi_util/Marshal_TPMU_SCHEME_KEYEDHASH.c
+++ b/sysapi/sysapi_util/Marshal_TPMU_SCHEME_KEYEDHASH.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMU_SCHEME_KEYEDHASH(
diff --git a/sysapi/sysapi_util/Marshal_TPMU_SENSITIVE_COMPOSITE.c b/sysapi/sysapi_util/Marshal_TPMU_SENSITIVE_COMPOSITE.c
index 3cc4239..83f6089 100644
--- a/sysapi/sysapi_util/Marshal_TPMU_SENSITIVE_COMPOSITE.c
+++ b/sysapi/sysapi_util/Marshal_TPMU_SENSITIVE_COMPOSITE.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMU_SENSITIVE_COMPOSITE(
diff --git a/sysapi/sysapi_util/Marshal_TPMU_SIGNATURE.c b/sysapi/sysapi_util/Marshal_TPMU_SIGNATURE.c
index 5ab3afe..bbd4a87 100644
--- a/sysapi/sysapi_util/Marshal_TPMU_SIGNATURE.c
+++ b/sysapi/sysapi_util/Marshal_TPMU_SIGNATURE.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMU_SIGNATURE(
diff --git a/sysapi/sysapi_util/Marshal_TPMU_SIG_SCHEME.c b/sysapi/sysapi_util/Marshal_TPMU_SIG_SCHEME.c
index 32e87ec..0ed0c73 100644
--- a/sysapi/sysapi_util/Marshal_TPMU_SIG_SCHEME.c
+++ b/sysapi/sysapi_util/Marshal_TPMU_SIG_SCHEME.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMU_SIG_SCHEME(
diff --git a/sysapi/sysapi_util/Marshal_TPMU_SYM_KEY_BITS.c b/sysapi/sysapi_util/Marshal_TPMU_SYM_KEY_BITS.c
index 998a17c..e2723c5 100644
--- a/sysapi/sysapi_util/Marshal_TPMU_SYM_KEY_BITS.c
+++ b/sysapi/sysapi_util/Marshal_TPMU_SYM_KEY_BITS.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMU_SYM_KEY_BITS(
diff --git a/sysapi/sysapi_util/Marshal_TPMU_SYM_MODE.c b/sysapi/sysapi_util/Marshal_TPMU_SYM_MODE.c
index b18c26b..7a345d1 100644
--- a/sysapi/sysapi_util/Marshal_TPMU_SYM_MODE.c
+++ b/sysapi/sysapi_util/Marshal_TPMU_SYM_MODE.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_TPMU_SYM_MODE(
diff --git a/sysapi/sysapi_util/Unmarshal_TPM2B_CREATION_DATA.c b/sysapi/sysapi_util/Unmarshal_TPM2B_CREATION_DATA.c
index 09d0bcf..2f02c9d 100644
--- a/sysapi/sysapi_util/Unmarshal_TPM2B_CREATION_DATA.c
+++ b/sysapi/sysapi_util/Unmarshal_TPM2B_CREATION_DATA.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPM2B_CREATION_DATA(
diff --git a/sysapi/sysapi_util/Unmarshal_TPM2B_ECC_POINT.c b/sysapi/sysapi_util/Unmarshal_TPM2B_ECC_POINT.c
index 1290748..035a41e 100644
--- a/sysapi/sysapi_util/Unmarshal_TPM2B_ECC_POINT.c
+++ b/sysapi/sysapi_util/Unmarshal_TPM2B_ECC_POINT.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPM2B_ECC_POINT(
diff --git a/sysapi/sysapi_util/Unmarshal_TPM2B_NV_PUBLIC.c b/sysapi/sysapi_util/Unmarshal_TPM2B_NV_PUBLIC.c
index 3b7f6e0..cd29c91 100644
--- a/sysapi/sysapi_util/Unmarshal_TPM2B_NV_PUBLIC.c
+++ b/sysapi/sysapi_util/Unmarshal_TPM2B_NV_PUBLIC.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPM2B_NV_PUBLIC(
diff --git a/sysapi/sysapi_util/Unmarshal_TPM2B_PUBLIC.c b/sysapi/sysapi_util/Unmarshal_TPM2B_PUBLIC.c
index 0e7d91f..1e3d39e 100644
--- a/sysapi/sysapi_util/Unmarshal_TPM2B_PUBLIC.c
+++ b/sysapi/sysapi_util/Unmarshal_TPM2B_PUBLIC.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPM2B_PUBLIC(
diff --git a/sysapi/sysapi_util/Unmarshal_TPM2B_SENSITIVE.c b/sysapi/sysapi_util/Unmarshal_TPM2B_SENSITIVE.c
index 157bd6c..a444370 100644
--- a/sysapi/sysapi_util/Unmarshal_TPM2B_SENSITIVE.c
+++ b/sysapi/sysapi_util/Unmarshal_TPM2B_SENSITIVE.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPM2B_SENSITIVE(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMA_ALGORITHM.c b/sysapi/sysapi_util/Unmarshal_TPMA_ALGORITHM.c
index 280393c..2ec86d5 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMA_ALGORITHM.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMA_ALGORITHM.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMA_ALGORITHM(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMA_CC.c b/sysapi/sysapi_util/Unmarshal_TPMA_CC.c
index e1f67a4..4f86219 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMA_CC.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMA_CC.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMA_CC(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMA_LOCALITY.c b/sysapi/sysapi_util/Unmarshal_TPMA_LOCALITY.c
index 7567d65..a194ea0 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMA_LOCALITY.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMA_LOCALITY.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMA_LOCALITY(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMA_NV.c b/sysapi/sysapi_util/Unmarshal_TPMA_NV.c
index 83b1d12..9ea8364 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMA_NV.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMA_NV.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMA_NV(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMA_OBJECT.c b/sysapi/sysapi_util/Unmarshal_TPMA_OBJECT.c
index 2480b6f..6117598 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMA_OBJECT.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMA_OBJECT.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMA_OBJECT(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMA_PERMANENT.c b/sysapi/sysapi_util/Unmarshal_TPMA_PERMANENT.c
index 1bea4f1..3e9b7f4 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMA_PERMANENT.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMA_PERMANENT.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMA_PERMANENT(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMA_SESSION.c b/sysapi/sysapi_util/Unmarshal_TPMA_SESSION.c
index 0afcf10..12210c7 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMA_SESSION.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMA_SESSION.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMA_SESSION(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMA_STARTUP_CLEAR.c b/sysapi/sysapi_util/Unmarshal_TPMA_STARTUP_CLEAR.c
index 7e2ab50..7408544 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMA_STARTUP_CLEAR.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMA_STARTUP_CLEAR.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMA_STARTUP_CLEAR(
diff --git a/sysapi/sysapi_util/Unmarshal_TPML_ALG.c b/sysapi/sysapi_util/Unmarshal_TPML_ALG.c
index 87c3979..2597711 100644
--- a/sysapi/sysapi_util/Unmarshal_TPML_ALG.c
+++ b/sysapi/sysapi_util/Unmarshal_TPML_ALG.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPML_ALG(
diff --git a/sysapi/sysapi_util/Unmarshal_TPML_ALG_PROPERTY.c b/sysapi/sysapi_util/Unmarshal_TPML_ALG_PROPERTY.c
index 1abc3c3..2ec41c6 100644
--- a/sysapi/sysapi_util/Unmarshal_TPML_ALG_PROPERTY.c
+++ b/sysapi/sysapi_util/Unmarshal_TPML_ALG_PROPERTY.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPML_ALG_PROPERTY(
diff --git a/sysapi/sysapi_util/Unmarshal_TPML_CC.c b/sysapi/sysapi_util/Unmarshal_TPML_CC.c
index fe0ba26..da0ddca 100644
--- a/sysapi/sysapi_util/Unmarshal_TPML_CC.c
+++ b/sysapi/sysapi_util/Unmarshal_TPML_CC.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPML_CC(
diff --git a/sysapi/sysapi_util/Unmarshal_TPML_CCA.c b/sysapi/sysapi_util/Unmarshal_TPML_CCA.c
index b0fdaec..e9b5c8b 100644
--- a/sysapi/sysapi_util/Unmarshal_TPML_CCA.c
+++ b/sysapi/sysapi_util/Unmarshal_TPML_CCA.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPML_CCA(
diff --git a/sysapi/sysapi_util/Unmarshal_TPML_DIGEST.c b/sysapi/sysapi_util/Unmarshal_TPML_DIGEST.c
index 63412a5..645348d 100644
--- a/sysapi/sysapi_util/Unmarshal_TPML_DIGEST.c
+++ b/sysapi/sysapi_util/Unmarshal_TPML_DIGEST.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPML_DIGEST(
diff --git a/sysapi/sysapi_util/Unmarshal_TPML_DIGEST_VALUES.c b/sysapi/sysapi_util/Unmarshal_TPML_DIGEST_VALUES.c
index 05e0e1e..85eba6a 100644
--- a/sysapi/sysapi_util/Unmarshal_TPML_DIGEST_VALUES.c
+++ b/sysapi/sysapi_util/Unmarshal_TPML_DIGEST_VALUES.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPML_DIGEST_VALUES(
diff --git a/sysapi/sysapi_util/Unmarshal_TPML_ECC_CURVE.c b/sysapi/sysapi_util/Unmarshal_TPML_ECC_CURVE.c
index 0769f93..3f04564 100644
--- a/sysapi/sysapi_util/Unmarshal_TPML_ECC_CURVE.c
+++ b/sysapi/sysapi_util/Unmarshal_TPML_ECC_CURVE.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPML_ECC_CURVE(
diff --git a/sysapi/sysapi_util/Unmarshal_TPML_HANDLE.c b/sysapi/sysapi_util/Unmarshal_TPML_HANDLE.c
index 4b10cda..3695e19 100644
--- a/sysapi/sysapi_util/Unmarshal_TPML_HANDLE.c
+++ b/sysapi/sysapi_util/Unmarshal_TPML_HANDLE.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPML_HANDLE(
diff --git a/sysapi/sysapi_util/Unmarshal_TPML_PCR_SELECTION.c b/sysapi/sysapi_util/Unmarshal_TPML_PCR_SELECTION.c
index b28ae1a..1ed9ac3 100644
--- a/sysapi/sysapi_util/Unmarshal_TPML_PCR_SELECTION.c
+++ b/sysapi/sysapi_util/Unmarshal_TPML_PCR_SELECTION.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPML_PCR_SELECTION(
diff --git a/sysapi/sysapi_util/Unmarshal_TPML_TAGGED_PCR_PROPERTY.c b/sysapi/sysapi_util/Unmarshal_TPML_TAGGED_PCR_PROPERTY.c
index e7dd853..40ed692 100644
--- a/sysapi/sysapi_util/Unmarshal_TPML_TAGGED_PCR_PROPERTY.c
+++ b/sysapi/sysapi_util/Unmarshal_TPML_TAGGED_PCR_PROPERTY.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPML_TAGGED_PCR_PROPERTY(
diff --git a/sysapi/sysapi_util/Unmarshal_TPML_TAGGED_TPM_PROPERTY.c b/sysapi/sysapi_util/Unmarshal_TPML_TAGGED_TPM_PROPERTY.c
index 36e49a3..d79c805 100644
--- a/sysapi/sysapi_util/Unmarshal_TPML_TAGGED_TPM_PROPERTY.c
+++ b/sysapi/sysapi_util/Unmarshal_TPML_TAGGED_TPM_PROPERTY.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPML_TAGGED_TPM_PROPERTY(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_ALGORITHM_DESCRIPTION.c b/sysapi/sysapi_util/Unmarshal_TPMS_ALGORITHM_DESCRIPTION.c
index 2aaf9d8..8003a53 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_ALGORITHM_DESCRIPTION.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_ALGORITHM_DESCRIPTION.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_ALGORITHM_DESCRIPTION(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_ALGORITHM_DETAIL_ECC.c b/sysapi/sysapi_util/Unmarshal_TPMS_ALGORITHM_DETAIL_ECC.c
index a3807b8..782fba4 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_ALGORITHM_DETAIL_ECC.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_ALGORITHM_DETAIL_ECC.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_ALGORITHM_DETAIL_ECC(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_ALG_PROPERTY.c b/sysapi/sysapi_util/Unmarshal_TPMS_ALG_PROPERTY.c
index 7e04466..fd6f258 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_ALG_PROPERTY.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_ALG_PROPERTY.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_ALG_PROPERTY(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_ATTEST.c b/sysapi/sysapi_util/Unmarshal_TPMS_ATTEST.c
index 02d3470..c5893d7 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_ATTEST.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_ATTEST.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_ATTEST(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_AUTH_RESPONSE.c b/sysapi/sysapi_util/Unmarshal_TPMS_AUTH_RESPONSE.c
index 993e46e..206558b 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_AUTH_RESPONSE.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_AUTH_RESPONSE.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_AUTH_RESPONSE(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_CAPABILITY_DATA.c b/sysapi/sysapi_util/Unmarshal_TPMS_CAPABILITY_DATA.c
index e13600f..2081a13 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_CAPABILITY_DATA.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_CAPABILITY_DATA.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_CAPABILITY_DATA(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_CERTIFY_INFO.c b/sysapi/sysapi_util/Unmarshal_TPMS_CERTIFY_INFO.c
index fc78e74..cab2032 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_CERTIFY_INFO.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_CERTIFY_INFO.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_CERTIFY_INFO(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_CLOCK_INFO.c b/sysapi/sysapi_util/Unmarshal_TPMS_CLOCK_INFO.c
index b77c595..ab0a74c 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_CLOCK_INFO.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_CLOCK_INFO.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_CLOCK_INFO(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_COMMAND_AUDIT_INFO.c b/sysapi/sysapi_util/Unmarshal_TPMS_COMMAND_AUDIT_INFO.c
index c33de99..a61644e 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_COMMAND_AUDIT_INFO.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_COMMAND_AUDIT_INFO.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_COMMAND_AUDIT_INFO(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_CONTEXT.c b/sysapi/sysapi_util/Unmarshal_TPMS_CONTEXT.c
index 9102e4f..244c311 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_CONTEXT.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_CONTEXT.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_CONTEXT(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_CONTEXT_DATA.c b/sysapi/sysapi_util/Unmarshal_TPMS_CONTEXT_DATA.c
index 7b04769..e27242c 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_CONTEXT_DATA.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_CONTEXT_DATA.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_CONTEXT_DATA(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_CREATION_DATA.c b/sysapi/sysapi_util/Unmarshal_TPMS_CREATION_DATA.c
index 0f90dbc..b6cbccc 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_CREATION_DATA.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_CREATION_DATA.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_CREATION_DATA(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_CREATION_INFO.c b/sysapi/sysapi_util/Unmarshal_TPMS_CREATION_INFO.c
index 93c6cf6..3a71cae 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_CREATION_INFO.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_CREATION_INFO.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_CREATION_INFO(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_ECC_PARMS.c b/sysapi/sysapi_util/Unmarshal_TPMS_ECC_PARMS.c
index 0deda59..5c69363 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_ECC_PARMS.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_ECC_PARMS.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_ECC_PARMS(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_ECC_POINT.c b/sysapi/sysapi_util/Unmarshal_TPMS_ECC_POINT.c
index 63bee28..4f04c72 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_ECC_POINT.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_ECC_POINT.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_ECC_POINT(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_EMPTY.c b/sysapi/sysapi_util/Unmarshal_TPMS_EMPTY.c
index cbcd3a4..ea7730a 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_EMPTY.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_EMPTY.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_EMPTY(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_KEYEDHASH_PARMS.c b/sysapi/sysapi_util/Unmarshal_TPMS_KEYEDHASH_PARMS.c
index 25b44c3..9bd1fa3 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_KEYEDHASH_PARMS.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_KEYEDHASH_PARMS.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_KEYEDHASH_PARMS(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_NV_CERTIFY_INFO.c b/sysapi/sysapi_util/Unmarshal_TPMS_NV_CERTIFY_INFO.c
index d700c78..735b630 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_NV_CERTIFY_INFO.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_NV_CERTIFY_INFO.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_NV_CERTIFY_INFO(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_NV_PIN_COUNTER_PARAMETERS.c b/sysapi/sysapi_util/Unmarshal_TPMS_NV_PIN_COUNTER_PARAMETERS.c
index bc779b3..60f9125 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_NV_PIN_COUNTER_PARAMETERS.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_NV_PIN_COUNTER_PARAMETERS.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_NV_PIN_COUNTER_PARAMETERS(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_NV_PUBLIC.c b/sysapi/sysapi_util/Unmarshal_TPMS_NV_PUBLIC.c
index 2e12cd6..1a34247 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_NV_PUBLIC.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_NV_PUBLIC.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_NV_PUBLIC(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_PCR_SELECT.c b/sysapi/sysapi_util/Unmarshal_TPMS_PCR_SELECT.c
index 4c9d782..ec99698 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_PCR_SELECT.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_PCR_SELECT.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_PCR_SELECT(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_PCR_SELECTION.c b/sysapi/sysapi_util/Unmarshal_TPMS_PCR_SELECTION.c
index d9f16e6..10232a2 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_PCR_SELECTION.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_PCR_SELECTION.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_PCR_SELECTION(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_QUOTE_INFO.c b/sysapi/sysapi_util/Unmarshal_TPMS_QUOTE_INFO.c
index fb573e1..9c5ae44 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_QUOTE_INFO.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_QUOTE_INFO.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_QUOTE_INFO(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_RSA_PARMS.c b/sysapi/sysapi_util/Unmarshal_TPMS_RSA_PARMS.c
index f64ab00..9105435 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_RSA_PARMS.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_RSA_PARMS.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_RSA_PARMS(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_SCHEME_ECDAA.c b/sysapi/sysapi_util/Unmarshal_TPMS_SCHEME_ECDAA.c
index 783f05e..070f087 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_SCHEME_ECDAA.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_SCHEME_ECDAA.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_SCHEME_ECDAA(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_SCHEME_HASH.c b/sysapi/sysapi_util/Unmarshal_TPMS_SCHEME_HASH.c
index 828b73c..155ecf8 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_SCHEME_HASH.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_SCHEME_HASH.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_SCHEME_HASH(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_SCHEME_XOR.c b/sysapi/sysapi_util/Unmarshal_TPMS_SCHEME_XOR.c
index 4693ba0..c268270 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_SCHEME_XOR.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_SCHEME_XOR.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_SCHEME_XOR(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_SESSION_AUDIT_INFO.c b/sysapi/sysapi_util/Unmarshal_TPMS_SESSION_AUDIT_INFO.c
index 3686d75..671d0f6 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_SESSION_AUDIT_INFO.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_SESSION_AUDIT_INFO.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_SESSION_AUDIT_INFO(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_SIGNATURE_ECC.c b/sysapi/sysapi_util/Unmarshal_TPMS_SIGNATURE_ECC.c
index bf7862c..bc0c8bf 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_SIGNATURE_ECC.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_SIGNATURE_ECC.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_SIGNATURE_ECC(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_SIGNATURE_RSA.c b/sysapi/sysapi_util/Unmarshal_TPMS_SIGNATURE_RSA.c
index 1d8c888..95486c2 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_SIGNATURE_RSA.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_SIGNATURE_RSA.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_SIGNATURE_RSA(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_SYMCIPHER_PARMS.c b/sysapi/sysapi_util/Unmarshal_TPMS_SYMCIPHER_PARMS.c
index c4a106e..6c7fbc7 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_SYMCIPHER_PARMS.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_SYMCIPHER_PARMS.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_SYMCIPHER_PARMS(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_TAGGED_PCR_SELECT.c b/sysapi/sysapi_util/Unmarshal_TPMS_TAGGED_PCR_SELECT.c
index 210671a..523ee41 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_TAGGED_PCR_SELECT.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_TAGGED_PCR_SELECT.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_TAGGED_PCR_SELECT(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_TAGGED_PROPERTY.c b/sysapi/sysapi_util/Unmarshal_TPMS_TAGGED_PROPERTY.c
index 534950d..5068a73 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_TAGGED_PROPERTY.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_TAGGED_PROPERTY.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_TAGGED_PROPERTY(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_TIME_ATTEST_INFO.c b/sysapi/sysapi_util/Unmarshal_TPMS_TIME_ATTEST_INFO.c
index 4a16e14..7976c74 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_TIME_ATTEST_INFO.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_TIME_ATTEST_INFO.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_TIME_ATTEST_INFO(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMS_TIME_INFO.c b/sysapi/sysapi_util/Unmarshal_TPMS_TIME_INFO.c
index ac9dbef..326e212 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMS_TIME_INFO.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMS_TIME_INFO.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMS_TIME_INFO(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMT_ECC_SCHEME.c b/sysapi/sysapi_util/Unmarshal_TPMT_ECC_SCHEME.c
index ff94267..28c6b78 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMT_ECC_SCHEME.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMT_ECC_SCHEME.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMT_ECC_SCHEME(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMT_HA.c b/sysapi/sysapi_util/Unmarshal_TPMT_HA.c
index 3884b81..2508ff3 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMT_HA.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMT_HA.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMT_HA(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMT_KDF_SCHEME.c b/sysapi/sysapi_util/Unmarshal_TPMT_KDF_SCHEME.c
index d6fab22..4e86f20 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMT_KDF_SCHEME.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMT_KDF_SCHEME.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMT_KDF_SCHEME(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMT_KEYEDHASH_SCHEME.c b/sysapi/sysapi_util/Unmarshal_TPMT_KEYEDHASH_SCHEME.c
index 9184a0f..866cac8 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMT_KEYEDHASH_SCHEME.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMT_KEYEDHASH_SCHEME.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMT_KEYEDHASH_SCHEME(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMT_PUBLIC.c b/sysapi/sysapi_util/Unmarshal_TPMT_PUBLIC.c
index f7f02c1..fe24b5d 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMT_PUBLIC.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMT_PUBLIC.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMT_PUBLIC(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMT_PUBLIC_PARMS.c b/sysapi/sysapi_util/Unmarshal_TPMT_PUBLIC_PARMS.c
index 338c07c..8831ca8 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMT_PUBLIC_PARMS.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMT_PUBLIC_PARMS.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMT_PUBLIC_PARMS(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMT_RSA_DECRYPT.c b/sysapi/sysapi_util/Unmarshal_TPMT_RSA_DECRYPT.c
index 51bf85b..3f293cb 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMT_RSA_DECRYPT.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMT_RSA_DECRYPT.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMT_RSA_DECRYPT(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMT_RSA_SCHEME.c b/sysapi/sysapi_util/Unmarshal_TPMT_RSA_SCHEME.c
index 7fac90a..77a926e 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMT_RSA_SCHEME.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMT_RSA_SCHEME.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMT_RSA_SCHEME(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMT_SENSITIVE.c b/sysapi/sysapi_util/Unmarshal_TPMT_SENSITIVE.c
index f39600c..206e3d1 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMT_SENSITIVE.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMT_SENSITIVE.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMT_SENSITIVE(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMT_SIGNATURE.c b/sysapi/sysapi_util/Unmarshal_TPMT_SIGNATURE.c
index b398146..a106435 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMT_SIGNATURE.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMT_SIGNATURE.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMT_SIGNATURE(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMT_SIG_SCHEME.c b/sysapi/sysapi_util/Unmarshal_TPMT_SIG_SCHEME.c
index 7f0880e..c6ffcc2 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMT_SIG_SCHEME.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMT_SIG_SCHEME.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMT_SIG_SCHEME(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMT_SYM_DEF.c b/sysapi/sysapi_util/Unmarshal_TPMT_SYM_DEF.c
index 5846a3f..d5ed575 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMT_SYM_DEF.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMT_SYM_DEF.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMT_SYM_DEF(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMT_SYM_DEF_OBJECT.c b/sysapi/sysapi_util/Unmarshal_TPMT_SYM_DEF_OBJECT.c
index 03cdab9..e292aa3 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMT_SYM_DEF_OBJECT.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMT_SYM_DEF_OBJECT.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMT_SYM_DEF_OBJECT(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMT_TK_AUTH.c b/sysapi/sysapi_util/Unmarshal_TPMT_TK_AUTH.c
index 30df0ed..2837c7e 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMT_TK_AUTH.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMT_TK_AUTH.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMT_TK_AUTH(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMT_TK_CREATION.c b/sysapi/sysapi_util/Unmarshal_TPMT_TK_CREATION.c
index b7c3e0a..416df94 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMT_TK_CREATION.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMT_TK_CREATION.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMT_TK_CREATION(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMT_TK_HASHCHECK.c b/sysapi/sysapi_util/Unmarshal_TPMT_TK_HASHCHECK.c
index 7aa3552..53abe6f 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMT_TK_HASHCHECK.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMT_TK_HASHCHECK.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMT_TK_HASHCHECK(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMT_TK_VERIFIED.c b/sysapi/sysapi_util/Unmarshal_TPMT_TK_VERIFIED.c
index 6df8705..088fab1 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMT_TK_VERIFIED.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMT_TK_VERIFIED.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMT_TK_VERIFIED(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMU_ASYM_SCHEME.c b/sysapi/sysapi_util/Unmarshal_TPMU_ASYM_SCHEME.c
index be0c455..4b4a216 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMU_ASYM_SCHEME.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMU_ASYM_SCHEME.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMU_ASYM_SCHEME(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMU_ATTEST.c b/sysapi/sysapi_util/Unmarshal_TPMU_ATTEST.c
index f3ea0d7..3711e02 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMU_ATTEST.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMU_ATTEST.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMU_ATTEST(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMU_CAPABILITIES.c b/sysapi/sysapi_util/Unmarshal_TPMU_CAPABILITIES.c
index 3446f45..38b633b 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMU_CAPABILITIES.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMU_CAPABILITIES.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMU_CAPABILITIES(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMU_HA.c b/sysapi/sysapi_util/Unmarshal_TPMU_HA.c
index 5d2174c..2b4b902 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMU_HA.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMU_HA.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMU_HA(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMU_KDF_SCHEME.c b/sysapi/sysapi_util/Unmarshal_TPMU_KDF_SCHEME.c
index a4b6a79..c5c56cb 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMU_KDF_SCHEME.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMU_KDF_SCHEME.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMU_KDF_SCHEME(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMU_PUBLIC_ID.c b/sysapi/sysapi_util/Unmarshal_TPMU_PUBLIC_ID.c
index 47c6697..6c85e23 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMU_PUBLIC_ID.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMU_PUBLIC_ID.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMU_PUBLIC_ID(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMU_PUBLIC_PARMS.c b/sysapi/sysapi_util/Unmarshal_TPMU_PUBLIC_PARMS.c
index fce0696..dde22f9 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMU_PUBLIC_PARMS.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMU_PUBLIC_PARMS.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMU_PUBLIC_PARMS(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMU_SCHEME_KEYEDHASH.c b/sysapi/sysapi_util/Unmarshal_TPMU_SCHEME_KEYEDHASH.c
index 3bb79bb..8e5e8de 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMU_SCHEME_KEYEDHASH.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMU_SCHEME_KEYEDHASH.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMU_SCHEME_KEYEDHASH(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMU_SENSITIVE_COMPOSITE.c b/sysapi/sysapi_util/Unmarshal_TPMU_SENSITIVE_COMPOSITE.c
index 4616c4d..8f6f3ee 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMU_SENSITIVE_COMPOSITE.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMU_SENSITIVE_COMPOSITE.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMU_SENSITIVE_COMPOSITE(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMU_SIGNATURE.c b/sysapi/sysapi_util/Unmarshal_TPMU_SIGNATURE.c
index 3c9ed9c..1255c08 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMU_SIGNATURE.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMU_SIGNATURE.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMU_SIGNATURE(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMU_SIG_SCHEME.c b/sysapi/sysapi_util/Unmarshal_TPMU_SIG_SCHEME.c
index 048368a..e758efd 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMU_SIG_SCHEME.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMU_SIG_SCHEME.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMU_SIG_SCHEME(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMU_SYM_KEY_BITS.c b/sysapi/sysapi_util/Unmarshal_TPMU_SYM_KEY_BITS.c
index 5372604..ef5ae3e 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMU_SYM_KEY_BITS.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMU_SYM_KEY_BITS.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMU_SYM_KEY_BITS(
diff --git a/sysapi/sysapi_util/Unmarshal_TPMU_SYM_MODE.c b/sysapi/sysapi_util/Unmarshal_TPMU_SYM_MODE.c
index 1f1c61e..09570b7 100644
--- a/sysapi/sysapi_util/Unmarshal_TPMU_SYM_MODE.c
+++ b/sysapi/sysapi_util/Unmarshal_TPMU_SYM_MODE.c
@@ -25,7 +25,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  ***********************************************************************/
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_TPMU_SYM_MODE(
diff --git a/sysapi/sysapi_util/changeEndian.c b/sysapi/sysapi_util/changeEndian.c
index 372e66f..4c30af7 100644
--- a/sysapi/sysapi_util/changeEndian.c
+++ b/sysapi/sysapi_util/changeEndian.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 UINT64 ChangeEndianQword( UINT64 p )
diff --git a/sysapi/sysapi_util/copymem.c b/sysapi/sysapi_util/copymem.c
index e5252d3..be5abcf 100644
--- a/sysapi/sysapi_util/copymem.c
+++ b/sysapi/sysapi_util/copymem.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 
 TSS2_RC CopyMem( UINT8 *dest, const UINT8 *src, const size_t len, const UINT8 *limit )
 {
diff --git a/sysapi/sysapi_util/marshal_simple_tpm2b.c b/sysapi/sysapi_util/marshal_simple_tpm2b.c
index 45875e7..28c827a 100644
--- a/sysapi/sysapi_util/marshal_simple_tpm2b.c
+++ b/sysapi/sysapi_util/marshal_simple_tpm2b.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Marshal_Simple_TPM2B( UINT8 *inBuffPtr, UINT32 maxCommandSize, UINT8 **nextData, TPM2B *value, TSS2_RC *rval )
diff --git a/sysapi/sysapi_util/marshal_uint16.c b/sysapi/sysapi_util/marshal_uint16.c
deleted file mode 100644
index f85e82a..0000000
--- a/sysapi/sysapi_util/marshal_uint16.c
+++ /dev/null
@@ -1,47 +0,0 @@
-//**********************************************************************;
-// Copyright (c) 2015, 2016 Intel Corporation
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice,
-// this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
-//**********************************************************************;
-
-#include <sapi/tpm20.h>
-#include "sysapi_util.h"
-
-void Marshal_UINT16( UINT8 *inBuffPtr, UINT32 maxCommandSize, UINT8 **nextData, UINT16 value, TSS2_RC *rval )
-{
-    if( *rval != TSS2_RC_SUCCESS )
-        return;
-
-    *rval = CheckDataPointers( inBuffPtr, nextData );
-    if( *rval != TSS2_RC_SUCCESS )
-        return;
-
-    *rval = CheckOverflow( inBuffPtr, maxCommandSize, *nextData, sizeof(UINT16) );
-    if( *rval != TSS2_RC_SUCCESS )
-        return;
-
-    *( (UINT16 *)*nextData ) = CHANGE_ENDIAN_WORD( value );
-    *nextData = *nextData + sizeof( UINT16 );
-}
-
diff --git a/sysapi/sysapi_util/marshal_uint32.c b/sysapi/sysapi_util/marshal_uint32.c
deleted file mode 100644
index bb0ce04..0000000
--- a/sysapi/sysapi_util/marshal_uint32.c
+++ /dev/null
@@ -1,46 +0,0 @@
-//**********************************************************************;
-// Copyright (c) 2015, 2016 Intel Corporation
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice,
-// this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
-//**********************************************************************;
-
-#include <sapi/tpm20.h>
-#include "sysapi_util.h"
-
-void Marshal_UINT32( UINT8 *inBuffPtr, UINT32 maxCommandSize, UINT8 **nextData, UINT32 value, TSS2_RC *rval )
-{
-    if( *rval != TSS2_RC_SUCCESS )
-        return;
-
-    *rval = CheckDataPointers( inBuffPtr, nextData );
-    if( *rval != TSS2_RC_SUCCESS )
-        return;
-
-    *rval = CheckOverflow( inBuffPtr, maxCommandSize, *nextData, sizeof(UINT32) );
-    if( *rval != TSS2_RC_SUCCESS )
-        return;
-
-    *( (UINT32 *)*nextData ) = CHANGE_ENDIAN_DWORD( value );
-    *nextData = *nextData + sizeof( UINT32 );
-}
diff --git a/sysapi/sysapi_util/marshal_uint64.c b/sysapi/sysapi_util/marshal_uint64.c
deleted file mode 100644
index 80090fd..0000000
--- a/sysapi/sysapi_util/marshal_uint64.c
+++ /dev/null
@@ -1,46 +0,0 @@
-//**********************************************************************;
-// Copyright (c) 2015, 2016 Intel Corporation
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice,
-// this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
-//**********************************************************************;
-
-#include <sapi/tpm20.h>
-#include "sysapi_util.h"
-
-void Marshal_UINT64( UINT8 *inBuffPtr, UINT32 maxCommandSize, UINT8 **nextData, UINT64 value, TSS2_RC *rval )
-{
-    if( *rval != TSS2_RC_SUCCESS )
-        return;
-
-    *rval = CheckDataPointers( inBuffPtr, nextData);
-    if( *rval != TSS2_RC_SUCCESS )
-        return;
-
-    *rval = CheckOverflow( inBuffPtr, maxCommandSize, *nextData, sizeof(UINT64) );
-    if( *rval != TSS2_RC_SUCCESS )
-        return;
-
-    *( (UINT64 *)*nextData ) = CHANGE_ENDIAN_QWORD( value );
-    *nextData = *nextData + sizeof( UINT64 );
-}
diff --git a/sysapi/sysapi_util/marshal_uint8.c b/sysapi/sysapi_util/marshal_uint8.c
deleted file mode 100644
index dbc4cd3..0000000
--- a/sysapi/sysapi_util/marshal_uint8.c
+++ /dev/null
@@ -1,51 +0,0 @@
-//**********************************************************************;
-// Copyright (c) 2015, Intel Corporation
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice,
-// this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
-//**********************************************************************;
-
-#include <sapi/tpm20.h>
-#include "sysapi_util.h"
-
-void Marshal_UINT8( UINT8 *inBuffPtr, UINT32 maxCommandSize, UINT8 **nextData, UINT8 value, TSS2_RC *rval )
-{
-    if( *rval == TSS2_RC_SUCCESS )
-    {
-        if( inBuffPtr == 0 || nextData == 0 || *nextData == 0 )
-        {
-            *rval = TSS2_SYS_RC_BAD_REFERENCE;
-        }
-        else
-        {
-            *rval = CheckOverflow( inBuffPtr, maxCommandSize, *nextData, sizeof(UINT8) );
-
-            if( *rval == TSS2_RC_SUCCESS )
-            {
-                *( (UINT8 *)*nextData ) = value;
-                *nextData = *nextData + sizeof( UINT8 );
-            }
-        }
-    }
-}
-
diff --git a/sysapi/sysapi_util/unmarshal_simple_tpm2b.c b/sysapi/sysapi_util/unmarshal_simple_tpm2b.c
index c2add41..de7cbaf 100644
--- a/sysapi/sysapi_util/unmarshal_simple_tpm2b.c
+++ b/sysapi/sysapi_util/unmarshal_simple_tpm2b.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_Simple_TPM2B( UINT8 *outBuffPtr, UINT32 maxResponseSize, UINT8 **nextData, TPM2B *outTPM2B, TSS2_RC *rval )
diff --git a/sysapi/sysapi_util/unmarshal_simple_tpm2b_no_size_check.c b/sysapi/sysapi_util/unmarshal_simple_tpm2b_no_size_check.c
index 3fe34e5..966afbd 100644
--- a/sysapi/sysapi_util/unmarshal_simple_tpm2b_no_size_check.c
+++ b/sysapi/sysapi_util/unmarshal_simple_tpm2b_no_size_check.c
@@ -24,7 +24,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 void Unmarshal_Simple_TPM2B_NoSizeCheck( UINT8 *outBuffPtr, UINT32 maxResponseSize, UINT8 **nextData, TPM2B *outTPM2B, TSS2_RC *rval )
diff --git a/sysapi/sysapi_util/unmarshal_uint16.c b/sysapi/sysapi_util/unmarshal_uint16.c
deleted file mode 100644
index d1c19c2..0000000
--- a/sysapi/sysapi_util/unmarshal_uint16.c
+++ /dev/null
@@ -1,50 +0,0 @@
-//**********************************************************************;
-// Copyright (c) 2015, 2016 Intel Corporation
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice,
-// this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
-//**********************************************************************;
-
-#include <sapi/tpm20.h>
-#include "sysapi_util.h"
-
-void Unmarshal_UINT16( UINT8 *outBuffPtr, UINT32 maxResponseSize, UINT8 **nextData, UINT16 *value, TSS2_RC *rval )
-{
-    if( *rval != TSS2_RC_SUCCESS )
-        return;
-
-    *rval = CheckDataPointers( outBuffPtr, nextData );
-    if( *rval != TSS2_RC_SUCCESS )
-        return;
-
-    *rval = CheckOverflow( outBuffPtr, maxResponseSize, *nextData, sizeof(UINT16) );
-    if( *rval != TSS2_RC_SUCCESS )
-        return;
-
-    if( value )
-    {
-        *value = CHANGE_ENDIAN_WORD( *(UINT16 *)*nextData );
-    }
-    *nextData = *nextData + sizeof( UINT16 );
-}
-
diff --git a/sysapi/sysapi_util/unmarshal_uint32.c b/sysapi/sysapi_util/unmarshal_uint32.c
deleted file mode 100644
index 54543b9..0000000
--- a/sysapi/sysapi_util/unmarshal_uint32.c
+++ /dev/null
@@ -1,50 +0,0 @@
-//**********************************************************************;
-// Copyright (c) 2015, 2016 Intel Corporation
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice,
-// this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
-//**********************************************************************;
-
-#include <sapi/tpm20.h>
-#include "sysapi_util.h"
-
-void Unmarshal_UINT32( UINT8 *outBuffPtr, UINT32 maxResponseSize, UINT8 **nextData, UINT32 *value, TSS2_RC *rval )
-{
-    if( *rval != TSS2_RC_SUCCESS )
-        return;
-
-    *rval = CheckDataPointers( outBuffPtr, nextData );
-    if( *rval != TSS2_RC_SUCCESS )
-        return;
-
-    *rval = CheckOverflow( outBuffPtr, maxResponseSize, *nextData, sizeof(UINT32) );
-    if( *rval != TSS2_RC_SUCCESS )
-        return;
-
-    if( value )
-    {
-        *value = CHANGE_ENDIAN_DWORD( *(UINT32 *)*nextData );
-    }
-    *nextData = *nextData + sizeof( UINT32 );
-}
-
diff --git a/sysapi/sysapi_util/unmarshal_uint64.c b/sysapi/sysapi_util/unmarshal_uint64.c
deleted file mode 100644
index 0f829ba..0000000
--- a/sysapi/sysapi_util/unmarshal_uint64.c
+++ /dev/null
@@ -1,50 +0,0 @@
-//**********************************************************************;
-// Copyright (c) 2015, 2016 Intel Corporation
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice,
-// this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
-//**********************************************************************;
-
-#include <sapi/tpm20.h>
-#include "sysapi_util.h"
-
-void Unmarshal_UINT64( UINT8 *outBuffPtr, UINT32 maxResponseSize, UINT8 **nextData, UINT64 *value, TSS2_RC *rval )
-{
-    if( *rval != TSS2_RC_SUCCESS )
-        return;
-
-    *rval = CheckDataPointers( outBuffPtr, nextData );
-    if( *rval != TSS2_RC_SUCCESS )
-        return;
-
-    *rval = CheckOverflow( outBuffPtr, maxResponseSize, *nextData, sizeof(UINT64) );
-    if( *rval != TSS2_RC_SUCCESS )
-        return;
-
-    if( value )
-    {
-        *value = CHANGE_ENDIAN_QWORD( *(UINT64 *)*nextData );
-    }
-    *nextData = *nextData + sizeof( UINT64 );
-}
-
diff --git a/sysapi/sysapi_util/unmarshal_uint8.c b/sysapi/sysapi_util/unmarshal_uint8.c
deleted file mode 100644
index cc127d9..0000000
--- a/sysapi/sysapi_util/unmarshal_uint8.c
+++ /dev/null
@@ -1,54 +0,0 @@
-//**********************************************************************;
-// Copyright (c) 2015, Intel Corporation
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice,
-// this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-// THE POSSIBILITY OF SUCH DAMAGE.
-//**********************************************************************;
-
-#include <sapi/tpm20.h>
-#include "sysapi_util.h"
-
-void Unmarshal_UINT8( UINT8 *outBuffPtr, UINT32 maxResponseSize, UINT8 **nextData, UINT8 *value, TSS2_RC *rval )
-{
-    if( *rval == TSS2_RC_SUCCESS )
-    {
-        if( outBuffPtr == 0 || nextData == 0 || *nextData == 0 )
-        {
-            *rval = TSS2_SYS_RC_BAD_REFERENCE;
-        }
-        else
-        {
-            *rval = CheckOverflow( outBuffPtr, maxResponseSize, *nextData, sizeof(UINT8) );
-
-            if( *rval == TSS2_RC_SUCCESS )
-            {
-                if( value )
-                {
-                    *value = **nextData;
-                }
-                *nextData = *nextData + sizeof( UINT8 );
-            }
-        }
-    }
-}
-
diff --git a/tcti/commonchecks.c b/tcti/commonchecks.c
index 450bd64..5084e38 100644
--- a/tcti/commonchecks.c
+++ b/tcti/commonchecks.c
@@ -29,9 +29,9 @@
 #include <stdlib.h>   // Needed for _wtoi
 
 #include <tcti/common.h>
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
-#include "debug.h"
+#include "common/debug.h"
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/tcti/logging.h b/tcti/logging.h
index 96a4e81..da36920 100644
--- a/tcti/logging.h
+++ b/tcti/logging.h
@@ -1,4 +1,4 @@
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 
 #include "tcti_util.h"
 
diff --git a/tcti/platformcommand.c b/tcti/platformcommand.c
index c0654d3..6d9cce1 100644
--- a/tcti/platformcommand.c
+++ b/tcti/platformcommand.c
@@ -41,10 +41,10 @@
 #include <stdio.h>
 #include <stdlib.h>   // Needed for _wtoi
 
-#include <sapi/tpm20.h>
-#include <tcti/tcti_socket.h>
+#include "sapi/tpm20.h"
+#include "tcti/tcti_socket.h"
 #include "sysapi_util.h"
-#include "debug.h"
+#include "common/debug.h"
 #include <sapi/tss2_tcti.h>
 #include "tcti_util.h"
 #include "logging.h"
diff --git a/tcti/tcti_device.c b/tcti/tcti_device.c
index d9135e5..5c9f513 100644
--- a/tcti/tcti_device.c
+++ b/tcti/tcti_device.c
@@ -27,26 +27,19 @@
 
 #include <stdio.h>
 #include <stdlib.h>   // Needed for _wtoi
+#include <unistd.h>
 
-#include <sapi/tpm20.h>
-//#include "resourcemgr.h"
-//#include <sample.h>
-#include "sysapi_util.h"
+#include "sapi/tpm20.h"
+#include "sapi/marshal.h"
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include "debug.h"
+#include "common/debug.h"
 #include "commonchecks.h"
-#include <tcti/tcti_device.h>
+#include "tcti/tcti_device.h"
 #include "logging.h"
 
-#ifdef  _WIN32
-#define ssize_t int
-#elif __linux
-#include <unistd.h>
-#endif
-
 #define HOSTNAME_LENGTH 200
 
 const char *deviceTctiName = "device TCTI";
@@ -76,9 +69,16 @@
             rmPrefix = NO_PREFIX;
 
 #ifdef DEBUG
-        commandCode = CHANGE_ENDIAN_DWORD( ( (TPM20_Header_In *)command_buffer )->commandCode );
-        cnt = CHANGE_ENDIAN_DWORD(((TPM20_Header_In *) command_buffer)->commandSize);
-
+        TSS2_RC rc;
+        size_t offset = sizeof (TPM_ST);
+        rc = TPM_ST_Unmarshal (command_buffer,
+                               command_size,
+                               &offset,
+                               &commandCode);
+        rc = UINT32_Unmarshal (command_buffer,
+                               command_size,
+                               &offset,
+                               &cnt);
         if( ((TSS2_TCTI_CONTEXT_INTEL *)tctiContext )->status.debugMsgEnabled == 1 )
         {
             TCTI_LOG( tctiContext, rmPrefix, "" );
@@ -239,6 +239,8 @@
 {
     TSS2_RC rval = TSS2_RC_SUCCESS;
 
+    if( tctiContext == NULL && contextSize == NULL )
+        return TSS2_TCTI_RC_BAD_VALUE;
     if( tctiContext == NULL )
     {
         *contextSize = sizeof( TSS2_TCTI_CONTEXT_INTEL );
diff --git a/tcti/tcti_socket.cpp b/tcti/tcti_socket.c
similarity index 92%
rename from tcti/tcti_socket.cpp
rename to tcti/tcti_socket.c
index 2e8f98b..d884069 100644
--- a/tcti/tcti_socket.cpp
+++ b/tcti/tcti_socket.c
@@ -27,11 +27,14 @@
 
 #include <stdio.h>
 #include <stdlib.h>   // Needed for _wtoi
+#include <sys/time.h>
 
-#include <sapi/tpm20.h>
-#include <tcti/tcti_socket.h>
+#include "sapi/tpm20.h"
+#include "sapi/marshal.h"
+#include "marshal/base-types.h"
+#include "tcti/tcti_socket.h"
 #include "sysapi_util.h"
-#include "debug.h"
+#include "common/debug.h"
 #include "commonchecks.h"
 #include "logging.h"
 
@@ -74,7 +77,8 @@
     TSS2_TCTI_CONTEXT *tctiContext,       /* in */
     UINT8 tpmCmdServer )
 {
-    UINT32 tpmSendCommand = TPM_SESSION_END;  // Value for "send command" to MS simulator.
+    // Value for "send command" to MS simulator
+    uint8_t buffer [4] = { 0, };
     SOCKET sock;
     TSS2_RC rval = TSS2_RC_SUCCESS;
 
@@ -87,8 +91,11 @@
         sock = TCTI_CONTEXT_INTEL->otherSock;
     }
 
-    tpmSendCommand = CHANGE_ENDIAN_DWORD(tpmSendCommand);
-    rval = tctiSendBytes( tctiContext, sock, (char unsigned *)&tpmSendCommand, 4 );
+    rval = UINT32_Marshal (TPM_SESSION_END, buffer, sizeof (buffer), NULL);
+    if (rval == TSS2_RC_SUCCESS) {
+        return rval;
+    }
+    rval = tctiSendBytes( tctiContext, sock, (char unsigned *)buffer, 4 );
 
     return( rval );
 }
@@ -99,16 +106,16 @@
     uint8_t           *command_buffer     /* in */
     )
 {
-    UINT32 tpmSendCommand = MS_SIM_TPM_SEND_COMMAND;  // Value for "send command" to MS simulator.
+    UINT32 tpmSendCommand;
     UINT32 cnt, cnt1;
     UINT8 locality;
     TSS2_RC rval = TSS2_RC_SUCCESS;
+    size_t offset;
 
 #ifdef DEBUG
     UINT32 commandCode;
     printf_type rmPrefix;
 #endif
-
     rval = CommonSendChecks( tctiContext, command_buffer );
     if( rval != TSS2_RC_SUCCESS )
     {
@@ -124,7 +131,11 @@
     if( ((TSS2_TCTI_CONTEXT_INTEL *)tctiContext )->status.debugMsgEnabled == 1 )
     {
         TCTI_LOG( tctiContext, rmPrefix, "" );
-		commandCode = CHANGE_ENDIAN_DWORD( ( (TPM20_Header_In *)command_buffer )->commandCode );
+        offset = sizeof (TPM_ST) + sizeof (UINT32);
+        rval = TPM_CC_Unmarshal (command_buffer,
+                                 command_size,
+                                 &offset,
+                                 &commandCode);
 #ifdef DEBUG_SOCKETS
         TCTI_LOG( tctiContext, NO_PREFIX, "Command sent on socket #0x%x: %s\n", TCTI_CONTEXT_INTEL->tpmSock, strTpmCommandCode( commandCode ) );
 #else
@@ -134,10 +145,14 @@
 #endif
     // Size TPM 1.2 and TPM 2.0 headers overlap exactly, we can use
     // either 1.2 or 2.0 header to get the size.
-    cnt = CHANGE_ENDIAN_DWORD(((TPM20_Header_In *) command_buffer)->commandSize);
+    offset = sizeof (TPM_ST);
+    rval = UINT32_Unmarshal (command_buffer, command_size, &offset, &cnt);
 
     // Send TPM_SEND_COMMAND
-    tpmSendCommand = CHANGE_ENDIAN_DWORD(tpmSendCommand);
+    rval = UINT32_Marshal (MS_SIM_TPM_SEND_COMMAND,
+                           (uint8_t*)&tpmSendCommand,
+                           sizeof (tpmSendCommand),
+                           NULL);  // Value for "send command" to MS simulator.
     rval = tctiSendBytes( tctiContext, TCTI_CONTEXT_INTEL->tpmSock, (unsigned char *)&tpmSendCommand, 4 );
     if( rval != TSS2_RC_SUCCESS )
         goto returnFromSocketSendTpmCommand;
@@ -157,7 +172,7 @@
 
     // Send number of bytes.
     cnt1 = cnt;
-    cnt = CHANGE_ENDIAN_DWORD(cnt);
+    cnt = HOST_TO_BE_32(cnt);
     rval = tctiSendBytes( tctiContext, TCTI_CONTEXT_INTEL->tpmSock, (unsigned char *)&cnt, 4 );
     if( rval != TSS2_RC_SUCCESS )
         goto returnFromSocketSendTpmCommand;
@@ -328,7 +343,7 @@
         if( rval != TSS2_RC_SUCCESS )
             goto retSocketReceiveTpmResponse;
 
-        ((TSS2_TCTI_CONTEXT_INTEL *)tctiContext)->responseSize = CHANGE_ENDIAN_DWORD( ((TSS2_TCTI_CONTEXT_INTEL *)tctiContext)->responseSize );
+        ((TSS2_TCTI_CONTEXT_INTEL *)tctiContext)->responseSize = BE_TO_HOST_32(((TSS2_TCTI_CONTEXT_INTEL *)tctiContext)->responseSize );
         ((TSS2_TCTI_CONTEXT_INTEL *)tctiContext)->status.protocolResponseSizeReceived = 1;
     }
 
@@ -368,7 +383,7 @@
             }
             else
             {
-                ((TSS2_TCTI_CONTEXT_INTEL *)tctiContext)->responseSize = CHANGE_ENDIAN_DWORD( ((TSS2_TCTI_CONTEXT_INTEL *)tctiContext)->responseSize );
+                ((TSS2_TCTI_CONTEXT_INTEL *)tctiContext)->responseSize = BE_TO_HOST_32 (((TSS2_TCTI_CONTEXT_INTEL *)tctiContext)->responseSize );
                 ((TSS2_TCTI_CONTEXT_INTEL *)tctiContext)->status.responseSizeReceived = 1;
             }
         }
@@ -395,7 +410,7 @@
 
         if( ((TSS2_TCTI_CONTEXT_INTEL *)tctiContext)->status.responseSizeReceived == 1 )
         {
-            *(TPM_RC *)response_buffer = CHANGE_ENDIAN_DWORD( ( (TSS2_TCTI_CONTEXT_INTEL *)tctiContext )->responseSize );
+            *(TPM_RC *)response_buffer = HOST_TO_BE_32( ( (TSS2_TCTI_CONTEXT_INTEL *)tctiContext )->responseSize );
             responseSizeDelta += sizeof( TPM_RC );
             response_buffer += sizeof( TPM_RC );
         }
diff --git a/test/CheckOverflow_unit.c b/test/CheckOverflow_unit.c
deleted file mode 100644
index 883b341..0000000
--- a/test/CheckOverflow_unit.c
+++ /dev/null
@@ -1,149 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <setjmp.h>
-#include <cmocka.h>
-#include <sapi/tpm20.h>
-
-#include "sys_api_marshalUnmarshal.h"
-#include "sysapi_util.h"
-
-/**
- * This tests the "common case" for the CheckOverflow. We define this as:
- * nexData > buffer, nextData + size <= bufferSize.
- */
-void
-CheckOverflow_good (void **state)
-{
-    TSS2_RC rc;
-    UINT8 *buffer = 0x0, *nextData = (UINT8*)0x2;
-    UINT32 bufferSize = 0x4, size = 0x2;
-
-    rc = CheckOverflow (buffer, bufferSize, nextData, size);
-    assert_int_equal (rc, TSS2_RC_SUCCESS);
-}
-/**
- * This tests an edge case where nextData == buffer and bufferSize == size.
- * CheckOverflow should be successful in this case.
- */
-void
-CheckOverflow_whole_buffer (void **state)
-{
-    TSS2_RC rc;
-    UINT8 *buffer = 0x0, *nextData = buffer;
-    UINT32 bufferSize = 0x4, size = 0x4;
-
-    rc = CheckOverflow (buffer, bufferSize, nextData, size);
-    assert_int_equal (rc, TSS2_RC_SUCCESS);
-}
-/**
- * Test the case that CheckOverflow is designed to catch. Specifically this
- * is the case where nextData > buffer, nextData + size > bufferSize
- */
-void
-CheckOverflow_overflow(void **state)
-{
-    TSS2_RC rc;
-    UINT8 *buffer = (UINT8*)0x1, *nextData = (UINT8*)0x4;
-    UINT32 bufferSize = 0x5, size = 0x6;
-
-    rc = CheckOverflow (buffer, bufferSize, nextData, size);
-    assert_int_equal (rc, TSS2_SYS_RC_INSUFFICIENT_CONTEXT);
-}
-/**
- * Test an edge case for the CheckOverflow function: buffer == nextData,
- * nextData + size < bufferSize.
- */
-void
-CheckOverflow_buf_next_equal (void **state)
-{
-    TSS2_RC rc;
-    UINT8 *buffer = (UINT8*)0x5, *nextData = buffer;
-    UINT32 bufferSize = 0x5, size = 0x1;
-
-    rc = CheckOverflow (buffer, bufferSize, nextData, size);
-    assert_int_equal (rc, TSS2_RC_SUCCESS);
-}
-/**
- * This tests another edge case: nextData in this case is beyond the end of
- * the provided buffer.
- */
-void
-CheckOverflow_nextData_gt_buffer_end (void **state)
-{
-    TSS2_RC rc;
-    UINT32 bufferSize = 0x1, size = 0x5;
-    UINT8 *buffer = (UINT8*)0x5, *nextData = buffer + size;
-
-    rc = CheckOverflow (buffer, bufferSize, nextData, size);
-    assert_int_equal (rc, TSS2_SYS_RC_INSUFFICIENT_CONTEXT);
-}
-/**
- * Pass the CheckDataPointers function a NULL first parameter.
- * This should return a bad reference error.
- */
-void
-CheckDataPointers_null_buffer (void **state)
-{
-    TSS2_RC rc;
-    UINT8 *buffer = NULL, *nextData = (UINT8*)5;
-
-    rc = CheckDataPointers (buffer, &nextData);
-    assert_int_equal (rc, TSS2_SYS_RC_BAD_REFERENCE);
-}
-/**
- * Pass the CheckDataPointers function a reference to a null pointer
- * in the second parameter. This should result in a bad reference RC.
- */
-void
-CheckDataPointers_null_nextData (void **state)
-{
-    TSS2_RC rc;
-    UINT8 *buffer = (UINT8*)5, *nextData = NULL;
-
-    rc = CheckDataPointers (buffer, &nextData);
-    assert_int_equal (rc, TSS2_SYS_RC_BAD_REFERENCE);
-}
-/**
- * Pass the CheckDataPointers function a NULL second paraemter. This should
- * result in a bad reference RC.
- */
-void
-CheckDataPointers_null_nextData_ptr (void **state)
-{
-    TSS2_RC rc;
-    UINT8 *buffer = (UINT8*)5, **nextData = NULL;
-
-    rc = CheckDataPointers (buffer, nextData);
-    assert_int_equal (rc, TSS2_SYS_RC_BAD_REFERENCE);
-}
-/**
- * Test an error case where nextData < buffer. Regardless of the size of the
- * data buffer this should fail.
- */
-void
-CheckDataPointers_nextData_lt_buffer_start (void **state)
-{
-    TSS2_RC rc;
-    UINT8 *buffer = (UINT8*)0x5, *nextData = buffer - 1;
-
-    rc = CheckDataPointers (buffer, &nextData);
-    assert_int_equal (rc, TSS2_SYS_RC_BAD_REFERENCE);
-}
-
-int
-main (void)
-{
-    const UnitTest tests [] = {
-        unit_test (CheckOverflow_good),
-        unit_test (CheckOverflow_whole_buffer),
-        unit_test (CheckOverflow_overflow),
-        unit_test (CheckOverflow_buf_next_equal),
-        unit_test (CheckOverflow_nextData_gt_buffer_end),
-        unit_test (CheckDataPointers_null_buffer),
-        unit_test (CheckDataPointers_null_nextData),
-        unit_test (CheckDataPointers_null_nextData_ptr),
-        unit_test (CheckDataPointers_nextData_lt_buffer_start),
-    };
-    return run_tests (tests);
-}
diff --git a/test/common/sample/CatSizedByteBuffer.c b/test/common/sample/CatSizedByteBuffer.c
index 95e9a70..bc62830 100644
--- a/test/common/sample/CatSizedByteBuffer.c
+++ b/test/common/sample/CatSizedByteBuffer.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 
 void CatSizedByteBuffer( TPM2B *dest, TPM2B *src )
 {
diff --git a/test/common/sample/CopySizedBuffer.c b/test/common/sample/CopySizedBuffer.c
index 6486d68..00e7543 100644
--- a/test/common/sample/CopySizedBuffer.c
+++ b/test/common/sample/CopySizedBuffer.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 
 UINT16 CopySizedByteBuffer( TPM2B *dest, TPM2B *src )
 {
diff --git a/test/common/sample/CreateNullSession.c b/test/common/sample/CreateNullSession.c
index 6cbd94e..7c50a12 100644
--- a/test/common/sample/CreateNullSession.c
+++ b/test/common/sample/CreateNullSession.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include <stdio.h>
 #include <stdlib.h>
 
diff --git a/test/common/sample/DecryptEncrypt.c b/test/common/sample/DecryptEncrypt.c
index 067fde2..b81840b 100644
--- a/test/common/sample/DecryptEncrypt.c
+++ b/test/common/sample/DecryptEncrypt.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sample.h"
 #include <string.h>
 
@@ -98,14 +98,12 @@
 
 UINT32 LoadSessionEncryptDecryptKey( TPMT_SYM_DEF *symmetric, TPM2B_MAX_BUFFER *key, TPM_HANDLE *keyHandle, TPM2B_NAME *keyName )
 {
-    TPM2B keyAuth;
+    TPM2B keyAuth = { 0 };
     TPM2B_SENSITIVE inPrivate;
     TPM2B_PUBLIC inPublic;
     UINT32 rval;
     TSS2_SYS_CONTEXT *sysContext;
 
-    keyAuth.size = 0;
-
     inPrivate.t.sensitiveArea.sensitiveType = TPM_ALG_SYMCIPHER;
     inPrivate.t.size = CopySizedByteBuffer( &(inPrivate.t.sensitiveArea.authValue.b), &keyAuth);
     inPrivate.t.sensitiveArea.seedValue.b.size = 0;
diff --git a/test/common/sample/Entity.c b/test/common/sample/Entity.c
index a84fd4c..7416f53 100644
--- a/test/common/sample/Entity.c
+++ b/test/common/sample/Entity.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sample.h"
 #include "sysapi_util.h"
 
diff --git a/test/common/sample/LoadExternalHMACKey.c b/test/common/sample/LoadExternalHMACKey.c
index d37ee10..3b8e4fe 100644
--- a/test/common/sample/LoadExternalHMACKey.c
+++ b/test/common/sample/LoadExternalHMACKey.c
@@ -25,14 +25,14 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
-#include <sample.h>
+#include "sample.h"
 
 
 UINT32 LoadExternalHMACKey( TPMI_ALG_HASH hashAlg, TPM2B *key, TPM_HANDLE *keyHandle, TPM2B_NAME *keyName )
 {
-    TPM2B keyAuth;
+    TPM2B keyAuth = { 0 };
     TPM2B_SENSITIVE inPrivate;
     TPM2B_PUBLIC inPublic;
     UINT32 rval;
diff --git a/test/common/sample/SessionHmac.c b/test/common/sample/SessionHmac.c
index 483995a..f5c542b 100644
--- a/test/common/sample/SessionHmac.c
+++ b/test/common/sample/SessionHmac.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sample.h"
 #include <stdio.h>
 #include <stdlib.h>
@@ -182,15 +182,7 @@
     for( i = 0; ( i < 2 ) && ( i < pSessionsDataIn->cmdAuthsCount ); i++ )
     {
         authPtr = &( pSessionsDataIn->cmdAuths[i]->hmac );
-
-        if( i == 0 || i == 1  )
-        {
-            entityHandle = handle1;
-        }
-        else
-        {
-            entityHandle = TPM_HT_NO_HANDLE;
-        }
+        entityHandle = handle1;
 
         if( authPtr != 0 )
         {
@@ -221,14 +213,7 @@
     {
         for( i = 0; ( i < 2 ) && ( i < pSessionsDataIn->cmdAuthsCount ); i++ )
         {
-            if( i == 0 || i == 1  )
-            {
-                entityHandle = handle1;
-            }
-            else
-            {
-                entityHandle = TPM_HT_NO_HANDLE;
-            }
+            entityHandle = handle1;
 
             if( ( pSessionsDataIn->cmdAuths[i]->sessionHandle >> HR_SHIFT ) == TPM_HT_HMAC_SESSION )
             {
diff --git a/test/common/sample/SetLocality.c b/test/common/sample/SetLocality.c
index 1d77543..6717192 100644
--- a/test/common/sample/SetLocality.c
+++ b/test/common/sample/SetLocality.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sample.h"
 
 TSS2_RC SetLocality( TSS2_SYS_CONTEXT *sysContext, UINT8 locality )
diff --git a/test/common/sample/StartAuthSession.c b/test/common/sample/StartAuthSession.c
index ec6793e..fa89efd 100644
--- a/test/common/sample/StartAuthSession.c
+++ b/test/common/sample/StartAuthSession.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sample.h"
 #include "sysapi_util.h"
 #include <stdlib.h>
@@ -260,6 +260,10 @@
     TPM_RC rval;
     SESSION_LIST_ENTRY *sessionEntry;
 
+    if (session == NULL) {
+        return TSS2_APP_RC_BAD_REFERENCE;
+    }
+
     rval = AddSession( &sessionEntry );
     if( rval == TSS2_RC_SUCCESS )
     {
diff --git a/test/common/sample/TpmCalcPHash.c b/test/common/sample/TpmCalcPHash.c
index 85eba9c..2477c53 100644
--- a/test/common/sample/TpmCalcPHash.c
+++ b/test/common/sample/TpmCalcPHash.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sample.h"
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/test/common/sample/TpmHandleToName.c b/test/common/sample/TpmHandleToName.c
index f4d6cd0..ce9298f 100644
--- a/test/common/sample/TpmHandleToName.c
+++ b/test/common/sample/TpmHandleToName.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sample.h"
 #include "sysapi_util.h"
 
diff --git a/test/common/sample/TpmHash.c b/test/common/sample/TpmHash.c
index 56dcb37..15f55b6 100644
--- a/test/common/sample/TpmHash.c
+++ b/test/common/sample/TpmHash.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sample.h"
 #include "sysapi_util.h"
 
@@ -92,26 +92,22 @@
     rval = Tss2_Sys_HashSequenceStart( sysContext, 0, &nullAuth, hashAlg, &sequenceHandle, 0 );
 
     if( rval != TPM_RC_SUCCESS )
-        return( rval );
+        goto teardown;
 
     for( i = 0; i < numBuffers; i++ )
     {
         rval = Tss2_Sys_SequenceUpdate ( sysContext, sequenceHandle, &cmdAuthArray, (TPM2B_MAX_BUFFER *)&bufferList[i], 0 );
 
         if( rval != TPM_RC_SUCCESS )
-            return( rval );
+            goto teardown;
     }
 
     INIT_SIMPLE_TPM2B_SIZE( *result );
     rval = Tss2_Sys_SequenceComplete ( sysContext, sequenceHandle, &cmdAuthArray, ( TPM2B_MAX_BUFFER *)&emptyBuffer,
             TPM_RH_PLATFORM, result, &validation, 0 );
 
-    if( rval != TPM_RC_SUCCESS )
-        return( rval );
-
+teardown:
     TeardownSysContext( &sysContext );
-
     return rval;
-
 }
 
diff --git a/test/common/sample/TpmHmac.c b/test/common/sample/TpmHmac.c
index fdba9ce..499dc88 100644
--- a/test/common/sample/TpmHmac.c
+++ b/test/common/sample/TpmHmac.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sample.h"
 #include "sysapi_util.h"
 
@@ -95,7 +95,7 @@
     rval = Tss2_Sys_HMAC_Start( sysContext, keyHandle, &sessionsData, &nullAuth, hashAlg, &sequenceHandle, 0 );
 
     if( rval != TPM_RC_SUCCESS )
-        return( rval );
+        goto teardown;
 
     hmac.t.size = 0;
     sessionData.hmac = hmac;
@@ -104,7 +104,7 @@
         rval = Tss2_Sys_SequenceUpdate ( sysContext, sequenceHandle, &sessionsData, (TPM2B_MAX_BUFFER *)( bufferList[i] ), &sessionsDataOut );
 
         if( rval != TPM_RC_SUCCESS )
-            return( rval );
+            goto teardown;
     }
 
     INIT_SIMPLE_TPM2B_SIZE( *result );
@@ -112,12 +112,12 @@
             TPM_RH_PLATFORM, result, &validation, &sessionsDataOut );
 
     if( rval != TPM_RC_SUCCESS )
-        return( rval );
+        goto teardown;
 
     rval = Tss2_Sys_FlushContext( sysContext, keyHandle );
 
+teardown:
     TeardownSysContext( &sysContext );
-
     return rval;
 
 }
diff --git a/test/common/sample/kdfa.c b/test/common/sample/kdfa.c
index c253e88..3931361 100644
--- a/test/common/sample/kdfa.c
+++ b/test/common/sample/kdfa.c
@@ -25,7 +25,7 @@
 // THE POSSIBILITY OF SUCH DAMAGE.
 //**********************************************************************;
 
-#include <sapi/tpm20.h>
+#include "sapi/tpm20.h"
 #include "sample.h"
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/test/common/sample/sample.h b/test/common/sample/sample.h
index a2d9619..50348a4 100644
--- a/test/common/sample/sample.h
+++ b/test/common/sample/sample.h
@@ -33,12 +33,12 @@
 #endif
 
 
-#include <sapi/tss2_tpm2_types.h>
-#include "tpmclient.h"
+#include "sapi/tss2_tpm2_types.h"
+#include "test/tpmclient/tpmclient.h"
 #include <stdio.h>
 #include <stdlib.h>
-#include "syscontext.h"
-#include "debug.h"
+#include "common/syscontext.h"
+#include "common/debug.h"
 
 extern TSS2_TCTI_CONTEXT *resMgrTctiContext;
 extern TSS2_ABI_VERSION abiVersion;
diff --git a/test/integration/asymmetric-encrypt-decrypt.c b/test/integration/asymmetric-encrypt-decrypt.c
new file mode 100644
index 0000000..a08a547
--- /dev/null
+++ b/test/integration/asymmetric-encrypt-decrypt.c
@@ -0,0 +1,143 @@
+#include <stdio.h>
+#include "log.h"
+#include "test.h"
+#include "sapi/tpm20.h"
+#include "sysapi_util.h"
+/**
+ * This program contains integration test for asymetric encrypt and
+ * decrypt use case that has SAPIs Tss2_Sys_CreatePrimary,
+ * Tss2_Sys_Create, Tss2_Sys_Load, Tss2_Sys_RSA_Encrypt and
+ * Tss2_Sys_RSA_Decrypt. First, the program creates the object and load
+ * it in TPM. Then, it performs encryption based on the loaded
+ * object. The object will be verified if it is encrypted.
+ * If the verification is passed, it performs decryption and the
+ * program will check if the decrypted value is the same as
+ * the value before encryption.
+ */
+int
+test_invoke (TSS2_SYS_CONTEXT *sapi_context)
+{
+    TSS2_RC rc;
+    TPM2B_SENSITIVE_CREATE  in_sensitive;
+    TPM2B_PUBLIC            in_public;
+    TPM2B_DATA              outside_info = {{0,}};
+    TPML_PCR_SELECTION      creation_pcr;
+    TPM2B_NAME name = {{sizeof(TPM2B_NAME)-2,}};
+    TPM2B_PRIVATE out_private = {{sizeof(TPM2B_PRIVATE)-2,}};
+    TPM2B_PUBLIC out_public = {{0,}};
+    TPM2B_CREATION_DATA creation_data = {{0,}};
+    TPM2B_DIGEST creation_hash = {{sizeof(TPM2B_DIGEST)-2,}};
+    TPMT_TK_CREATION creation_ticket = {0,};
+    TPM_HANDLE loaded_sym_handle;
+    TPM_HANDLE sym_handle;
+    const char message[] = "my message";
+    TPMT_RSA_DECRYPT in_scheme;
+    TPM2B_PUBLIC_KEY_RSA input_message = {{sizeof(TPM2B_PUBLIC_KEY_RSA)-2,}};
+    TPM2B_PUBLIC_KEY_RSA output_message = {{sizeof(TPM2B_PUBLIC_KEY_RSA)-2,}};
+    TPM2B_PUBLIC_KEY_RSA output_data = {{sizeof(TPM2B_PUBLIC_KEY_RSA)-2,}};
+
+    TPMS_AUTH_RESPONSE session_data_out;
+    TPMS_AUTH_COMMAND session_data;
+    TSS2_SYS_RSP_AUTHS sessions_data_out;
+    TSS2_SYS_CMD_AUTHS sessions_data;
+    TPMS_AUTH_COMMAND *session_data_array[1];
+    TPMS_AUTH_RESPONSE *session_data_out_array[1];
+
+    session_data_array[0] = &session_data;
+    session_data_out_array[0] = &session_data_out;
+    sessions_data_out.rspAuths = &session_data_out_array[0];
+    sessions_data.cmdAuths = &session_data_array[0];
+    sessions_data_out.rspAuthsCount = 1;
+    session_data.sessionHandle = TPM_RS_PW;
+    session_data.nonce.t.size = 0;
+    session_data.hmac.t.size = 0;
+    *((UINT8 *)((void *)&session_data.sessionAttributes)) = 0;
+    sessions_data.cmdAuthsCount = 1;
+    sessions_data.cmdAuths[0] = &session_data;
+
+    in_sensitive.t.size =0;
+    in_sensitive.t.sensitive.userAuth.t.size = 0;
+    in_sensitive.t.sensitive.data.t.size = 0;
+
+    in_public.t.publicArea.type = TPM_ALG_RSA;
+    in_public.t.publicArea.nameAlg = TPM_ALG_SHA256;
+    *(UINT32 *)&(in_public.t.publicArea.objectAttributes) = 0;
+    in_public.t.publicArea.objectAttributes.restricted = 1;
+    in_public.t.publicArea.objectAttributes.userWithAuth = 1;
+    in_public.t.publicArea.objectAttributes.decrypt = 1;
+    in_public.t.publicArea.objectAttributes.fixedTPM = 1;
+    in_public.t.publicArea.objectAttributes.fixedParent = 1;
+    in_public.t.publicArea.objectAttributes.sensitiveDataOrigin = 1;
+
+    in_public.t.publicArea.authPolicy.t.size = 0;
+
+    in_public.t.publicArea.parameters.rsaDetail.symmetric.algorithm = TPM_ALG_AES;
+    in_public.t.publicArea.parameters.rsaDetail.symmetric.keyBits.aes = 128;
+    in_public.t.publicArea.parameters.rsaDetail.symmetric.mode.aes = TPM_ALG_CFB;
+    in_public.t.publicArea.parameters.rsaDetail.scheme.scheme = TPM_ALG_NULL;
+    in_public.t.publicArea.parameters.rsaDetail.keyBits = 2048;
+    in_public.t.publicArea.parameters.rsaDetail.exponent = 0;
+
+    in_public.t.publicArea.unique.rsa.t.size = 0;
+
+    outside_info.t.size = 0;
+    creation_pcr.count = 0;
+    out_public.t.size = 0;
+    creation_data.t.size = 0;
+
+    print_log("Asymmetric Encryption and Decryption Tests started.");
+    rc = Tss2_Sys_CreatePrimary(sapi_context, TPM_RH_OWNER, &sessions_data, &in_sensitive, &in_public, &outside_info, &creation_pcr, &sym_handle, &out_public, &creation_data, &creation_hash, &creation_ticket, &name, &sessions_data_out);
+    if (rc != TPM_RC_SUCCESS)
+        print_fail("CreatePrimary FAILED! Response Code : 0x%x", rc);
+    print_log("New key successfully created.  Handle: 0x%8.8x\n", sym_handle);
+
+    in_public.t.publicArea.type = TPM_ALG_RSA;
+    in_public.t.publicArea.parameters.rsaDetail.symmetric.algorithm = TPM_ALG_NULL;
+    in_public.t.publicArea.parameters.rsaDetail.scheme.scheme = TPM_ALG_NULL;
+    in_public.t.publicArea.parameters.rsaDetail.keyBits = 2048;
+    in_public.t.publicArea.parameters.rsaDetail.exponent = 0;
+    in_public.t.publicArea.unique.rsa.t.size = 0;
+
+    // First clear attributes bit field.
+    *(UINT32 *)&(in_public.t.publicArea.objectAttributes) = 0;
+    in_public.t.publicArea.objectAttributes.restricted = 0;
+    in_public.t.publicArea.objectAttributes.userWithAuth = 1;
+    in_public.t.publicArea.objectAttributes.decrypt = 1;
+    in_public.t.publicArea.objectAttributes.sign = 1;
+    in_public.t.publicArea.objectAttributes.fixedTPM = 1;
+    in_public.t.publicArea.objectAttributes.fixedParent = 1;
+    in_public.t.publicArea.objectAttributes.sensitiveDataOrigin = 1;
+
+    outside_info.t.size = 0;
+    out_public.t.size = 0;
+    creation_data.t.size = 0;
+    session_data.hmac.t.size = 0;
+
+    rc = Tss2_Sys_Create(sapi_context, sym_handle, &sessions_data, &in_sensitive, &in_public, &outside_info, &creation_pcr, &out_private, &out_public, &creation_data, &creation_hash, &creation_ticket, &sessions_data_out);
+    if (rc != TPM_RC_SUCCESS)
+        print_fail("Create FAILED! Response Code : 0x%x", rc);
+
+    rc = Tss2_Sys_Load(sapi_context, sym_handle, &sessions_data, &out_private, &out_public, &loaded_sym_handle, &name, &sessions_data_out);
+    if (rc != TPM_RC_SUCCESS)
+        print_fail("Load FAILED! Response Code : 0x%x", rc);
+    print_log( "Loaded key handle:  %8.8x\n", loaded_sym_handle );
+
+    input_message.t.size = strlen(message);
+    memcpy(input_message.t.buffer, message, input_message.t.size);
+    in_scheme.scheme = TPM_ALG_RSAES;
+    outside_info.t.size = 0;
+    rc = Tss2_Sys_RSA_Encrypt(sapi_context, loaded_sym_handle, 0, &input_message, &in_scheme, &outside_info, &output_data, 0);
+    if(rc != TPM_RC_SUCCESS)
+        print_fail("RSA_Encrypt FAILED! Response Code : 0x%x", rc);
+    print_log("Encrypt successed.");
+
+    rc = Tss2_Sys_RSA_Decrypt(sapi_context, loaded_sym_handle, &sessions_data, &output_data, &in_scheme, &outside_info, &output_message, &sessions_data_out);
+    if(rc != TPM_RC_SUCCESS)
+        print_fail("RSA_Decrypt FAILED! Response Code : 0x%x", rc);
+    print_log("Decrypt successed.");
+
+    print_log("Asymmetric Encryption and Decryption Test Passed!");
+    return 0;
+}
+
+
diff --git a/test/integration/context-util.c b/test/integration/context-util.c
new file mode 100644
index 0000000..be4955e
--- /dev/null
+++ b/test/integration/context-util.c
@@ -0,0 +1,180 @@
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "tcti/tcti_device.h"
+#include "tcti/tcti_socket.h"
+
+#include "context-util.h"
+
+/*
+ * Initialize a TSS2_TCTI_CONTEXT for the device TCTI.
+ */
+TSS2_TCTI_CONTEXT*
+tcti_device_init (char const *device_path)
+{
+    TCTI_DEVICE_CONF conf = {
+        .device_path =device_path,
+        .logCallback = NULL,
+        .logData     = NULL,
+    };
+    size_t size;
+    TSS2_RC rc;
+    TSS2_TCTI_CONTEXT *tcti_ctx;
+
+    rc = InitDeviceTcti (NULL, &size, 0);
+    if (rc != TSS2_RC_SUCCESS) {
+        fprintf (stderr,
+                 "Failed to get allocation size for device tcti context: "
+                 "0x%x\n", rc);
+        return NULL;
+    }
+    tcti_ctx = (TSS2_TCTI_CONTEXT*)calloc (1, size);
+    if (tcti_ctx == NULL) {
+        fprintf (stderr,
+                 "Allocation for device TCTI context failed: %s\n",
+                 strerror (errno));
+        return NULL;
+    }
+    rc = InitDeviceTcti (tcti_ctx, &size, &conf);
+    if (rc != TSS2_RC_SUCCESS) {
+        fprintf (stderr,
+                 "Failed to initialize device TCTI context: 0x%x\n",
+                 rc);
+        free (tcti_ctx);
+        return NULL;
+    }
+    return tcti_ctx;
+}
+/*
+ * Initialize a socket TCTI instance using the provided options structure.
+ * The hostname and port are the only configuration options used. Callbacks
+ * for logging are set to NULL.
+ * The caller is returned a TCTI context structure that is allocated by this
+ * function. This structure must be freed by the caller.
+ */
+TSS2_TCTI_CONTEXT*
+tcti_socket_init (char const *address,
+                  uint16_t    port)
+{
+    TCTI_SOCKET_CONF conf = {
+        .hostname          = address,
+        .port              = port,
+        .logCallback       = NULL,
+        .logBufferCallback = NULL,
+        .logData           = NULL,
+    };
+    size_t size;
+    TSS2_RC rc;
+    TSS2_TCTI_CONTEXT *tcti_ctx;
+
+    rc = InitSocketTcti (NULL, &size, &conf, 0);
+    if (rc != TSS2_RC_SUCCESS) {
+        fprintf (stderr, "Faled to get allocation size for tcti context: "
+                 "0x%x\n", rc);
+        return NULL;
+    }
+    tcti_ctx = (TSS2_TCTI_CONTEXT*)calloc (1, size);
+    if (tcti_ctx == NULL) {
+        fprintf (stderr, "Allocation for tcti context failed: %s\n",
+                 strerror (errno));
+        return NULL;
+    }
+    rc = InitSocketTcti (tcti_ctx, &size, &conf, 0);
+    if (rc != TSS2_RC_SUCCESS) {
+        fprintf (stderr, "Failed to initialize tcti context: 0x%x\n", rc);
+        free (tcti_ctx);
+        return NULL;
+    }
+    return tcti_ctx;
+}
+/*
+ * Initialize a SAPI context using the TCTI context provided by the caller.
+ * This function allocates memory for the SAPI context and returns it to the
+ * caller. This memory must be freed by the caller.
+ */
+static TSS2_SYS_CONTEXT*
+sapi_init_from_tcti_ctx (TSS2_TCTI_CONTEXT *tcti_ctx)
+{
+    TSS2_SYS_CONTEXT *sapi_ctx;
+    TSS2_RC rc;
+    size_t size;
+    TSS2_ABI_VERSION abi_version = {
+        .tssCreator = TSSWG_INTEROP,
+        .tssFamily  = TSS_SAPI_FIRST_FAMILY,
+        .tssLevel   = TSS_SAPI_FIRST_LEVEL,
+        .tssVersion = TSS_SAPI_FIRST_VERSION,
+    };
+
+    size = Tss2_Sys_GetContextSize (0);
+    sapi_ctx = (TSS2_SYS_CONTEXT*)calloc (1, size);
+    if (sapi_ctx == NULL) {
+        fprintf (stderr,
+                 "Failed to allocate 0x%zx bytes for the SAPI context\n",
+                 size);
+        return NULL;
+    }
+    rc = Tss2_Sys_Initialize (sapi_ctx, size, tcti_ctx, &abi_version);
+    if (rc != TSS2_RC_SUCCESS) {
+        fprintf (stderr, "Failed to initialize SAPI context: 0x%x\n", rc);
+        free (sapi_ctx);
+        return NULL;
+    }
+    return sapi_ctx;
+}
+/*
+ * Initialize a SAPI context to use a socket TCTI. Get configuration data from
+ * the provided structure.
+ */
+TSS2_SYS_CONTEXT*
+sapi_init_from_opts (test_opts_t *options)
+{
+    TSS2_TCTI_CONTEXT *tcti_ctx;
+    TSS2_SYS_CONTEXT  *sapi_ctx;
+
+    tcti_ctx = tcti_init_from_opts (options);
+    if (tcti_ctx == NULL)
+        return NULL;
+    sapi_ctx = sapi_init_from_tcti_ctx (tcti_ctx);
+    if (sapi_ctx == NULL)
+        return NULL;
+    return sapi_ctx;
+}
+/*
+ * Initialize a TSS2_TCTI_CONTEXT using whatever TCTI data is in the options
+ * structure. This is a mechanism that allows the calling application to be
+ * mostly ignorant of which TCTI they're creating / initializing.
+ */
+TSS2_TCTI_CONTEXT*
+tcti_init_from_opts (test_opts_t *options)
+{
+    switch (options->tcti_type) {
+    case DEVICE_TCTI:
+        return tcti_device_init (options->device_file);
+    case SOCKET_TCTI:
+        return tcti_socket_init (options->socket_address,
+                                 options->socket_port);
+    default:
+        return NULL;
+    }
+}
+/*
+ * Teardown and free the resoruces associted with a SAPI context structure.
+ * This includes tearing down the TCTI as well.
+ */
+void
+sapi_teardown_full (TSS2_SYS_CONTEXT *sapi_context)
+{
+    TSS2_TCTI_CONTEXT *tcti_context = NULL;
+    TSS2_RC rc;
+
+    rc = Tss2_Sys_GetTctiContext (sapi_context, &tcti_context);
+    if (rc != TSS2_RC_SUCCESS)
+        return;
+    Tss2_Sys_Finalize (sapi_context);
+    free (sapi_context);
+    if (tcti_context) {
+        tss2_tcti_finalize (tcti_context);
+        free (tcti_context);
+    }
+}
diff --git a/test/integration/context-util.h b/test/integration/context-util.h
new file mode 100644
index 0000000..7f52ee4
--- /dev/null
+++ b/test/integration/context-util.h
@@ -0,0 +1,18 @@
+#ifndef CONTEXT_UTIL_H
+#define CONTEXT_UTIL_H
+
+#include "sapi/tpm20.h"
+#include "test-options.h"
+
+/**
+ * functions to setup TCTIs and SAPI contexts  using data from the common
+ * options
+ */
+TSS2_TCTI_CONTEXT*    tcti_device_init    (char const         *device_name);
+TSS2_TCTI_CONTEXT*    tcti_socket_init    (char const         *address,
+                                           uint16_t            port);
+TSS2_TCTI_CONTEXT*    tcti_init_from_opts (test_opts_t        *options);
+TSS2_SYS_CONTEXT*     sapi_init_from_opts (test_opts_t        *options);
+void                  sapi_teardown_full  (TSS2_SYS_CONTEXT   *sapi_context);
+
+#endif /* CONTEXT_UTIL_H */
diff --git a/test/integration/get-random.c b/test/integration/get-random.c
new file mode 100644
index 0000000..1453da0
--- /dev/null
+++ b/test/integration/get-random.c
@@ -0,0 +1,35 @@
+#include <stdio.h>
+#include "log.h"
+#include "test.h"
+#include "sapi/tpm20.h"
+
+/**
+ * This program contains integration test for SAPI Tss2_Sys_GetRandom.
+ * First, this test is checking the return code to make sure the
+ * SAPI is executed correctly(return code should return TPM_RC_SUCCESS).
+ * Second, the SAPI is called twice to make sure the return randomBytes
+ * are different by comparing the two randomBytes through memcmp.
+ * It might not be the best test for random bytes generator but
+ * at least this test shows the return randomBytes are differen.
+ */
+int
+test_invoke (TSS2_SYS_CONTEXT *sapi_context)
+{
+    TSS2_RC rc;
+    TPM2B_DIGEST randomBytes1 = { { sizeof (TPM2B_DIGEST) - 2, } };
+    TPM2B_DIGEST randomBytes2 = { { sizeof (TPM2B_DIGEST) - 2, } };
+    int bytes = 20;
+
+    print_log("GetRandom tests started.");
+    rc = Tss2_Sys_GetRandom(sapi_context, 0, bytes, &randomBytes1, 0);
+    if (rc != TSS2_RC_SUCCESS)
+        print_fail("GetRandom FAILED! Response Code : %x", rc);
+    rc = Tss2_Sys_GetRandom(sapi_context, 0, bytes, &randomBytes2, 0);
+    if (rc != TSS2_RC_SUCCESS)
+        print_fail("GetRandom FAILED! Response Code : %x", rc);
+    if(memcmp(&randomBytes1, &randomBytes2, bytes) == 0) {
+        print_fail("Comparison FAILED! randomBytes 0x%p & 0x%p are the same.", &randomBytes1, &randomBytes2);
+    }
+    print_log("GetRandom Test Passed!");
+    return 0;
+}
diff --git a/test/integration/log.h b/test/integration/log.h
new file mode 100644
index 0000000..c264865
--- /dev/null
+++ b/test/integration/log.h
@@ -0,0 +1,26 @@
+#ifndef LOG_H
+#define LOG_H
+
+#include <stdio.h>
+
+#define print_log(fmt, ...) \
+    do { \
+        fprintf(stderr, \
+                "%s:%d:%s(): " fmt "\n", \
+                __FILE__, \
+                __LINE__, \
+                __func__, \
+                ##__VA_ARGS__); \
+    } while (0)
+#define print_fail(fmt, ...) \
+    do { \
+        fprintf(stdout, \
+                "%s:%d:%s(): " fmt "\n", \
+                __FILE__, \
+                __LINE__, \
+                __func__, \
+                ##__VA_ARGS__); \
+         exit(1); \
+    } while (0)
+
+#endif
diff --git a/test/integration/main.c b/test/integration/main.c
new file mode 100644
index 0000000..bb4c7f4
--- /dev/null
+++ b/test/integration/main.c
@@ -0,0 +1,40 @@
+#include <stdbool.h>
+
+#include "log.h"
+#include "test.h"
+#include "test-options.h"
+#include "context-util.h"
+
+/**
+ * This program is a template for integration tests (ones that use the TCTI
+ * and the SAPI contexts / API directly). It does nothing more than parsing
+ * command line options that allow the caller (likely a script) to specify
+ * which TCTI to use for the test.
+ */
+int
+main (int   argc,
+      char *argv[])
+{
+    TSS2_RC rc;
+    TSS2_SYS_CONTEXT *sapi_context;
+    int ret;
+    test_opts_t opts = {
+        .tcti_type      = TCTI_DEFAULT,
+        .device_file    = DEVICE_PATH_DEFAULT,
+        .socket_address = HOSTNAME_DEFAULT,
+        .socket_port    = PORT_DEFAULT,
+    };
+
+    get_test_opts_from_env (&opts);
+    if (sanity_check_test_opts (&opts) != 0)
+        exit (1);
+    sapi_context = sapi_init_from_opts (&opts);
+    if (sapi_context == NULL)
+        exit (1);
+    rc = Tss2_Sys_Startup(sapi_context, TPM_SU_CLEAR);
+    if (rc != TSS2_RC_SUCCESS && rc != TPM_RC_INITIALIZE)
+        print_fail("TPM Startup FAILED! Response Code : 0x%x", rc);
+    ret = test_invoke (sapi_context);
+    sapi_teardown_full (sapi_context);
+    return ret;
+}
diff --git a/test/integration/pcr-extension.c b/test/integration/pcr-extension.c
new file mode 100644
index 0000000..cc2dfda
--- /dev/null
+++ b/test/integration/pcr-extension.c
@@ -0,0 +1,87 @@
+#include <stdio.h>
+#include "log.h"
+#include "test.h"
+#include "sapi/tpm20.h"
+#include "sysapi_util.h"
+#define PCR_8   8
+/**
+ * This program contains integration test for SAPI Tss2_Sys_PCR_Read
+ * and Tss2_Sys_PCR_Extend. This is an use case scenario on PCR extend.
+ * First, we will get the list of PCR avaliable through getcapability
+ * SAPI. Then, PCR_Read SAPI is called to list out the PCR value and
+ * PCR_Extend SAPI is called next to update the PCR value. Last,
+ * PCR_Read SAPI is called again to check the PCR values are changed.
+ */
+int
+test_invoke (TSS2_SYS_CONTEXT *sapi_context)
+{
+    TSS2_RC rc;
+    TPMI_YES_NO more_data;
+    TPMS_CAPABILITY_DATA capability_data;
+    TPMS_AUTH_COMMAND session_data;
+    TSS2_SYS_CMD_AUTHS sessions_data;
+    UINT16 i, digest_size;
+    TPML_PCR_SELECTION  pcr_selection;
+    UINT32 pcr_update_counter_before_extend;
+    UINT32 pcr_update_counter_after_extend;
+    UINT8 pcr_before_extend[20];
+    UINT8 pcr_after_extend[20];
+    TPML_DIGEST pcr_values;
+    TPML_DIGEST_VALUES digests;
+    TPML_PCR_SELECTION pcr_selection_out;
+    TPMS_AUTH_COMMAND *session_data_array[1];
+
+    session_data_array[0] = &session_data;
+    sessions_data.cmdAuths = &session_data_array[0];
+    session_data.sessionHandle = TPM_RS_PW;
+    session_data.nonce.t.size = 0;
+    session_data.hmac.t.size = 0;
+    *( (UINT8 *)((void *)&session_data.sessionAttributes ) ) = 0;
+
+    print_log("PCR Extension tests started.");
+    rc = Tss2_Sys_GetCapability(sapi_context, 0, TPM_CAP_PCR_PROPERTIES, TPM_PT_PCR_COUNT, 1, &more_data, &capability_data, 0);
+    if (rc != TSS2_RC_SUCCESS)
+        print_fail("GetCapability FAILED! Response Code : 0x%x", rc);
+    
+    digests.count = 1;
+    digests.digests[0].hashAlg = TPM_ALG_SHA1;
+    digest_size = GetDigestSize( digests.digests[0].hashAlg );
+
+    for( i = 0; i < digest_size; i++ )
+    {
+        digests.digests[0].digest.sha1[i] = (UINT8)(i % 256);
+    }
+    pcr_selection.count = 1;
+    pcr_selection.pcrSelections[0].hash = TPM_ALG_SHA1;
+    pcr_selection.pcrSelections[0].sizeofSelect = 3;
+    pcr_selection.pcrSelections[0].pcrSelect[0] = 0;
+    pcr_selection.pcrSelections[0].pcrSelect[1] = 0;
+    pcr_selection.pcrSelections[0].pcrSelect[2] = 0;
+    pcr_selection.pcrSelections[0].pcrSelect[PCR_8 / 8] = 1 << (PCR_8 % 8);
+
+    rc = Tss2_Sys_PCR_Read(sapi_context, 0, &pcr_selection, &pcr_update_counter_before_extend, &pcr_selection_out, &pcr_values, 0);
+    if (rc != TSS2_RC_SUCCESS)
+        print_fail("PCR_Read FAILED! Response Code : 0x%x", rc);
+    memcpy(&(pcr_before_extend[0]), &(pcr_values.digests[0].t.buffer[0]), pcr_values.digests[0].t.size);
+
+    sessions_data.cmdAuthsCount = 1;
+    sessions_data.cmdAuths[0] = &session_data;
+    rc = Tss2_Sys_PCR_Extend(sapi_context, PCR_8, &sessions_data, &digests, 0);
+    if (rc != TSS2_RC_SUCCESS)
+        print_fail("PCR_Extend FAILED! Response Code : 0x%x", rc);
+
+    rc = Tss2_Sys_PCR_Read(sapi_context, 0, &pcr_selection, &pcr_update_counter_after_extend, &pcr_selection_out, &pcr_values, 0);
+    if (rc != TSS2_RC_SUCCESS)
+        print_fail("PCR_Read FAILED! Response Code : 0x%x", rc);
+    memcpy(&(pcr_after_extend[0]), &(pcr_values.digests[0].t.buffer[0]), pcr_values.digests[0].t.size);
+
+    if(pcr_update_counter_before_extend == pcr_update_counter_after_extend)
+        print_fail("ERROR!! pcr_update_counter didn't change value\n");
+
+    if(memcmp(&(pcr_before_extend[0]), &(pcr_after_extend[0]), 20) == 0)
+        print_fail("ERROR!! PCR didn't change value\n");
+
+    print_log("PCR Extension Test Passed!");
+    return 0;
+}
+
diff --git a/test/integration/self-test.c b/test/integration/self-test.c
new file mode 100644
index 0000000..6735962
--- /dev/null
+++ b/test/integration/self-test.c
@@ -0,0 +1,28 @@
+#include <stdio.h>
+#include "log.h"
+#include "test.h"
+#include "sapi/tpm20.h"
+
+/*
+ * This program contains integration test for SAPI Tss2_Sys_SelfTest
+ * that perform test of its capabilities. This program is calling  
+ * SelfTest SAPI and make sure the response code are success
+ * when fullTest set as YES and when it is set as NO.  
+ */
+int
+test_invoke (TSS2_SYS_CONTEXT *sapi_context)
+{
+    TSS2_RC rc;
+    print_log( "SelfTest tests started." );
+    rc = Tss2_Sys_SelfTest( sapi_context, 0, YES, 0);
+    if (rc != TSS2_RC_SUCCESS)
+        print_fail("SelfTest FAILED! Response Code : 0x%x", rc);
+    rc = Tss2_Sys_SelfTest( sapi_context, 0, NO, 0);
+    if (rc != TSS2_RC_SUCCESS)
+        print_fail("SelfTest FAILED! Response Code : 0x%x", rc);
+    rc = Tss2_Sys_SelfTest(sapi_context, 0, YES, 0);
+    if (rc != TSS2_RC_SUCCESS)
+        print_fail("SelfTest FAILED! Response Code : 0x%x", rc);
+    print_log("SelfTest tests passed.");
+    return 0;
+}
diff --git a/test/integration/start-auth-session.c b/test/integration/start-auth-session.c
new file mode 100644
index 0000000..17bd24d
--- /dev/null
+++ b/test/integration/start-auth-session.c
@@ -0,0 +1,66 @@
+#include <inttypes.h>
+#include <stdio.h>
+
+#include "sapi/tpm20.h"
+
+#include "log.h"
+#include "test.h"
+/*
+ * This is an incredibly simple test to create the most simple session
+ * (which ends up being a trial policy) and then just tear it down.
+ */
+int
+test_invoke (TSS2_SYS_CONTEXT *sapi_context)
+{
+    TSS2_RC rc;
+    TPM2B_NONCE nonce_caller = {
+        .t = {
+            .size   = SHA256_DIGEST_SIZE,
+            .buffer = {
+                0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef,
+                0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef,
+                0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef,
+                0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef
+            }
+        }
+    };
+    TPM2B_NONCE nonce_tpm = {
+        .t = {
+            .size   = SHA256_DIGEST_SIZE,
+            .buffer = { 0 }
+        }
+    };
+    TPM2B_ENCRYPTED_SECRET encrypted_salt = { 0 };
+    TPMI_SH_AUTH_SESSION   session_handle = 0;
+    TPMT_SYM_DEF           symmetric      = { .algorithm = TPM_ALG_NULL };
+
+    print_log ("StartAuthSession for TPM_SE_POLICY (policy session)");
+    rc = Tss2_Sys_StartAuthSession (sapi_context,
+                                    TPM_RH_NULL,     /* tpmKey */
+                                    TPM_RH_NULL,     /* bind */
+                                    0,               /* cmdAuthsArray */
+                                    &nonce_caller,   /* nonceCaller */
+                                    &encrypted_salt, /* encryptedSalt */
+                                    TPM_SE_POLICY,   /* sessionType */
+                                    &symmetric,      /* symmetric */
+                                    TPM_ALG_SHA256,  /* authHash */
+                                    &session_handle, /* sessionHandle */
+                                    &nonce_tpm,      /* nonceTPM */
+                                    0                /* rspAuthsArray */
+                                    );
+    if (rc != TSS2_RC_SUCCESS)
+        print_fail ("Tss2_Sys_StartAuthSession failed: 0x%" PRIx32, rc);
+    print_log ("StartAuthSession for TPM_SE_POLICY success! Session handle: "
+               "0x%" PRIx32, session_handle);
+    /*
+     * Clean out the session we've created. Would be nice if we didn't have
+     * to do this ...
+     */
+    rc = Tss2_Sys_FlushContext (sapi_context, session_handle);
+    if (rc != TSS2_RC_SUCCESS)
+        print_fail ("Tss2_Sys_FlushContext failed: 0x%" PRIx32, rc);
+    print_log ("Flushed context for session handle: 0x%" PRIx32 " success!",
+               session_handle);
+
+    return 0;
+}
diff --git a/test/integration/test-options.c b/test/integration/test-options.c
new file mode 100644
index 0000000..2834298
--- /dev/null
+++ b/test/integration/test-options.c
@@ -0,0 +1,120 @@
+#include <stdio.h>
+
+#include "test-options.h"
+
+/*
+ * A structure to map a string name to an element in the TCTI_TYPE
+ * enumeration.
+ */
+typedef struct {
+    char       *name;
+    TCTI_TYPE   type;
+} tcti_map_entry_t;
+/*
+ * A table of tcti_map_entry_t structures. This is how we map a string
+ * provided on the command line to the enumeration.
+ */
+tcti_map_entry_t tcti_map_table[] = {
+    {
+        .name = "device",
+        .type = DEVICE_TCTI,
+    },
+    {
+        .name = "socket",
+        .type = SOCKET_TCTI,
+    },
+    {
+        .name = "unknown",
+        .type = UNKNOWN_TCTI,
+    },
+};
+/*
+ * Convert from a string to an element in the TCTI_TYPE enumeration.
+ * An unkonwn name / string will map to UNKNOWN_TCTI.
+ */
+TCTI_TYPE
+tcti_type_from_name (char const *tcti_str)
+{
+    int i;
+    for (i = 0; i < N_TCTI; ++i)
+        if (strcmp (tcti_str, tcti_map_table[i].name) == 0)
+            return tcti_map_table[i].type;
+    return UNKNOWN_TCTI;
+}
+/*
+ * Convert from an element in the TCTI_TYPE enumeration to a string
+ * representation.
+ */
+char* const
+tcti_name_from_type (TCTI_TYPE tcti_type)
+{
+    int i;
+    for (i = 0; i < N_TCTI; ++i)
+        if (tcti_type == tcti_map_table[i].type)
+            return tcti_map_table[i].name;
+    return NULL;
+}
+/*
+ * return 0 if sanity test passes
+ * return 1 if sanity test fails
+ */
+int
+sanity_check_test_opts (test_opts_t  *opts)
+{
+    switch (opts->tcti_type) {
+    case DEVICE_TCTI:
+        if (opts->device_file == NULL) {
+            fprintf (stderr, "device-path is NULL, check env\n");
+            return 1;
+        }
+        break;
+    case SOCKET_TCTI:
+        if (opts->socket_address == NULL || opts->socket_port == 0) {
+            fprintf (stderr,
+                     "socket_address or socket_port is NULL, check env\n");
+            return 1;
+        }
+        break;
+    default:
+        fprintf (stderr, "unknown TCTI type, check env\n");
+        return 1;
+    }
+    return 0;
+}
+/*
+ * Parse command line options from argv extracting test options. These are
+ * returned to the caller in the provided options structure.
+ */
+int
+get_test_opts_from_env (test_opts_t          *test_opts)
+{
+    char *env_str, *end_ptr;
+
+    if (test_opts == NULL)
+        return 1;
+    env_str = getenv (ENV_TCTI_NAME);
+    if (env_str != NULL)
+        test_opts->tcti_type = tcti_type_from_name (env_str);
+    env_str = getenv (ENV_DEVICE_FILE);
+    if (env_str != NULL)
+        test_opts->device_file = env_str;
+    env_str = getenv (ENV_SOCKET_ADDRESS);
+    if (env_str != NULL)
+        test_opts->socket_address = env_str;
+    env_str = getenv (ENV_SOCKET_PORT);
+    if (env_str != NULL)
+        test_opts->socket_port = strtol (env_str, &end_ptr, 10);
+    return 0;
+}
+/*
+ * Dump the contents of the test_opts_t structure to stdout.
+ */
+void
+dump_test_opts (test_opts_t *opts)
+{
+    printf ("test_opts_t:\n");
+    printf ("  tcti_type:      %s\n", tcti_name_from_type (opts->tcti_type));
+    printf ("  device_file:    %s\n", opts->device_file);
+    printf ("  socket_address: %s\n", opts->socket_address);
+    printf ("  socket_port:    %d\n", opts->socket_port);
+}
diff --git a/test/integration/test-options.h b/test/integration/test-options.h
new file mode 100644
index 0000000..53e79a6
--- /dev/null
+++ b/test/integration/test-options.h
@@ -0,0 +1,45 @@
+#ifndef TEST_OPTIONS_H
+#define TEST_OPTIONS_H
+
+#include "sapi/tpm20.h"
+
+/* Default TCTI */
+#define TCTI_DEFAULT      SOCKET_TCTI
+#define TCTI_DEFAULT_STR  "socket"
+
+/* Defaults for Device TCTI */
+#define DEVICE_PATH_DEFAULT "/dev/tpm0"
+
+/* Deafults for Socket TCTI connections */
+#define HOSTNAME_DEFAULT "127.0.0.1"
+#define PORT_DEFAULT     2321
+
+/* environment variables holding TCTI config */
+#define ENV_TCTI_NAME      "TPM20TEST_TCTI_NAME"
+#define ENV_DEVICE_FILE    "TPM2OTEST_DEVICE_FILE"
+#define ENV_SOCKET_ADDRESS "TPM20TEST_SOCKET_ADDRESS"
+#define ENV_SOCKET_PORT    "TPM20TEST_SOCKET_PORT"
+
+
+typedef enum {
+    UNKNOWN_TCTI,
+    DEVICE_TCTI,
+    SOCKET_TCTI,
+    N_TCTI,
+} TCTI_TYPE;
+
+typedef struct {
+    TCTI_TYPE tcti_type;
+    char     *device_file;
+    char     *socket_address;
+    uint16_t  socket_port;
+} test_opts_t;
+
+/* functions to get test options from the user and to print helpful stuff */
+char* const  tcti_name_from_type        (TCTI_TYPE             tcti_type);
+TCTI_TYPE    tcti_type_from_name        (char const           *tcti_str);
+int          get_test_opts_from_env     (test_opts_t          *opts);
+int          sanity_check_test_opts     (test_opts_t          *opts);
+void         dump_test_opts             (test_opts_t          *opts);
+
+#endif /* TEST_OPTIONS_H */
diff --git a/test/integration/test.h b/test/integration/test.h
new file mode 100644
index 0000000..90621b0
--- /dev/null
+++ b/test/integration/test.h
@@ -0,0 +1,12 @@
+#include "sapi/tpm20.h"
+
+/*
+ * This is the prototype for all integration tests in the TPM2.0-TSS
+ * project. Integration tests are intended to exercise the combined
+ * components in the software stack. This typically means executing some
+ * SAPI function using the socket TCTI to communicate with a software
+ * TPM2 simulator.
+ * Return values:
+ * A successful test will return 0, any other value indicates failure.
+ */
+int test_invoke (TSS2_SYS_CONTEXT *sapi_context);
diff --git a/test/marshal-UINT16_unit.c b/test/marshal-UINT16_unit.c
deleted file mode 100644
index c305819..0000000
--- a/test/marshal-UINT16_unit.c
+++ /dev/null
@@ -1,191 +0,0 @@
-#include <stdlib.h>
-#include <arpa/inet.h>
-#include <stdio.h>
-
-#include <setjmp.h>
-#include <cmocka.h>
-#include <tpm20.h>
-
-#include "sys_api_marshalUnmarshal.h"
-#include "sysapi_util.h"
-
-typedef struct {
-    uint8_t *buffer;
-    size_t   buffer_size;
-    uint16_t data_host;
-    uint16_t data_net;
-    TSS2_RC  rc;
-} marshal_uint16_data_t;
-
-void
-marshal_UINT16_setup (void **state)
-{
-    marshal_uint16_data_t *data;
-
-    data              = calloc (1, sizeof (marshal_uint16_data_t));
-    data->buffer      = calloc (1, sizeof (uint16_t));
-    data->buffer_size = sizeof (uint16_t);
-    data->data_host   = 0xdead;
-    data->data_net    = htons (data->data_host);
-    data->rc          = TSS2_RC_SUCCESS;
-
-    *state = data;
-}
-
-void
-marshal_UINT16_teardown (void **state)
-{
-    marshal_uint16_data_t *data;
-
-    data = (marshal_uint16_data_t*)*state;
-    if (data) {
-        if (data->buffer)
-            free (data->buffer);
-        free (data);
-    }
-}
-/**
- * Make a call to Marshal_UINT16 function that should succeed. The *_setup
- * function is expected to have allocated sufficient buffer to hold a
- * uint16_t. This test just 'marshals' a known uint16_t into this data buffer
- * and then compares the value to the expected result.
- * The workings of the Marshal_UINT16 function is a bit complex, so we
- * assert the expected results as well.
- */
-void
-marshal_UINT16_good (void **state)
-{
-    marshal_uint16_data_t *data;
-
-    data = (marshal_uint16_data_t*)*state;
-    uint8_t *nextData = data->buffer;
-
-    Marshal_UINT16 (data->buffer,
-                    data->buffer_size,
-                    &nextData,
-                    data->data_host,
-                    &data->rc);
-    /**
-     * uint16_t that was marshalled into the data buffer should be equal to
-     * the expected value (data converted from host byte order to network
-     * byte order).
-     */
-    assert_int_equal (*(uint16_t*)(data->buffer), data->data_net);
-    /**
-     * The Marshal_* functions advance the 'nextData' parameter by the size of
-     * the marshalled data.
-     */
-    assert_int_equal (data->buffer, nextData - sizeof (uint16_t));
-    /* Finally the return code should indicate success. */
-    assert_int_equal (data->rc, TSS2_RC_SUCCESS);
-}
-/**
- * Attempt to marshal a uint16_t into a buffer that's only got room for a
- * uint8_t. The call to the marshalling function should set the TSS2_RC value
- * to TSS2_SYS_RC_INSUFFICIENT_CONTEXT and the nextData parameter should not
- * be changed.
- */
-void
-marshal_UINT16_too_small (void **state)
-{
-    marshal_uint16_data_t *data;
-
-    data = (marshal_uint16_data_t*)*state;
-    /**
-     * Set the locate where data will be marshalled to half way through the
-     * buffer. This only leaves us space for a uint8_t.
-     */
-    uint8_t *nextData = data->buffer + sizeof (uint8_t);
-    data->buffer_size = sizeof (uint8_t);
-
-    Marshal_UINT16 (data->buffer,
-                    data->buffer_size,
-                    &nextData,
-                    data->data_host,
-                    &data->rc);
-    /**
-     * The return code should indicate we don't have enough space and the
-     * nextData pointer shouldn't have moved.
-     */
-    assert_int_equal (data->rc, TSS2_SYS_RC_INSUFFICIENT_CONTEXT);
-    assert_int_equal (data->buffer, nextData - sizeof (uint8_t));
-}
-void
-marshal_UINT16_under_ptr (void **state)
-{
-    marshal_uint16_data_t *data;
-
-    data = (marshal_uint16_data_t*)*state;
-    /**
-     * Set nextData to a byte *before* the buffer.
-     */
-    uint8_t *nextData = data->buffer - sizeof (uint8_t);
-    Marshal_UINT16 (data->buffer,
-                    data->buffer_size,
-                    &nextData,
-                    data->data_host,
-                    &data->rc);
-    /* again, not enough space, and no change to nextData */
-    assert_int_equal (data->rc, TSS2_SYS_RC_INSUFFICIENT_CONTEXT);
-    assert_int_equal (data->buffer, nextData - sizeof (uint8_t));
-}
-/**
- * Test error condition where nextData pointer is already beyond the end
- * of the data buffer. We set this value to 1 byte past the buffers end.
- * The expected result is the 'rc' parameter being set to indicate the
- * size of the buffer is insufficient. The nextData pointer should also
- * remain unchanged.
- */
-void
-marshal_UINT16_past_end (void **state)
-{
-    marshal_uint16_data_t *data;
-
-    data = (marshal_uint16_data_t*)*state;
-    /* Set nextData beyond the end of the buffer. */
-    uint8_t *nextData = data->buffer + data->buffer_size + sizeof (uint8_t);
-    Marshal_UINT16 (data->buffer,
-                    data->buffer_size,
-                    &nextData,
-                    data->data_host,
-                    &data->rc);
-    /* rc should indicate error and no change to the pointers */
-    assert_int_equal (data->rc, TSS2_SYS_RC_INSUFFICIENT_CONTEXT);
-    assert_int_equal (nextData,
-                      data->buffer + data->buffer_size + sizeof (uint8_t));
-}
-/**
- * Test an edge case where the 'rc' parameter is set to something other
- * than TSS2_RC_SUCCESS. A pattern I see emerging is the use of the TSS2_RC
- * member of the sapi context structure to skip over large blocks of code.
- * Many (most?) of the functions in the guts of the serialization logic check
- * this member data and quickly return when it's set. This is the reason
- * these fucntions often have no return value: they're using the 'rc' member
- * in the context structure.
- */
-void
-marshal_UINT16_rc_previous_fail (void **state)
-{
-    /* Set 'rc' to an error condition. */
-    TSS2_RC rc = TSS2_SYS_RC_BAD_SIZE;
-    /* 'rc' is checked first, all other parameters can be NULL.*/
-    Marshal_UINT16 (NULL, 0, NULL, 0, &rc);
-    assert_int_equal (rc, TSS2_SYS_RC_BAD_SIZE);
-}
-int
-main (void)
-{
-    const UnitTest tests [] = {
-        unit_test_setup_teardown (marshal_UINT16_good,
-                                  marshal_UINT16_setup,
-                                  marshal_UINT16_teardown),
-        unit_test_setup_teardown (marshal_UINT16_too_small,
-                                  marshal_UINT16_setup,
-                                  marshal_UINT16_teardown),
-        unit_test_setup_teardown (marshal_UINT16_past_end,
-                                  marshal_UINT16_setup,
-                                  marshal_UINT16_teardown),
-        unit_test (marshal_UINT16_rc_previous_fail),
-    };
-    return run_tests (tests);
-}
diff --git a/test/marshal-UINT32_unit.c b/test/marshal-UINT32_unit.c
deleted file mode 100644
index ae828cf..0000000
--- a/test/marshal-UINT32_unit.c
+++ /dev/null
@@ -1,191 +0,0 @@
-#include <stdlib.h>
-#include <arpa/inet.h>
-#include <stdio.h>
-
-#include <setjmp.h>
-#include <cmocka.h>
-#include <tpm20.h>
-
-#include "sys_api_marshalUnmarshal.h"
-#include "sysapi_util.h"
-
-typedef struct {
-    uint8_t *buffer;
-    size_t   buffer_size;
-    uint32_t data_host;
-    uint32_t data_net;
-    TSS2_RC  rc;
-} marshal_uint32_data_t;
-
-void
-marshal_UINT32_setup (void **state)
-{
-    marshal_uint32_data_t *data;
-
-    data              = calloc (1, sizeof (marshal_uint32_data_t));
-    data->buffer      = calloc (1, sizeof (uint32_t));
-    data->buffer_size = sizeof (uint32_t);
-    data->data_host   = 0xdeadbeef;
-    data->data_net    = htonl (data->data_host);
-    data->rc          = TSS2_RC_SUCCESS;
-
-    *state = data;
-}
-
-void
-marshal_UINT32_teardown (void **state)
-{
-    marshal_uint32_data_t *data;
-
-    data = (marshal_uint32_data_t*)*state;
-    if (data) {
-        if (data->buffer)
-            free (data->buffer);
-        free (data);
-    }
-}
-/**
- * Make a call to Marshal_UINT32 function that should succeed. The *_setup
- * function is expected to have allocated sufficient buffer to hold a
- * uint32_t. This test just 'marshals' a known uint32_t into this data buffer
- * and then compares the value to the expected result.
- * The workings of the Marshal_UINT32 function is a bit complex, so we
- * assert the expected results as well.
- */
-void
-marshal_UINT32_good (void **state)
-{
-    marshal_uint32_data_t *data;
-
-    data = (marshal_uint32_data_t*)*state;
-    uint8_t *nextData = data->buffer;
-
-    Marshal_UINT32 (data->buffer,
-                    data->buffer_size,
-                    &nextData,
-                    data->data_host,
-                    &data->rc);
-    /**
-     * uint32_t that was marshalled into the data buffer should be equal to
-     * the expected value (data converted from host byte order to network
-     * byte order).
-     */
-    assert_int_equal (*(uint32_t*)(data->buffer), data->data_net);
-    /**
-     * The Marshal_* functions advance the 'nextData' parameter by the size of
-     * the marshalled data.
-     */
-    assert_int_equal (data->buffer, nextData - sizeof (uint32_t));
-    /* Finally the return code should indicate success. */
-    assert_int_equal (data->rc, TSS2_RC_SUCCESS);
-}
-/**
- * Attempt to marshal a uint32_t into a buffer that's only got room for a
- * uint8_t. The call to the marshalling function should set the TSS2_RC value
- * to TSS2_SYS_RC_INSUFFICIENT_CONTEXT and the nextData parameter should not
- * be changed.
- */
-void
-marshal_UINT32_too_small (void **state)
-{
-    marshal_uint32_data_t *data;
-
-    data = (marshal_uint32_data_t*)*state;
-    /**
-     * Set the locate where data will be marshalled to half way through the
-     * buffer. This only leaves us space for a uint8_t.
-     */
-    uint8_t *nextData = data->buffer + sizeof (uint8_t);
-    data->buffer_size = sizeof (uint8_t);
-
-    Marshal_UINT32 (data->buffer,
-                    data->buffer_size,
-                    &nextData,
-                    data->data_host,
-                    &data->rc);
-    /**
-     * The return code should indicate we don't have enough space and the
-     * nextData pointer shouldn't have moved.
-     */
-    assert_int_equal (data->rc, TSS2_SYS_RC_INSUFFICIENT_CONTEXT);
-    assert_int_equal (data->buffer, nextData - sizeof (uint8_t));
-}
-void
-marshal_UINT32_under_ptr (void **state)
-{
-    marshal_uint32_data_t *data;
-
-    data = (marshal_uint32_data_t*)*state;
-    /**
-     * Set nextData to a byte *before* the buffer.
-     */
-    uint8_t *nextData = data->buffer - sizeof (uint8_t);
-    Marshal_UINT32 (data->buffer,
-                    data->buffer_size,
-                    &nextData,
-                    data->data_host,
-                    &data->rc);
-    /* again, not enough space, and no change to nextData */
-    assert_int_equal (data->rc, TSS2_SYS_RC_INSUFFICIENT_CONTEXT);
-    assert_int_equal (data->buffer, nextData - sizeof (uint8_t));
-}
-/**
- * Test error condition where nextData pointer is already beyond the end
- * of the data buffer. We set this value to 1 byte past the buffers end.
- * The expected result is the 'rc' parameter being set to indicate the
- * size of the buffer is insufficient. The nextData pointer should also
- * remain unchanged.
- */
-void
-marshal_UINT32_past_end (void **state)
-{
-    marshal_uint32_data_t *data;
-
-    data = (marshal_uint32_data_t*)*state;
-    /* Set nextData beyond the end of the buffer. */
-    uint8_t *nextData = data->buffer + data->buffer_size + sizeof (uint8_t);
-    Marshal_UINT32 (data->buffer,
-                    data->buffer_size,
-                    &nextData,
-                    data->data_host,
-                    &data->rc);
-    /* rc should indicate error and no change to the pointers */
-    assert_int_equal (data->rc, TSS2_SYS_RC_INSUFFICIENT_CONTEXT);
-    assert_int_equal (nextData,
-                      data->buffer + data->buffer_size + sizeof (uint8_t));
-}
-/**
- * Test an edge case where the 'rc' parameter is set to something other
- * than TSS2_RC_SUCCESS. A pattern I see emerging is the use of the TSS2_RC
- * member of the sapi context structure to skip over large blocks of code.
- * Many (most?) of the functions in the guts of the serialization logic check
- * this member data and quickly return when it's set. This is the reason
- * these fucntions often have no return value: they're using the 'rc' member
- * in the context structure.
- */
-void
-marshal_UINT32_rc_previous_fail (void **state)
-{
-    /* Set 'rc' to an error condition. */
-    TSS2_RC rc = TSS2_SYS_RC_BAD_SIZE;
-    /* 'rc' is checked first, all other parameters can be NULL.*/
-    Marshal_UINT32 (NULL, 0, NULL, 0, &rc);
-    assert_int_equal (rc, TSS2_SYS_RC_BAD_SIZE);
-}
-int
-main (void)
-{
-    const UnitTest tests [] = {
-        unit_test_setup_teardown (marshal_UINT32_good,
-                                  marshal_UINT32_setup,
-                                  marshal_UINT32_teardown),
-        unit_test_setup_teardown (marshal_UINT32_too_small,
-                                  marshal_UINT32_setup,
-                                  marshal_UINT32_teardown),
-        unit_test_setup_teardown (marshal_UINT32_past_end,
-                                  marshal_UINT32_setup,
-                                  marshal_UINT32_teardown),
-        unit_test (marshal_UINT32_rc_previous_fail),
-    };
-    return run_tests (tests);
-}
diff --git a/test/tcti_device.c b/test/tcti_device.c
deleted file mode 100644
index 0428fc8..0000000
--- a/test/tcti_device.c
+++ /dev/null
@@ -1,38 +0,0 @@
-#include <stdio.h>
-
-#include <setjmp.h>
-#include <cmocka.h>
-
-#include <sapi/tpm20.h>
-#include "tcti_device_test.h"
-#include "sysapi/include/tcti_util.h"
-
-static void
-tcti_dev_init_size_test (void **state)
-{
-    assert_int_equal(tcti_dev_init_size (state),
-                     sizeof (TSS2_TCTI_CONTEXT_INTEL));
-}
-
-static void
-tcti_dev_init_log_test (void **state)
-{
-    tcti_dev_init_log (state);
-}
-
-static void
-tcti_dev_log_called_test (void **state)
-{
-    assert_true (tcti_dev_log_called (state));
-}
-
-int
-main(int argc, char* argv[])
-{
-    const UnitTest tests[] = {
-        unit_test(tcti_dev_init_size_test),
-        unit_test(tcti_dev_init_log_test),
-        unit_test(tcti_dev_log_called_test),
-    };
-    return run_tests(tests);
-}
diff --git a/test/tcti_device_test.c b/test/tcti_device_test.c
deleted file mode 100644
index 1dce91a..0000000
--- a/test/tcti_device_test.c
+++ /dev/null
@@ -1,97 +0,0 @@
-#include <stdio.h>
-#include <tcti/tcti_device.h>
-#include <stdbool.h>
-#include "tcti/logging.h"
-#include <setjmp.h>
-#include <cmocka.h>
-
-/* Determine the size of a TCTI context structure. Requires calling the
- * initialization function for the device TCTI with the first parameter
- * (the TCTI context) NULL.
- */
-size_t
-tcti_dev_init_size (void **state)
-{
-    size_t tcti_size = 0;
-    TSS2_RC ret = TSS2_RC_SUCCESS;
-
-    ret = InitDeviceTcti (NULL, &tcti_size, NULL);
-    if (ret != TSS2_RC_SUCCESS)
-        return 0;
-    else
-        return tcti_size;
-}
-
-/* begin tcti_dev_init_log */
-/* This test configures the device TCTI with a logging callback and some user
- * data. It checks to be sure that the initialization function sets the
- * internal data in the TCTI to use / point to this data accordingly.
- */
-int
-tcti_dev_init_log_callback (void *data, printf_type type, const char *format, ...)
-{
-    return 0;
-}
-void
-tcti_dev_init_log (void **state)
-{
-    size_t tcti_size = 0;
-    uint8_t my_data = 0x9;
-    TSS2_RC ret = TSS2_RC_SUCCESS;
-    TSS2_TCTI_CONTEXT *ctx = NULL;
-    TCTI_DEVICE_CONF conf = {
-        "/dev/null", tcti_dev_init_log_callback, &my_data
-    };
-
-    ret = InitDeviceTcti (NULL, &tcti_size, NULL);
-    assert_true (ret == TSS2_RC_SUCCESS);
-    ctx = calloc (1, tcti_size);
-    assert_non_null (ctx);
-    ret = InitDeviceTcti (ctx, 0, &conf);
-    assert_true (ret == TSS2_RC_SUCCESS);
-    assert_true (TCTI_LOG_CALLBACK (ctx) == tcti_dev_init_log_callback);
-    assert_true (*(uint8_t*)TCTI_LOG_DATA (ctx) == my_data);
-    if (ctx)
-        free (ctx);
-}
-/* end tcti dev_init_log */
-
-/* begin tcti_dev_init_log_called */
-/* Initialize TCTI context providing a pointer to a logging function and some
- * data. The test case calls the logging function through the TCTI interface
- * and checks to be sure that the function is called and that the user data
- * provided is what we expect. We detect that the logging function was called
- * by having it change the user data provided and then detecting this change.
- * The caller responsible for freeing the context.
- */
-int
-tcti_dev_log_callback (void *data, printf_type type, const char *format, ...)
-{
-    *(bool*)data = true;
-    return 0;
-}
-
-bool
-tcti_dev_log_called (void **state)
-{
-    size_t tcti_size = 0;
-    bool called = false;
-    TSS2_RC ret = TSS2_RC_SUCCESS;
-    TSS2_TCTI_CONTEXT *ctx = NULL;
-    TCTI_DEVICE_CONF conf = {
-        "/dev/null", tcti_dev_log_callback, &called
-    };
-
-    ret = InitDeviceTcti (NULL, &tcti_size, NULL);
-    assert_true (ret == TSS2_RC_SUCCESS);
-    ctx = calloc (1, tcti_size);
-    assert_non_null (ctx);
-    ret = InitDeviceTcti (ctx, 0, &conf);
-    assert_true (ret == TSS2_RC_SUCCESS);
-    if (ctx)
-        free (ctx);
-    /* the 'called' variable should be changed from false to true after this */
-    TCTI_LOG (ctx, NO_PREFIX, "test log call");
-    return called;
-}
-/* end tcti_dev_init_log */
diff --git a/test/tcti_device_test.h b/test/tcti_device_test.h
deleted file mode 100644
index 06334a1..0000000
--- a/test/tcti_device_test.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <stddef.h>
-#include <stdbool.h>
-
-size_t tcti_dev_init_size (void **state);
-void tcti_dev_init_log (void **state);
-bool tcti_dev_log_called (void **state);
diff --git a/test/tpmclient/stdafx.cpp b/test/tpmclient/stdafx.cpp
deleted file mode 100644
index 40dd92c..0000000
--- a/test/tpmclient/stdafx.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-// stdafx.cpp : source file that includes just the standard includes
-// tpmclient.pch will be the pre-compiled header
-// stdafx.obj will contain the pre-compiled type information
-
-#include "stdafx.h"
-
-// TODO: reference any additional headers you need in STDAFX.H
-// and not in this file
diff --git a/test/tpmclient/stdafx.h b/test/tpmclient/stdafx.h
deleted file mode 100644
index b005a83..0000000
--- a/test/tpmclient/stdafx.h
+++ /dev/null
@@ -1,15 +0,0 @@
-// stdafx.h : include file for standard system include files,
-// or project specific include files that are used frequently, but
-// are changed infrequently
-//
-
-#pragma once
-
-#include "targetver.h"
-
-#include <stdio.h>
-#include <tchar.h>
-
-
-
-// TODO: reference additional headers your program requires here
diff --git a/test/tpmclient/targetver.h b/test/tpmclient/targetver.h
deleted file mode 100644
index 87c0086..0000000
--- a/test/tpmclient/targetver.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#pragma once
-
-// Including SDKDDKVer.h defines the highest available Windows platform.
-
-// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
-// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
-
-#include <SDKDDKVer.h>
diff --git a/test/tpmclient/tpmclient.cpp b/test/tpmclient/tpmclient.c
similarity index 98%
rename from test/tpmclient/tpmclient.cpp
rename to test/tpmclient/tpmclient.c
index 7480edc..d01c8f9 100644
--- a/test/tpmclient/tpmclient.cpp
+++ b/test/tpmclient/tpmclient.c
@@ -35,36 +35,26 @@
 #define SESSIONS_COUNT 5
 #endif
 
-#ifdef _WIN32
-#include "stdafx.h"
-#else
 #include <stdarg.h>
-#endif
+#include <stdbool.h>
 
 #ifndef UNICODE
 #define UNICODE 1
 #endif
 
-#ifdef _WIN32
-// link with Ws2_32.lib
-#pragma comment(lib,"Ws2_32.lib")
-
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#else
 #define sprintf_s   snprintf
 #define sscanf_s    sscanf
-#endif
 
 #include <stdio.h>
 #include <stdlib.h>   // Needed for _wtoi
 #include <string.h>
 
-#include <sapi/tpm20.h>
+#include "marshal/base-types.h"
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
-#include "sample.h"
+#include "test/common/sample/sample.h"
 #include "tpmclient.h"
-#include "tcti_util.h"
+#include "common/tcti_util.h"
 
 // This is done to allow the tests to access fields
 // in the sysContext structure that are needed for
@@ -74,10 +64,10 @@
 //
 #include "sysapi_util.h"
 
-#include <tcti/tcti_device.h>
-#include <tcti/tcti_socket.h>
-#include "syscontext.h"
-#include "debug.h"
+#include "tcti/tcti_device.h"
+#include "tcti/tcti_socket.h"
+#include "common/syscontext.h"
+#include "common/debug.h"
 
 //
 // TPM indices and sizes
@@ -201,9 +191,11 @@
 
 TPM_RC CompareTPM2B( TPM2B *buffer1, TPM2B *buffer2 )
 {
+    int i;
+
     if( buffer1->size != buffer2->size )
         return TPM_RC_FAILURE;
-    for( int i = 0; i < buffer1->size; i++ )
+    for( i = 0; i < buffer1->size; i++ )
     {
         if( buffer1->buffer[0] != buffer2->buffer[0] )
             return TPM_RC_FAILURE;
@@ -304,9 +296,6 @@
         TeardownTctiContext( &resMgrTctiContext );
     }
 
-#ifdef _WIN32
-    WSACleanup();
-#endif
     exit(1);
 }
 
@@ -1266,23 +1255,6 @@
 }
 
 
-void TestTpmSelftest()
-{
-    UINT32 rval;
-
-    DebugPrintf( NO_PREFIX, "\nSELFTEST TESTS:\n" );
-
-    rval = Tss2_Sys_SelfTest( sysContext, 0, YES, 0);
-    CheckPassed( rval );
-
-    rval = Tss2_Sys_SelfTest( sysContext, 0, NO, 0);
-    CheckPassed( rval );
-
-    rval = Tss2_Sys_SelfTest( sysContext, 0, YES, 0);
-    CheckPassed( rval );
-
-}
-
 void TestTpmGetCapability()
 {
     UINT32 rval;
@@ -1428,7 +1400,7 @@
     UINT32 rval;
     TPM2B_ENCRYPTED_SECRET encryptedSalt;
     TPMT_SYM_DEF symmetric;
-    SESSION *authSession;
+    SESSION *authSession = NULL;
     TPM2B_NONCE nonceCaller;
     UINT16 i;
 #ifdef DEBUG_GAP_HANDLING
@@ -1908,28 +1880,6 @@
     CheckPassed( rval );
 }
 
-void TestGetRandom()
-{
-    UINT32 rval;
-    TPM2B_DIGEST        randomBytes1, randomBytes2;
-
-    DebugPrintf( NO_PREFIX, "\nGET_RANDOM TESTS:\n" );
-
-    INIT_SIMPLE_TPM2B_SIZE( randomBytes1 );
-    rval = Tss2_Sys_GetRandom( sysContext, 0, 20, &randomBytes1, 0 );
-    CheckPassed( rval );
-
-    INIT_SIMPLE_TPM2B_SIZE( randomBytes2 );
-    rval = Tss2_Sys_GetRandom( sysContext, 0, 20, &randomBytes2, 0 );
-    CheckPassed( rval );
-
-    if( 0 == memcmp( &randomBytes1, &randomBytes2, 20 ) )
-    {
-        DebugPrintf( NO_PREFIX, "ERROR!! Random value is the same\n" );
-        Cleanup();
-    }
-}
-
 void TestShutdown()
 {
     UINT32 rval;
@@ -1989,12 +1939,13 @@
     DebugPrintf( NO_PREFIX, "\nNV INDEX TESTS:\n" );
 
     nvAuth.t.size = 20;
-    for( i = 0; i < nvAuth.t.size; i++ )
+    for( i = 0; i < nvAuth.t.size; i++ ) {
         nvAuth.t.buffer[i] = (UINT8)i;
+    }
 
-	publicInfo.t.size = sizeof( TPMI_RH_NV_INDEX ) +
-            sizeof( TPMI_ALG_HASH ) + sizeof( TPMA_NV ) + sizeof( UINT16) +
-            sizeof( UINT16 );
+    publicInfo.t.size = sizeof( TPMI_RH_NV_INDEX ) +
+        sizeof( TPMI_ALG_HASH ) + sizeof( TPMA_NV ) + sizeof( UINT16) +
+        sizeof( UINT16 );
     publicInfo.t.nvPublic.nvIndex = TPM20_INDEX_TEST1;
     publicInfo.t.nvPublic.nameAlg = TPM_ALG_SHA1;
 
@@ -2218,12 +2169,13 @@
     DebugPrintf( NO_PREFIX, "\nHIERARCHY CONTROL TESTS:\n" );
 
     nvAuth.t.size = 20;
-    for( i = 0; i < nvAuth.t.size; i++ )
+    for( i = 0; i < nvAuth.t.size; i++ ) {
         nvAuth.t.buffer[i] = i;
+    }
 
-	publicInfo.t.size = sizeof( TPMI_RH_NV_INDEX ) +
-            sizeof( TPMI_ALG_HASH ) + sizeof( TPMA_NV ) + sizeof( UINT16) +
-            sizeof( UINT16 );
+    publicInfo.t.size = sizeof( TPMI_RH_NV_INDEX ) +
+        sizeof( TPMI_ALG_HASH ) + sizeof( TPMA_NV ) + sizeof( UINT16) +
+        sizeof( UINT16 );
     publicInfo.t.nvPublic.nvIndex = TPM20_INDEX_TEST1;
     publicInfo.t.nvPublic.nameAlg = TPM_ALG_SHA1;
 
@@ -3998,12 +3950,13 @@
     sessionsData.cmdAuths[0] = &sessionData;
 
     nvAuth.t.size = strlen( password );
-    for( i = 0; i < nvAuth.t.size; i++ )
+    for( i = 0; i < nvAuth.t.size; i++ ) {
         nvAuth.t.buffer[i] = password[i];
+    }
 
-	publicInfo.t.size = sizeof( TPMI_RH_NV_INDEX ) +
-            sizeof( TPMI_ALG_HASH ) + sizeof( TPMA_NV ) + sizeof( UINT16) +
-            sizeof( UINT16 );
+    publicInfo.t.size = sizeof( TPMI_RH_NV_INDEX ) +
+        sizeof( TPMI_ALG_HASH ) + sizeof( TPMA_NV ) + sizeof( UINT16) +
+        sizeof( UINT16 );
     publicInfo.t.nvPublic.nvIndex = nvIndex;
     publicInfo.t.nvPublic.nameAlg = TPM_ALG_SHA1;
 
@@ -4122,7 +4075,7 @@
 {
     UINT32 rval, sessionCmdRval;
     TPM2B_AUTH  nvAuth;
-    SESSION *nvSession, *trialPolicySession;
+    SESSION *nvSession = NULL, *trialPolicySession = NULL;
     TPMA_NV nvAttributes;
     TPM2B_DIGEST authPolicy;
     TPM2B_NAME nvName;
@@ -4388,7 +4341,7 @@
 {
     UINT32 rval, sessionCmdRval;
     TPM2B_AUTH  nvAuth;
-    SESSION *nvSession;
+    SESSION *nvSession = NULL;
     TPMA_NV nvAttributes;
     TPM2B_DIGEST authPolicy;
     TPM2B_NAME nvName;
@@ -4996,13 +4949,14 @@
 void HmacSessionTest()
 {
     UINT32 rval;
-    unsigned int i, j, k, decryptEncryptMode;
+    int i, j, k;
+    unsigned int decryptEncryptMode;
     TPM2B_MAX_NV_BUFFER nvWriteData;
     UINT8 dataToWrite[] = { 0x00, 0xff, 0x55, 0xaa };
     TPM2B_NAME nvName;
     TPM_RC sessionCmdRval;
 
-    SESSION *nvSession;
+    SESSION *nvSession = NULL;
     TSS2_SYS_CONTEXT *rdSysContext;
     TSS2_SYS_CONTEXT *wrSysContext;
     TPM2B_AUTH  nvAuth;
@@ -5058,7 +5012,7 @@
         // Iterate through variations of decrypt and encrypt sessions.
         for( k = 0; k < sizeof( decryptEncryptSetups ); k++ )
         {
-            for( decryptEncryptMode = CFB_MODE; decryptEncryptMode < XOR_MODE; decryptEncryptMode++ )
+            for( decryptEncryptMode = CFB_MODE; decryptEncryptMode <= XOR_MODE; decryptEncryptMode++ )
             {
                 TPMS_AUTH_COMMAND sessionData = { TPM_RS_PW, };
                 TPMS_AUTH_RESPONSE sessionDataOut;
@@ -5432,7 +5386,7 @@
 void TestEncryptDecryptSession()
 {
     TSS2_RC             rval = TSS2_RC_SUCCESS;
-    SESSION             *encryptDecryptSession;
+    SESSION             *encryptDecryptSession = NULL;
     TPMT_SYM_DEF        symmetric;
     TPM2B_MAX_NV_BUFFER writeData, encryptedWriteData;
     TPM2B_MAX_NV_BUFFER encryptedReadData, decryptedReadData,
@@ -6069,7 +6023,7 @@
     }
 
     rval = Tss2_Sys_Startup( testSysContext, TPM_SU_CLEAR );
-    CheckFailed( rval, TSS2_SYS_RC_INSUFFICIENT_CONTEXT );
+    CheckFailed( rval, TSS2_TYPES_RC_INSUFFICIENT_BUFFER );
 
 	rval = Tss2_Sys_GetTestResult_Prepare( testSysContext );
 	CheckPassed( rval );
@@ -6154,7 +6108,7 @@
 
 void  RmZeroSizedResponseTest()
 {
-    SESSION *encryptSession;
+    SESSION *encryptSession = NULL;
     TPM2B_NONCE nonceCaller;
     TPMT_SYM_DEF symmetric;
 	TSS2_RC rval = TSS2_RC_SUCCESS;
@@ -6189,7 +6143,8 @@
 
 void CmdRspAuthsTests()
 {
-    SESSION *encryptSession, *decryptSession, *auditSession;
+    SESSION *encryptSession = NULL, *decryptSession = NULL,
+        *auditSession = NULL;
     TPM2B_NONCE nonceCaller, nonceTpm;
     TPMT_SYM_DEF symmetric;
 	TSS2_RC rval = TSS2_RC_SUCCESS;
@@ -6329,7 +6284,7 @@
     ( (_TSS2_SYS_CONTEXT_BLOB *)sysContext )->maxCommandSize = savedMaxCommandSize;
 
     // Setup for response auths test.
-    ( (_TSS2_SYS_CONTEXT_BLOB *)sysContext )->maxCommandSize = CHANGE_ENDIAN_DWORD( savedMaxCommandSize );
+    ( (_TSS2_SYS_CONTEXT_BLOB *)sysContext )->maxCommandSize = BE_TO_HOST_32( savedMaxCommandSize );
     rval = Tss2_Sys_SetCmdAuths( sysContext, &cmdAuths );
     CheckPassed( rval ); // #15
 
@@ -6405,19 +6360,19 @@
     // Test for non-matching count: cmd auth count doesn't
     // match returned auth count.
     rspAuths.rspAuthsCount = 3;
-    savedResponseSize = CHANGE_ENDIAN_DWORD( ( (TPM20_Header_Out *)( ( (_TSS2_SYS_CONTEXT_BLOB *)sysContext )->tpmOutBuffPtr ) )->responseSize );
-    ( (TPM20_Header_Out *)( ( (_TSS2_SYS_CONTEXT_BLOB *)sysContext )->tpmOutBuffPtr ) )->responseSize = CHANGE_ENDIAN_DWORD( savedResponseSize - 5 );
+    savedResponseSize = ( (_TSS2_SYS_CONTEXT_BLOB *)sysContext )->rsp_header.size;
+    ( (_TSS2_SYS_CONTEXT_BLOB *)sysContext )->rsp_header.size = savedResponseSize - 5;
     rval = Tss2_Sys_GetRspAuths( sysContext, &rspAuths );
     CheckFailed( rval, TSS2_SYS_RC_INVALID_SESSIONS ); // #15
 
     // Test for malformed response.
     rspAuths.rspAuthsCount = 2;
-    ( (TPM20_Header_Out *)( ( (_TSS2_SYS_CONTEXT_BLOB *)sysContext )->tpmOutBuffPtr ) )->responseSize = CHANGE_ENDIAN_DWORD( savedResponseSize - 7 );
+    ( (_TSS2_SYS_CONTEXT_BLOB *)sysContext )->rsp_header.size = savedResponseSize - 7;
     rval = Tss2_Sys_GetRspAuths( sysContext, &rspAuths );
     CheckFailed( rval, TSS2_SYS_RC_MALFORMED_RESPONSE ); // #16
 
     // Ths one should pass.
-    ( (TPM20_Header_Out *)( ( (_TSS2_SYS_CONTEXT_BLOB *)sysContext )->tpmOutBuffPtr ) )->responseSize = CHANGE_ENDIAN_DWORD( savedResponseSize );
+    ( (_TSS2_SYS_CONTEXT_BLOB *)sysContext )->rsp_header.size = savedResponseSize;
     rval = Tss2_Sys_GetRspAuths( sysContext, &rspAuths );
     CheckPassed( rval ); // #17
 
@@ -7129,7 +7084,8 @@
     rval = Tss2_Sys_RSA_Encrypt(sysContext, keyHandle, 0, &message, &inScheme, &outsideInfo, &outData, &sessionsDataOut);
     CheckPassed( rval );
 
-    for (int i=0; i<message.t.size; i++)
+    int i;
+    for (i=0; i<message.t.size; i++)
     	printf("\nlabel size:%d, label buffer:%x, outData size:%d, outData buffer:%x, msg size:%d, msg buffer:%x", outsideInfo.t.size, outsideInfo.t.buffer[i], outData.t.size, outData.t.buffer[i], message.t.size, message.t.buffer[i]);
     CheckPassed(rval);
 }
@@ -7214,8 +7170,9 @@
 
     GetSetDecryptParamTests();
 
-#ifdef _WIN32
-    // This test can only be run agains the simulator
+#ifdef SKIP_RM_ZERO_SIZED_RESPONSE_TEST
+    printf("*** Skipping rm zero sized response tests\n");
+#else
     RmZeroSizedResponseTest();
 #endif
 
@@ -7241,8 +7198,6 @@
     // Clear DA lockout.
     TestDictionaryAttackLockReset();
 
-    TestTpmSelftest();
-
     TestDictionaryAttackLockReset();
 
     TestCreate();
@@ -7292,8 +7247,6 @@
 
         TestHierarchyChangeAuth();
 
-        TestGetRandom();
-
         if( i < 2 )
             TestShutdown();
 
@@ -7448,7 +7401,7 @@
             }
         }
     }
-#if __linux || __unix
+#if defined(__linux__) || defined(__unix__)
     if( testLocalTcti )
     {
         TestLocalTCTI();
@@ -7459,9 +7412,6 @@
     if( rval != TSS2_RC_SUCCESS )
     {
         DebugPrintf( NO_PREFIX, "Resource Mgr, %s, failed initialization: 0x%x.  Exiting...\n", resMgrInterfaceName, rval );
-#ifdef _WIN32
-        WSACleanup();
-#endif
         if( resMgrTctiContext != 0 )
             free( resMgrTctiContext );
 
diff --git a/test/tpmclient/tpmclient_wo_rm.h b/test/tpmclient/tpmclient_wo_rm.h
index 93cb960..1376337 100644
--- a/test/tpmclient/tpmclient_wo_rm.h
+++ b/test/tpmclient/tpmclient_wo_rm.h
@@ -55,3 +55,5 @@
 // Skipping to avoid hang
 #define SKIP_RM_TEST
 
+// Skip go avoid error TCTI Error 0xa000 when RmZeroSizedResponseTest is run
+#define SKIP_RM_ZERO_SIZED_RESPONSE_TEST
diff --git a/test/CommonPreparePrologue_unit.c b/test/unit/CommonPreparePrologue.c
similarity index 98%
rename from test/CommonPreparePrologue_unit.c
rename to test/unit/CommonPreparePrologue.c
index eb88b4a..a8f36f1 100644
--- a/test/CommonPreparePrologue_unit.c
+++ b/test/unit/CommonPreparePrologue.c
@@ -3,8 +3,8 @@
 
 #include <setjmp.h>
 #include <cmocka.h>
-#include <tpm20.h>
 
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 #define MAX_SIZE_CTX 4096
diff --git a/test/CopyCommandHeader_unit.c b/test/unit/CopyCommandHeader.c
similarity index 95%
rename from test/CopyCommandHeader_unit.c
rename to test/unit/CopyCommandHeader.c
index f88b821..0640b3f 100644
--- a/test/CopyCommandHeader_unit.c
+++ b/test/unit/CopyCommandHeader.c
@@ -5,7 +5,7 @@
 #include <setjmp.h>
 #include <cmocka.h>
 
-#include "tpm20.h"
+#include "sapi/tpm20.h"
 #include "sysapi_util.h"
 
 #define MAX_SIZE_CTX 4096
@@ -27,6 +27,8 @@
      *  must point to the data after the context structure.
      */
     sys_ctx->tpmInBuffPtr = (UINT8*) (sys_ctx + sizeof (_TSS2_SYS_CONTEXT_BLOB));
+    InitSysContextFields ((TSS2_SYS_CONTEXT*)sys_ctx);
+    InitSysContextPtrs ((TSS2_SYS_CONTEXT*)sys_ctx, size_ctx);
 
     *state = sys_ctx;
 }
diff --git a/test/GetNumHandles_unit.c b/test/unit/GetNumHandles.c
similarity index 100%
rename from test/GetNumHandles_unit.c
rename to test/unit/GetNumHandles.c
diff --git a/test/unit/UINT16-marshal.c b/test/unit/UINT16-marshal.c
new file mode 100644
index 0000000..146add8
--- /dev/null
+++ b/test/unit/UINT16-marshal.c
@@ -0,0 +1,225 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <setjmp.h>
+#include <cmocka.h>
+
+#include "sapi/marshal.h"
+
+/*
+ * Test case for successful UINT16 marshaling with NULL offset.
+ */
+void
+UINT16_marshal_success (void **state)
+{
+    UINT16   src = 0xdead;
+    uint8_t buffer [2] = { 0 };
+    size_t  buffer_size = sizeof (buffer);
+    TSS2_RC rc;
+
+    rc = UINT16_Marshal (src, buffer, buffer_size, NULL);
+
+    assert_int_equal (rc, TSS2_RC_SUCCESS);
+    assert_int_equal (0xde, buffer [0]);
+    assert_int_equal (0xad, buffer [1]);
+}
+/*
+ * Test case for successful UINT16 marshaling with offset.
+ */
+void
+UINT16_marshal_success_offset (void **state)
+{
+    UINT16 src = 0xbeef;
+    uint8_t buffer [3] = { 0 };
+    size_t  buffer_size = sizeof (buffer);
+    size_t  offset = 1;
+    TSS2_RC rc;
+
+    rc = UINT16_Marshal (src, buffer, buffer_size, &offset);
+
+    assert_int_equal (rc, TSS2_RC_SUCCESS);
+    assert_int_equal ((src & 0xff00) >> 8, buffer [1]);
+    assert_int_equal (src & 0xff, buffer [2]);
+    assert_int_equal (offset, sizeof (buffer));
+}
+/*
+ * Test case passing NULL buffer and non-NULL offset. Test to be sure offset
+ * is updated to the size of the src parameter.
+ */
+void
+UINT16_marshal_buffer_null_with_offset (void **state)
+{
+    UINT16 src = 0xdead;
+    size_t offset = 100;
+    TSS2_RC rc;
+
+    rc = UINT16_Marshal (src, NULL, 2, &offset);
+
+    assert_int_equal (rc, TSS2_RC_SUCCESS);
+    assert_int_equal (offset, 100 + sizeof (src));
+}
+/*
+ * Test case passing NULL buffer and NULL offset.
+ */
+void
+UINT16_marshal_buffer_null_offset_null (void **state)
+{
+    UINT16 src = 0xbeef;
+    TSS2_RC rc;
+
+    rc = UINT16_Marshal (src, NULL, sizeof (src), NULL);
+
+    assert_int_equal (rc, TSS2_TYPES_RC_BAD_REFERENCE);
+}
+/*
+ * Test failing case where buffer_size - offset (size of available space
+ * in buffer) is less than sizeof (UINT16). Also check offset is unchanged.
+ */
+void
+UINT16_marshal_buffer_size_lt_data (void **state)
+{
+    UINT16   src = 0xdead;
+    uint8_t buffer [2] = { 0 };
+    size_t  offset = 2;
+    TSS2_RC rc;
+
+    rc = UINT16_Marshal (src, buffer, sizeof (src), &offset);
+
+    assert_int_equal (rc, TSS2_TYPES_RC_INSUFFICIENT_BUFFER);
+    assert_int_equal (offset, 2);
+}
+/*
+ * Test failing case where buffer_size is less than the offset value.
+ * This should return INSUFFICIENT_BUFFER and the offset should be unchanged.
+ */
+void
+UINT16_marshal_buffer_size_lt_offset (void **state)
+{
+    UINT16   src = 0xbeef;
+    uint8_t buffer [2] = { 0 };
+    size_t  buffer_size = sizeof (buffer);
+    size_t  offset = sizeof (buffer) + 1;
+    TSS2_RC rc;
+
+    rc = UINT16_Marshal (src, buffer, buffer_size, &offset);
+
+    assert_int_equal (rc, TSS2_TYPES_RC_INSUFFICIENT_BUFFER);
+    assert_int_equal (offset, sizeof (buffer) + 1);
+}
+/*
+ * Test case for successful UINT16 unmarshaling.
+ */
+void
+UINT16_unmarshal_success (void **state)
+{
+    uint8_t buffer [2] = { 0xde, 0xad };
+    uint8_t buffer_size = sizeof (buffer);
+    UINT16   dest = 0;
+    TSS2_RC rc;
+
+    rc = UINT16_Unmarshal (buffer, buffer_size, NULL, &dest);
+
+    assert_int_equal (rc, TSS2_RC_SUCCESS);
+    assert_int_equal (buffer [0], (dest & 0xff00) >> 8);
+    assert_int_equal (buffer [1], (dest & 0xff));
+}
+/*
+ * Test case for successful UINT16 unmarshaling with offset.
+ */
+void
+UINT16_unmarshal_success_offset (void **state)
+{
+    UINT16   dest = 0;
+    uint8_t buffer [3] = { 0xbe, 0xef };
+    size_t  buffer_size = sizeof (buffer);
+    size_t  offset = 1;
+    TSS2_RC rc;
+
+    rc = UINT16_Unmarshal (buffer, buffer_size, &offset, &dest);
+
+    assert_int_equal (rc, TSS2_RC_SUCCESS);
+    assert_int_equal (buffer [1], (dest & 0xff00) >> 8);
+    assert_int_equal (buffer [2], (dest & 0xff) >> 8);
+    assert_int_equal (offset, 3);
+}
+/*
+ * Test case ensures a NULL buffer parameter produces a BAD_REFERENCE RC.
+ */
+void
+UINT16_unmarshal_buffer_null (void **state)
+{
+    TSS2_RC rc;
+
+    rc = UINT16_Unmarshal (NULL, 1, NULL, NULL);
+
+    assert_int_equal (rc, TSS2_TYPES_RC_BAD_REFERENCE);
+}
+/*
+ * Test case ensures a NULL dest and offset parameters produce an
+ * INSUFFICIENT_BUFFER RC.
+ */
+void
+UINT16_unmarshal_dest_null (void **state)
+{
+    uint8_t buffer [1];
+    TSS2_RC rc;
+
+    rc = UINT16_Unmarshal (buffer, sizeof (buffer), NULL, NULL);
+
+    assert_int_equal (rc, TSS2_TYPES_RC_BAD_REFERENCE);
+}
+/*
+ * Test case ensures that INSUFFICIENT_BUFFER is returned when buffer_size
+ * is less than the provided offset.
+ */
+void
+UINT16_unmarshal_buffer_size_lt_offset (void **state)
+{
+    UINT16   dest = 0;
+    uint8_t buffer [1];
+    size_t  offset = sizeof (buffer) + 1;
+    TSS2_RC rc;
+
+    rc = UINT16_Unmarshal (buffer, sizeof (buffer), &offset, &dest);
+
+    assert_int_equal (rc, TSS2_TYPES_RC_INSUFFICIENT_BUFFER);
+    assert_int_equal (offset, sizeof (buffer) + 1);
+    assert_int_equal (dest, 0);
+}
+/*
+ * Test case ensures that INSUFFICIENT_BUFFER is returned when buffer_size -
+ * local_offset is less than dest (the destination type).
+ */
+void
+UINT16_unmarshal_buffer_size_lt_dest (void **state)
+{
+    UINT16   dest = 0;
+    uint8_t buffer [1];
+    size_t  offset = sizeof (buffer);
+    TSS2_RC rc;
+
+    rc = UINT16_Unmarshal (buffer, sizeof (buffer), &offset, &dest);
+
+    assert_int_equal (rc, TSS2_TYPES_RC_INSUFFICIENT_BUFFER);
+    assert_int_equal (offset, sizeof (buffer));
+    assert_int_equal (dest, 0);
+}
+int
+main (void)
+{
+    const UnitTest tests [] = {
+        unit_test (UINT16_marshal_success),
+        unit_test (UINT16_marshal_success_offset),
+        unit_test (UINT16_marshal_buffer_null_with_offset),
+        unit_test (UINT16_marshal_buffer_null_offset_null),
+        unit_test (UINT16_marshal_buffer_size_lt_data),
+        unit_test (UINT16_marshal_buffer_size_lt_offset),
+        unit_test (UINT16_unmarshal_success),
+        unit_test (UINT16_unmarshal_success_offset),
+        unit_test (UINT16_unmarshal_buffer_null),
+        unit_test (UINT16_unmarshal_dest_null),
+        unit_test (UINT16_unmarshal_buffer_size_lt_offset),
+        unit_test (UINT16_unmarshal_buffer_size_lt_dest),
+    };
+    return run_tests (tests);
+}
diff --git a/test/unit/UINT32-marshal.c b/test/unit/UINT32-marshal.c
new file mode 100644
index 0000000..514c7ea
--- /dev/null
+++ b/test/unit/UINT32-marshal.c
@@ -0,0 +1,226 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <setjmp.h>
+#include <cmocka.h>
+
+#include "marshal/base-types.h"
+#include "sapi/marshal.h"
+
+/*
+ * Test case for successful UINT32 marshaling with NULL offset.
+ */
+void
+UINT32_marshal_success (void **state)
+{
+    UINT32   src = 0xdeadbeef, tmp = 0;
+    uint8_t buffer [4] = { 0 };
+    size_t  buffer_size = sizeof (buffer);
+    TSS2_RC rc;
+
+    rc = UINT32_Marshal (src, buffer, buffer_size, NULL);
+
+    tmp = HOST_TO_BE_32 (src);
+    assert_int_equal (rc, TSS2_RC_SUCCESS);
+    assert_memory_equal (&tmp, buffer, sizeof (tmp));
+}
+/*
+ * Test case for successful UINT32 marshaling with offset.
+ */
+void
+UINT32_marshal_success_offset (void **state)
+{
+    UINT32 src = 0xdeadbeef, tmp = 0;
+    uint8_t buffer [5] = { 0 };
+    size_t  buffer_size = sizeof (buffer);
+    size_t  offset = 1;
+    TSS2_RC rc;
+
+    rc = UINT32_Marshal (src, buffer, buffer_size, &offset);
+    tmp = HOST_TO_BE_32 (src);
+
+    assert_int_equal (rc, TSS2_RC_SUCCESS);
+    assert_memory_equal (&tmp, &buffer [1], sizeof (tmp));
+    assert_int_equal (offset, sizeof (buffer));
+}
+/*
+ * Test case passing NULL buffer and non-NULL offset. Test to be sure offset
+ * is updated to the size of the src parameter.
+ */
+void
+UINT32_marshal_buffer_null_with_offset (void **state)
+{
+    UINT32 src = 0xdeadbeef;
+    size_t offset = 100;
+    TSS2_RC rc;
+
+    rc = UINT32_Marshal (src, NULL, 2, &offset);
+
+    assert_int_equal (rc, TSS2_RC_SUCCESS);
+    assert_int_equal (offset, 100 + sizeof (src));
+}
+/*
+ * Test case passing NULL buffer and NULL offset.
+ */
+void
+UINT32_marshal_buffer_null_offset_null (void **state)
+{
+    UINT32 src = 0xdeadbeef;
+    TSS2_RC rc;
+
+    rc = UINT32_Marshal (src, NULL, sizeof (src), NULL);
+
+    assert_int_equal (rc, TSS2_TYPES_RC_BAD_REFERENCE);
+}
+/*
+ * Test failing case where buffer_size - offset (size of available space
+ * in buffer) is less than sizeof (UINT32). Also check offset is unchanged.
+ */
+void
+UINT32_marshal_buffer_size_lt_data (void **state)
+{
+    UINT32   src = 0xdeadbeef;
+    uint8_t buffer [4] = { 0 };
+    size_t  offset = 2;
+    TSS2_RC rc;
+
+    rc = UINT32_Marshal (src, buffer, sizeof (src), &offset);
+
+    assert_int_equal (rc, TSS2_TYPES_RC_INSUFFICIENT_BUFFER);
+    assert_int_equal (offset, 2);
+}
+/*
+ * Test failing case where buffer_size is less than the offset value.
+ * This should return INSUFFICIENT_BUFFER and the offset should be unchanged.
+ */
+void
+UINT32_marshal_buffer_size_lt_offset (void **state)
+{
+    UINT32   src = 0xdeadbeef;
+    uint8_t buffer [4] = { 0 };
+    size_t  buffer_size = sizeof (buffer);
+    size_t  offset = sizeof (buffer) + 1;
+    TSS2_RC rc;
+
+    rc = UINT32_Marshal (src, buffer, buffer_size, &offset);
+
+    assert_int_equal (rc, TSS2_TYPES_RC_INSUFFICIENT_BUFFER);
+    assert_int_equal (offset, sizeof (buffer) + 1);
+}
+/*
+ * Test case for successful UINT32 unmarshaling.
+ */
+void
+UINT32_unmarshal_success (void **state)
+{
+    uint8_t buffer [4] = { 0xde, 0xad, 0xbe, 0xef };
+    uint8_t buffer_size = sizeof (buffer);
+    UINT32   dest = 0, tmp = 0;
+    TSS2_RC rc;
+
+    rc = UINT32_Unmarshal (buffer, buffer_size, NULL, &dest);
+    tmp = HOST_TO_BE_32 (dest);
+
+    assert_int_equal (rc, TSS2_RC_SUCCESS);
+    assert_memory_equal (&tmp, buffer, sizeof (tmp));
+}
+/*
+ * Test case for successful UINT32 unmarshaling with offset.
+ */
+void
+UINT32_unmarshal_success_offset (void **state)
+{
+    UINT32   dest = 0, tmp = 0;
+    uint8_t buffer [5] = { 0xff, 0xde, 0xad, 0xbe, 0xef };
+    size_t  buffer_size = sizeof (buffer);
+    size_t  offset = 1;
+    TSS2_RC rc;
+
+    rc = UINT32_Unmarshal (buffer, buffer_size, &offset, &dest);
+    tmp = HOST_TO_BE_32 (dest);
+
+    assert_int_equal (rc, TSS2_RC_SUCCESS);
+    assert_memory_equal (&tmp, &buffer [1], sizeof (tmp));
+    assert_int_equal (offset, 5);
+}
+/*
+ * Test case ensures a NULL buffer parameter produces a BAD_REFERENCE RC.
+ */
+void
+UINT32_unmarshal_buffer_null (void **state)
+{
+    TSS2_RC rc;
+
+    rc = UINT32_Unmarshal (NULL, 1, NULL, NULL);
+
+    assert_int_equal (rc, TSS2_TYPES_RC_BAD_REFERENCE);
+}
+/*
+ * Test case ensures a NULL dest and offset parameters produce an
+ * INSUFFICIENT_BUFFER RC.
+ */
+void
+UINT32_unmarshal_dest_null (void **state)
+{
+    uint8_t buffer [1];
+    TSS2_RC rc;
+
+    rc = UINT32_Unmarshal (buffer, sizeof (buffer), NULL, NULL);
+
+    assert_int_equal (rc, TSS2_TYPES_RC_BAD_REFERENCE);
+}
+/*
+ * Test case ensures that INSUFFICIENT_BUFFER is returned when buffer_size
+ * is less than the provided offset.
+ */
+void
+UINT32_unmarshal_buffer_size_lt_offset (void **state)
+{
+    UINT32   dest = 0;
+    uint8_t buffer [1];
+    size_t  offset = sizeof (buffer) + 1;
+    TSS2_RC rc;
+
+    rc = UINT32_Unmarshal (buffer, sizeof (buffer), &offset, &dest);
+
+    assert_int_equal (rc, TSS2_TYPES_RC_INSUFFICIENT_BUFFER);
+    assert_int_equal (offset, sizeof (buffer) + 1);
+    assert_int_equal (dest, 0);
+}
+/*
+ * Test case ensures that INSUFFICIENT_BUFFER is returned when buffer_size -
+ * local_offset is less than dest (the destination type).
+ */
+void
+UINT32_unmarshal_buffer_size_lt_dest (void **state)
+{
+    UINT32   dest = 0;
+    uint8_t buffer [3];
+    size_t  offset = sizeof (buffer);
+    TSS2_RC rc;
+
+    rc = UINT32_Unmarshal (buffer, sizeof (buffer), &offset, &dest);
+
+    assert_int_equal (rc, TSS2_TYPES_RC_INSUFFICIENT_BUFFER);
+    assert_int_equal (offset, sizeof (buffer));
+    assert_int_equal (dest, 0);
+}
+int
+main (void)
+{
+    const UnitTest tests [] = {
+        unit_test (UINT32_marshal_success),
+        unit_test (UINT32_marshal_success_offset),
+        unit_test (UINT32_marshal_buffer_null_with_offset),
+        unit_test (UINT32_marshal_buffer_null_offset_null),
+        unit_test (UINT32_marshal_buffer_size_lt_data),
+        unit_test (UINT32_marshal_buffer_size_lt_offset),
+        unit_test (UINT32_unmarshal_success),
+        unit_test (UINT32_unmarshal_success_offset),
+        unit_test (UINT32_unmarshal_buffer_null),
+        unit_test (UINT32_unmarshal_dest_null),
+        unit_test (UINT32_unmarshal_buffer_size_lt_offset),
+        unit_test (UINT32_unmarshal_buffer_size_lt_dest),
+    };
+    return run_tests (tests);
+}
diff --git a/test/unit/UINT64-marshal.c b/test/unit/UINT64-marshal.c
new file mode 100644
index 0000000..58514d8
--- /dev/null
+++ b/test/unit/UINT64-marshal.c
@@ -0,0 +1,226 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <setjmp.h>
+#include <cmocka.h>
+
+#include "marshal/base-types.h"
+#include "sapi/marshal.h"
+
+/*
+ * Test case for successful UINT64 marshaling with NULL offset.
+ */
+void
+UINT64_marshal_success (void **state)
+{
+    UINT64   src = 0xdeadbeefdeadbeef, tmp;
+    uint8_t buffer [8] = { 0 };
+    size_t  buffer_size = sizeof (buffer);
+    TSS2_RC rc;
+
+    rc = UINT64_Marshal (src, buffer, buffer_size, NULL);
+    tmp = HOST_TO_BE_64 (src);
+
+    assert_int_equal (rc, TSS2_RC_SUCCESS);
+    assert_memory_equal (&tmp, &buffer [0], sizeof (tmp));
+}
+/*
+ * Test case for successful UINT64 marshaling with offset.
+ */
+void
+UINT64_marshal_success_offset (void **state)
+{
+    UINT64 src = 0xdeadbeefdeadbeef, tmp = 0;
+    uint8_t buffer [9] = { 0 };
+    size_t  buffer_size = sizeof (buffer);
+    size_t  offset = 1;
+    TSS2_RC rc;
+
+    rc = UINT64_Marshal (src, buffer, buffer_size, &offset);
+    tmp = HOST_TO_BE_64 (src);
+
+    assert_int_equal (rc, TSS2_RC_SUCCESS);
+    assert_memory_equal (&tmp, &buffer [1], sizeof (tmp));
+    assert_int_equal (offset, sizeof (buffer));
+}
+/*
+ * Test case passing NULL buffer and non-NULL offset. Test to be sure offset
+ * is updated to the size of the src parameter.
+ */
+void
+UINT64_marshal_buffer_null_with_offset (void **state)
+{
+    UINT64 src = 0xdeadbeefdeadbeef;
+    size_t offset = 100;
+    TSS2_RC rc;
+
+    rc = UINT64_Marshal (src, NULL, 2, &offset);
+
+    assert_int_equal (rc, TSS2_RC_SUCCESS);
+    assert_int_equal (offset, 100 + sizeof (src));
+}
+/*
+ * Test case passing NULL buffer and NULL offset.
+ */
+void
+UINT64_marshal_buffer_null_offset_null (void **state)
+{
+    UINT64 src = 0xdeadbeefdeadbeef;
+    TSS2_RC rc;
+
+    rc = UINT64_Marshal (src, NULL, sizeof (src), NULL);
+
+    assert_int_equal (rc, TSS2_TYPES_RC_BAD_REFERENCE);
+}
+/*
+ * Test failing case where buffer_size - offset (size of available space
+ * in buffer) is less than sizeof (UINT64). Also check offset is unchanged.
+ */
+void
+UINT64_marshal_buffer_size_lt_data (void **state)
+{
+    UINT64   src = 0xdeadbeefdeadbeef;
+    uint8_t buffer [8] = { 0 };
+    size_t  offset = 2;
+    TSS2_RC rc;
+
+    rc = UINT64_Marshal (src, buffer, sizeof (src), &offset);
+
+    assert_int_equal (rc, TSS2_TYPES_RC_INSUFFICIENT_BUFFER);
+    assert_int_equal (offset, 2);
+}
+/*
+ * Test failing case where buffer_size is less than the offset value.
+ * This should return INSUFFICIENT_BUFFER and the offset should be unchanged.
+ */
+void
+UINT64_marshal_buffer_size_lt_offset (void **state)
+{
+    UINT64   src = 0xdeadbeefdeadbeef;
+    uint8_t buffer [8] = { 0 };
+    size_t  buffer_size = sizeof (buffer);
+    size_t  offset = sizeof (buffer) + 1;
+    TSS2_RC rc;
+
+    rc = UINT64_Marshal (src, buffer, buffer_size, &offset);
+
+    assert_int_equal (rc, TSS2_TYPES_RC_INSUFFICIENT_BUFFER);
+    assert_int_equal (offset, sizeof (buffer) + 1);
+}
+/*
+ * Test case for successful UINT64 unmarshaling.
+ */
+void
+UINT64_unmarshal_success (void **state)
+{
+    uint8_t buffer [8] = { 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef };
+    uint8_t buffer_size = sizeof (buffer);
+    UINT64   dest = 0, tmp = 0;
+    TSS2_RC rc;
+
+    rc = UINT64_Unmarshal (buffer, buffer_size, NULL, &dest);
+    tmp = HOST_TO_BE_64 (dest);
+
+    assert_int_equal (rc, TSS2_RC_SUCCESS);
+    assert_memory_equal (&tmp, buffer, sizeof (tmp));
+}
+/*
+ * Test case for successful UINT64 unmarshaling with offset.
+ */
+void
+UINT64_unmarshal_success_offset (void **state)
+{
+    UINT64   dest = 0, tmp = 0;
+    uint8_t buffer [9] = { 0xff, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef };
+    size_t  buffer_size = sizeof (buffer);
+    size_t  offset = 1;
+    TSS2_RC rc;
+
+    rc = UINT64_Unmarshal (buffer, buffer_size, &offset, &dest);
+    tmp = HOST_TO_BE_64 (dest);
+
+    assert_int_equal (rc, TSS2_RC_SUCCESS);
+    assert_memory_equal (&tmp, &buffer [1], sizeof (tmp));
+    assert_int_equal (offset, 9);
+}
+/*
+ * Test case ensures a NULL buffer parameter produces a BAD_REFERENCE RC.
+ */
+void
+UINT64_unmarshal_buffer_null (void **state)
+{
+    TSS2_RC rc;
+
+    rc = UINT64_Unmarshal (NULL, 1, NULL, NULL);
+
+    assert_int_equal (rc, TSS2_TYPES_RC_BAD_REFERENCE);
+}
+/*
+ * Test case ensures a NULL dest and offset parameters produce an
+ * INSUFFICIENT_BUFFER RC.
+ */
+void
+UINT64_unmarshal_dest_null (void **state)
+{
+    uint8_t buffer [1];
+    TSS2_RC rc;
+
+    rc = UINT64_Unmarshal (buffer, sizeof (buffer), NULL, NULL);
+
+    assert_int_equal (rc, TSS2_TYPES_RC_BAD_REFERENCE);
+}
+/*
+ * Test case ensures that INSUFFICIENT_BUFFER is returned when buffer_size
+ * is less than the provided offset.
+ */
+void
+UINT64_unmarshal_buffer_size_lt_offset (void **state)
+{
+    UINT64   dest = 0;
+    uint8_t buffer [1];
+    size_t  offset = sizeof (buffer) + 1;
+    TSS2_RC rc;
+
+    rc = UINT64_Unmarshal (buffer, sizeof (buffer), &offset, &dest);
+
+    assert_int_equal (rc, TSS2_TYPES_RC_INSUFFICIENT_BUFFER);
+    assert_int_equal (offset, sizeof (buffer) + 1);
+    assert_int_equal (dest, 0);
+}
+/*
+ * Test case ensures that INSUFFICIENT_BUFFER is returned when buffer_size -
+ * local_offset is less than dest (the destination type).
+ */
+void
+UINT64_unmarshal_buffer_size_lt_dest (void **state)
+{
+    UINT64   dest = 0;
+    uint8_t buffer [3];
+    size_t  offset = sizeof (buffer);
+    TSS2_RC rc;
+
+    rc = UINT64_Unmarshal (buffer, sizeof (buffer), &offset, &dest);
+
+    assert_int_equal (rc, TSS2_TYPES_RC_INSUFFICIENT_BUFFER);
+    assert_int_equal (offset, sizeof (buffer));
+    assert_int_equal (dest, 0);
+}
+int
+main (void)
+{
+    const UnitTest tests [] = {
+        unit_test (UINT64_marshal_success),
+        unit_test (UINT64_marshal_success_offset),
+        unit_test (UINT64_marshal_buffer_null_with_offset),
+        unit_test (UINT64_marshal_buffer_null_offset_null),
+        unit_test (UINT64_marshal_buffer_size_lt_data),
+        unit_test (UINT64_marshal_buffer_size_lt_offset),
+        unit_test (UINT64_unmarshal_success),
+        unit_test (UINT64_unmarshal_success_offset),
+        unit_test (UINT64_unmarshal_buffer_null),
+        unit_test (UINT64_unmarshal_dest_null),
+        unit_test (UINT64_unmarshal_buffer_size_lt_offset),
+        unit_test (UINT64_unmarshal_buffer_size_lt_dest),
+    };
+    return run_tests (tests);
+}
diff --git a/test/unit/UINT8-marshal.c b/test/unit/UINT8-marshal.c
new file mode 100644
index 0000000..efb2585
--- /dev/null
+++ b/test/unit/UINT8-marshal.c
@@ -0,0 +1,221 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <setjmp.h>
+#include <cmocka.h>
+
+#include "sapi/marshal.h"
+
+/*
+ * Test case for successful UINT8 marshaling with NULL offset.
+ */
+void
+UINT8_marshal_success (void **state)
+{
+    UINT8   src = 0x1a;
+    uint8_t buffer [1] = { 0 };
+    size_t  buffer_size = sizeof (buffer);
+    TSS2_RC rc;
+
+    rc = UINT8_Marshal (src, buffer, buffer_size, NULL);
+
+    assert_int_equal (rc, TSS2_RC_SUCCESS);
+    assert_int_equal (src, buffer [0]);
+}
+/*
+ * Test case for successful UINT8 marshaling with offset.
+ */
+void
+UINT8_marshal_success_offset (void **state)
+{
+    UINT8 src = 0x1a;
+    uint8_t buffer [2] = { 0 };
+    size_t  buffer_size = sizeof (buffer);
+    size_t  offset = 1;
+    TSS2_RC rc;
+
+    rc = UINT8_Marshal (src, buffer, buffer_size, &offset);
+
+    assert_int_equal (rc, TSS2_RC_SUCCESS);
+    assert_int_equal (src, buffer [1]);
+    assert_int_equal (offset, sizeof (buffer));
+}
+/*
+ * Test case passing NULL buffer and non-NULL offset. Test to be sure offset
+ * is updated to the size of the src parameter.
+ */
+void
+UINT8_marshal_buffer_null_with_offset (void **state)
+{
+    UINT8 src = 0x1a;
+    size_t offset = 100;
+    TSS2_RC rc;
+
+    rc = UINT8_Marshal (src, NULL, 2, &offset);
+
+    assert_int_equal (rc, TSS2_RC_SUCCESS);
+    assert_int_equal (offset, 100 + sizeof (src));
+}
+/*
+ * Test case passing NULL buffer and NULL offset. This 
+ */
+void
+UINT8_marshal_buffer_null_offset_null (void **state)
+{
+    UINT8 src = 0x1a;
+    TSS2_RC rc;
+
+    rc = UINT8_Marshal (src, NULL, sizeof (src), NULL);
+
+    assert_int_equal (rc, TSS2_TYPES_RC_BAD_REFERENCE);
+}
+/*
+ * Test failing case where buffer_size - offset (size of available space
+ * in buffer) is less than sizeof (UINT8). Also check offset is unchanged.
+ */
+void
+UINT8_marshal_buffer_size_lt_data (void **state)
+{
+    UINT8   src = 0x1a;
+    uint8_t buffer [2] = { 0 };
+    size_t  offset = 2;
+    TSS2_RC rc;
+
+    rc = UINT8_Marshal (src, buffer, sizeof (src), &offset);
+
+    assert_int_equal (rc, TSS2_TYPES_RC_INSUFFICIENT_BUFFER);
+    assert_int_equal (offset, 2);
+}
+/*
+ * Test failing case where buffer_size is less than the offset value.
+ * This should return INSUFFICIENT_BUFFER and the offset should be unchanged.
+ */
+void
+UINT8_marshal_buffer_size_lt_offset (void **state)
+{
+    UINT8   src = 0x1a;
+    uint8_t buffer [2] = { 0 };
+    size_t  buffer_size = sizeof (buffer);
+    size_t  offset = sizeof (buffer) + 1;
+    TSS2_RC rc;
+
+    rc = UINT8_Marshal (src, buffer, buffer_size, &offset);
+
+    assert_int_equal (rc, TSS2_TYPES_RC_INSUFFICIENT_BUFFER);
+    assert_int_equal (offset, sizeof (buffer) + 1);
+}
+/*
+ * Test case for successful UINT8 unmarshaling.
+ */
+void
+UINT8_unmarshal_success (void **state)
+{
+    uint8_t buffer [1] = { 0xa1 };
+    uint8_t buffer_size = sizeof (buffer);
+    UINT8   dest = 0;
+    TSS2_RC rc;
+
+    rc = UINT8_Unmarshal (buffer, buffer_size, NULL, &dest);
+
+    assert_int_equal (rc, TSS2_RC_SUCCESS);
+    assert_int_equal (buffer [0], dest);
+}
+/*
+ * Test case for successful UINT8 unmarshaling with offset.
+ */
+void
+UINT8_unmarshal_success_offset (void **state)
+{
+    UINT8   dest = 0;
+    uint8_t buffer [2] = { 0x00, 0xa1 };
+    size_t  buffer_size = sizeof (buffer);
+    size_t  offset = 1;
+    TSS2_RC rc;
+
+    rc = UINT8_Unmarshal (buffer, buffer_size, &offset, &dest);
+
+    assert_int_equal (rc, TSS2_RC_SUCCESS);
+    assert_int_equal (buffer [1], dest);
+    assert_int_equal (offset, 2);
+}
+/*
+ * Test case ensures a NULL buffer parameter produces a BAD_REFERENCE RC.
+ */
+void
+UINT8_unmarshal_buffer_null (void **state)
+{
+    TSS2_RC rc;
+
+    rc = UINT8_Unmarshal (NULL, 1, NULL, NULL);
+
+    assert_int_equal (rc, TSS2_TYPES_RC_BAD_REFERENCE);
+}
+/*
+ * Test case ensures a NULL dest and offset parameters produce an
+ * INSUFFICIENT_BUFFER RC.
+ */
+void
+UINT8_unmarshal_dest_null (void **state)
+{
+    uint8_t buffer [1];
+    TSS2_RC rc;
+
+    rc = UINT8_Unmarshal (buffer, sizeof (buffer), NULL, NULL);
+
+    assert_int_equal (rc, TSS2_TYPES_RC_BAD_REFERENCE);
+}
+/*
+ * Test case ensures that INSUFFICIENT_BUFFER is returned when buffer_size
+ * is less than the provided offset.
+ */
+void
+UINT8_unmarshal_buffer_size_lt_offset (void **state)
+{
+    UINT8   dest = 0;
+    uint8_t buffer [1];
+    size_t  offset = sizeof (buffer) + 1;
+    TSS2_RC rc;
+
+    rc = UINT8_Unmarshal (buffer, sizeof (buffer), &offset, &dest);
+
+    assert_int_equal (rc, TSS2_TYPES_RC_INSUFFICIENT_BUFFER);
+    assert_int_equal (offset, sizeof (buffer) + 1);
+    assert_int_equal (dest, 0);
+}
+/*
+ * Test case ensures that INSUFFICIENT_BUFFER is returned when buffer_size -
+ * local_offset is less than dest (the destination type).
+ */
+void
+UINT8_unmarshal_buffer_size_lt_dest (void **state)
+{
+    UINT8   dest = 0;
+    uint8_t buffer [1];
+    size_t  offset = sizeof (buffer);
+    TSS2_RC rc;
+
+    rc = UINT8_Unmarshal (buffer, sizeof (buffer), &offset, &dest);
+
+    assert_int_equal (rc, TSS2_TYPES_RC_INSUFFICIENT_BUFFER);
+    assert_int_equal (offset, sizeof (buffer));
+    assert_int_equal (dest, 0);
+}
+int
+main (void)
+{
+    const UnitTest tests [] = {
+        unit_test (UINT8_marshal_success),
+        unit_test (UINT8_marshal_success_offset),
+        unit_test (UINT8_marshal_buffer_null_with_offset),
+        unit_test (UINT8_marshal_buffer_null_offset_null),
+        unit_test (UINT8_marshal_buffer_size_lt_data),
+        unit_test (UINT8_marshal_buffer_size_lt_offset),
+        unit_test (UINT8_unmarshal_success),
+        unit_test (UINT8_unmarshal_success_offset),
+        unit_test (UINT8_unmarshal_buffer_null),
+        unit_test (UINT8_unmarshal_dest_null),
+        unit_test (UINT8_unmarshal_buffer_size_lt_offset),
+        unit_test (UINT8_unmarshal_buffer_size_lt_dest),
+    };
+    return run_tests (tests);
+}
diff --git a/test/marshal-TPM2B-simple_unit.c b/test/unit/marshal-TPM2B-simple.c
similarity index 98%
rename from test/marshal-TPM2B-simple_unit.c
rename to test/unit/marshal-TPM2B-simple.c
index b72d57e..f9fd3ce 100644
--- a/test/marshal-TPM2B-simple_unit.c
+++ b/test/unit/marshal-TPM2B-simple.c
@@ -4,8 +4,8 @@
 
 #include <setjmp.h>
 #include <cmocka.h>
-#include <tpm20.h>
 
+#include "sapi/tpm20.h"
 #include "sys_api_marshalUnmarshal.h"
 #include "sysapi_util.h"
 
diff --git a/test/unit/tcti-device.c b/test/unit/tcti-device.c
new file mode 100644
index 0000000..aaecfd2
--- /dev/null
+++ b/test/unit/tcti-device.c
@@ -0,0 +1,253 @@
+#include <inttypes.h>
+#include <stdbool.h>
+#include <stdio.h>
+
+#include <setjmp.h>
+#include <cmocka.h>
+
+#include "sapi/marshal.h"
+#include "tcti/tcti_device.h"
+#include "tcti/logging.h"
+#include "sysapi/include/tcti_util.h"
+
+/**
+ * When passed all NULL values ensure that we get back the expected RC
+ * indicating bad values.
+ */
+static void
+tcti_device_init_all_null_test (void **state)
+{
+    TSS2_RC rc;
+
+    rc = InitDeviceTcti (NULL, NULL, NULL);
+    assert_int_equal (rc, TSS2_TCTI_RC_BAD_VALUE);
+}
+/* Determine the size of a TCTI context structure. Requires calling the
+ * initialization function for the device TCTI with the first parameter
+ * (the TCTI context) NULL.
+ */
+static void
+tcti_device_init_size_test (void **state)
+{
+    size_t tcti_size = 0;
+    TSS2_RC ret = TSS2_RC_SUCCESS;
+
+    ret = InitDeviceTcti (NULL, &tcti_size, NULL);
+    assert_int_equal (ret, TSS2_RC_SUCCESS);
+}
+/**
+ * When passed a non-NULL context blob and size the config structure must
+ * also be non-NULL. No way to initialize the TCTI otherwise.
+ */
+static void
+tcti_device_init_null_config_test (void **state)
+{
+    size_t tcti_size;
+    TSS2_RC rc;
+    TSS2_TCTI_CONTEXT *tcti_context = (TSS2_TCTI_CONTEXT*)1;
+
+    rc = InitDeviceTcti (tcti_context, &tcti_size, NULL);
+    assert_int_equal (rc, TSS2_TCTI_RC_BAD_VALUE);
+}
+
+/* begin tcti_dev_init_log */
+/* This test configures the device TCTI with a logging callback and some user
+ * data. It checks to be sure that the initialization function sets the
+ * internal data in the TCTI to use / point to this data accordingly.
+ */
+int
+tcti_dev_init_log_callback (void *data, printf_type type, const char *format, ...)
+{
+    return 0;
+}
+static void
+tcti_device_init_log_test (void **state)
+{
+    size_t tcti_size = 0;
+    uint8_t my_data = 0x9;
+    TSS2_RC ret = TSS2_RC_SUCCESS;
+    TSS2_TCTI_CONTEXT *ctx = NULL;
+    TCTI_DEVICE_CONF conf = {
+        "/dev/null", tcti_dev_init_log_callback, &my_data
+    };
+
+    ret = InitDeviceTcti (NULL, &tcti_size, NULL);
+    assert_true (ret == TSS2_RC_SUCCESS);
+    ctx = calloc (1, tcti_size);
+    assert_non_null (ctx);
+    ret = InitDeviceTcti (ctx, 0, &conf);
+    assert_true (ret == TSS2_RC_SUCCESS);
+    assert_true (TCTI_LOG_CALLBACK (ctx) == tcti_dev_init_log_callback);
+    assert_true (*(uint8_t*)TCTI_LOG_DATA (ctx) == my_data);
+    if (ctx)
+        free (ctx);
+}
+/* end tcti dev_init_log */
+
+/* begin tcti_dev_init_log_called */
+/* Initialize TCTI context providing a pointer to a logging function and some
+ * data. The test case calls the logging function through the TCTI interface
+ * and checks to be sure that the function is called and that the user data
+ * provided is what we expect. We detect that the logging function was called
+ * by having it change the user data provided and then detecting this change.
+ * The caller responsible for freeing the context.
+ */
+int
+tcti_dev_log_callback (void *data, printf_type type, const char *format, ...)
+{
+    *(bool*)data = true;
+    return 0;
+}
+
+static void
+tcti_device_log_called_test (void **state)
+{
+    size_t tcti_size = 0;
+    bool called = false;
+    TSS2_RC ret = TSS2_RC_SUCCESS;
+    TSS2_TCTI_CONTEXT *ctx = NULL;
+    TCTI_DEVICE_CONF conf = {
+        "/dev/null", tcti_dev_log_callback, &called
+    };
+
+    ret = InitDeviceTcti (NULL, &tcti_size, NULL);
+    assert_true (ret == TSS2_RC_SUCCESS);
+    ctx = calloc (1, tcti_size);
+    assert_non_null (ctx);
+    ret = InitDeviceTcti (ctx, 0, &conf);
+    assert_true (ret == TSS2_RC_SUCCESS);
+    if (ctx)
+        free (ctx);
+    /* the 'called' variable should be changed from false to true after this */
+    TCTI_LOG (ctx, NO_PREFIX, "test log call");
+    assert_true (called);
+}
+/* end tcti_dev_init_log */
+/* wrap functions for read & write required to test receive / transmit */
+ssize_t
+__wrap_read (int fd, void *buffer, size_t count)
+{
+    return (ssize_t)mock ();
+}
+ssize_t
+__wrap_write (int fd, const void *buffer, size_t buffer_size)
+{
+    return (ssize_t)mock ();
+}
+
+typedef struct {
+    TSS2_TCTI_CONTEXT *ctx;
+    uint8_t *buffer;
+    size_t   buffer_size;
+    size_t   data_size;
+} data_t;
+/* Setup functions to create the context for the device TCTI */
+static void
+tcti_device_setup (void **state)
+{
+    size_t tcti_size = 0;
+    TSS2_RC ret = TSS2_RC_SUCCESS;
+    TSS2_TCTI_CONTEXT *ctx = NULL;
+    TCTI_DEVICE_CONF conf = {
+        .device_path = "/dev/null",
+        .logCallback = NULL,
+        .logData     = NULL
+    };
+
+    ret = InitDeviceTcti (NULL, &tcti_size, NULL);
+    assert_true (ret == TSS2_RC_SUCCESS);
+    ctx = calloc (1, tcti_size);
+    assert_non_null (ctx);
+    ret = InitDeviceTcti (ctx, 0, &conf);
+    assert_true (ret == TSS2_RC_SUCCESS);
+    *state = ctx;
+}
+
+static void
+tcti_device_setup_with_command (void **state)
+{
+    TSS2_RC rc;
+    data_t *data;
+    size_t index = 0;
+
+    data = malloc (sizeof (data_t));
+    assert_non_null (data);
+    tcti_device_setup ((void**)&data->ctx);
+    data->buffer_size = 1024;
+    data->data_size   = 512;
+    data->buffer = malloc (data->buffer_size);
+    rc = TPM_ST_Marshal (TPM_ST_NO_SESSIONS, data->buffer, data->buffer_size, &index);
+    assert_true (rc == TSS2_RC_SUCCESS);
+    rc = UINT32_Marshal (data->data_size, data->buffer, data->buffer_size, &index);
+    assert_true (rc == TSS2_RC_SUCCESS);
+    rc = TPM_CC_Marshal (TPM_CC_Create, data->buffer, data->buffer_size, &index);
+    assert_true (rc == TSS2_RC_SUCCESS);
+
+    *state = data;
+}
+
+static void
+tcti_device_teardown (void **state)
+{
+    TSS2_TCTI_CONTEXT *ctx = *state;
+
+    tss2_tcti_finalize (ctx);
+    free (ctx);
+}
+/*
+ * A test case for a successful call to the receive function. This requires
+ * that the context and the command buffer be valid (including the size
+ * field being set appropriately). The result should be an RC indicating
+ * success and the size parameter be updated to reflect the size of the
+ * data received.
+ */
+static void
+tcti_device_receive_success (void **state)
+{
+    data_t *data = *state;
+    TSS2_RC rc;
+
+    will_return (__wrap_read, data->data_size);
+    rc = tss2_tcti_receive (data->ctx,
+                            &data->buffer_size,
+                            data->buffer,
+                            TSS2_TCTI_TIMEOUT_BLOCK);
+    assert_true (rc == TSS2_RC_SUCCESS);
+    assert_int_equal (data->data_size, data->buffer_size);
+}
+/*
+ * A test case for a successful call to the transmit function. This requires
+ * that the context and the cmmand buffer be valid. The only indication of
+ * success is the RC.
+ */
+static void
+tcti_device_transmit_success (void **state)
+{
+    data_t *data = *state;
+    TSS2_RC rc;
+
+    will_return (__wrap_write, data->buffer_size);
+    rc = tss2_tcti_transmit (data->ctx,
+                             data->buffer_size,
+                             data->buffer);
+    assert_true (rc == TSS2_RC_SUCCESS);
+}
+
+int
+main(int argc, char* argv[])
+{
+    const UnitTest tests[] = {
+        unit_test (tcti_device_init_all_null_test),
+        unit_test(tcti_device_init_size_test),
+        unit_test (tcti_device_init_log_test),
+        unit_test (tcti_device_log_called_test),
+        unit_test (tcti_device_init_null_config_test),
+        unit_test_setup_teardown (tcti_device_receive_success,
+                                  tcti_device_setup_with_command,
+                                  tcti_device_teardown),
+        unit_test_setup_teardown (tcti_device_transmit_success,
+                                  tcti_device_setup_with_command,
+                                  tcti_device_teardown),
+    };
+    return run_tests(tests);
+}
diff --git a/test/unmarshal-UINT16_unit.c b/test/unmarshal-UINT16_unit.c
deleted file mode 100644
index 70228f1..0000000
--- a/test/unmarshal-UINT16_unit.c
+++ /dev/null
@@ -1,97 +0,0 @@
-#include <stdlib.h>
-#include <arpa/inet.h>
-#include <stdio.h>
-
-#include <setjmp.h>
-#include <cmocka.h>
-#include <tpm20.h>
-
-#include "sys_api_marshalUnmarshal.h"
-#include "sysapi_util.h"
-
-typedef struct {
-    uint8_t *buffer;
-    size_t   buffer_size;
-    uint16_t data_host;
-    uint16_t data_net;
-    TSS2_RC  rc;
-} marshal_uint16_data_t;
-
-void
-unmarshal_UINT16_setup (void **state)
-{
-    marshal_uint16_data_t *data;
-
-    data              = calloc (1, sizeof (marshal_uint16_data_t));
-    data->buffer      = calloc (1, sizeof (uint16_t));
-    data->buffer_size = sizeof (uint16_t);
-    data->data_host   = 0xdead;
-    data->data_net    = htons (data->data_host);
-    data->rc          = TSS2_RC_SUCCESS;
-
-    /**
-     * copy test data into the buffer in network byte order, this is what we
-     * will be unmarshalling
-     */
-    memcpy (data->buffer, &data->data_net, sizeof (data->data_net));
-
-    *state = data;
-}
-
-void
-unmarshal_UINT16_teardown (void **state)
-{
-    marshal_uint16_data_t *data;
-
-    data = (marshal_uint16_data_t*)*state;
-    if (data) {
-        if (data->buffer)
-            free (data->buffer);
-        free (data);
-    }
-}
-/**
- * Make a call to Unmarshal_UINT16 function that should succeed.
- * The *_setup function has already copied a UINT16 into a data buffer in
- * network byte order (marshalled form). This function uses the
- * Unmarshal_UINT16 function to get this UINT16 back out of the data buffer
- * and into the host by te order for comparison to the reference value
- * in the 'data_host' field of the marshal_uint16_data_t structure.
- */
-void
-unmarshal_UINT16_good (void **state)
-{
-    marshal_uint16_data_t *data;
-    uint16_t               data_unmarshalled = 0;
-
-    data = (marshal_uint16_data_t*)*state;
-    uint8_t *nextData = data->buffer;
-
-    Unmarshal_UINT16 (data->buffer,
-                      data->buffer_size,
-                      &nextData,
-                      &data_unmarshalled,
-                      &data->rc);
-    /**
-     * uint16_t that was unmarshalled from the data buffer should be equal to
-     * the data_host member of the test data structure.
-     */
-    assert_int_equal (data_unmarshalled, data->data_host);
-    /**
-     * The Unmarshal_* functions advance the 'nextData' parameter by the size of
-     * the marshalled data.
-     */
-    assert_int_equal (data->buffer, nextData - sizeof (uint16_t));
-    /* Finally the return code should indicate success. */
-    assert_int_equal (data->rc, TSS2_RC_SUCCESS);
-}
-int
-main (void)
-{
-    const UnitTest tests [] = {
-        unit_test_setup_teardown (unmarshal_UINT16_good,
-                                  unmarshal_UINT16_setup,
-                                  unmarshal_UINT16_teardown),
-    };
-    return run_tests (tests);
-}
diff --git a/test/unmarshal-UINT32_unit.c b/test/unmarshal-UINT32_unit.c
deleted file mode 100644
index 26f6ba3..0000000
--- a/test/unmarshal-UINT32_unit.c
+++ /dev/null
@@ -1,96 +0,0 @@
-#include <stdlib.h>
-#include <arpa/inet.h>
-#include <stdio.h>
-
-#include <setjmp.h>
-#include <cmocka.h>
-#include <tpm20.h>
-
-#include "sys_api_marshalUnmarshal.h"
-#include "sysapi_util.h"
-
-typedef struct {
-    uint8_t *buffer;
-    size_t   buffer_size;
-    uint32_t data_host;
-    uint32_t data_net;
-    TSS2_RC  rc;
-} marshal_uint32_data_t;
-
-void
-unmarshal_UINT32_setup (void **state)
-{
-    marshal_uint32_data_t *data;
-
-    data              = calloc (1, sizeof (marshal_uint32_data_t));
-    data->buffer      = calloc (1, sizeof (uint32_t));
-    data->buffer_size = sizeof (uint32_t);
-    data->data_host   = 0xdeadbeef;
-    data->data_net    = htonl (data->data_host);
-    data->rc          = TSS2_RC_SUCCESS;
-
-    /**
-     * copy test data into the buffer in network byte order, this is what we
-     * will be unmarshalling
-     */
-    memcpy (data->buffer, &data->data_net, sizeof (data->data_net));
-
-    *state = data;
-}
-
-void
-unmarshal_UINT32_teardown (void **state)
-{
-    marshal_uint32_data_t *data;
-
-    data = (marshal_uint32_data_t*)*state;
-    if (data) {
-        if (data->buffer)
-            free (data->buffer);
-        free (data);
-    }
-}
-/**
- * Make a call to Unmarshal_UINT32 function that should succeed. The *_setup
- * function is expected to have allocated sufficient buffer to hold a
- * uint32_t. This test just 'unmarshals' a known uint32_t from this data
- * buffer and then compares the value to the expected result.
- */
-void
-unmarshal_UINT32_good (void **state)
-{
-    marshal_uint32_data_t *data;
-    uint32_t               data_unmarshalled = 0;
-
-    data = (marshal_uint32_data_t*)*state;
-    uint8_t *nextData = data->buffer;
-
-    Unmarshal_UINT32 (data->buffer,
-                      data->buffer_size,
-                      &nextData,
-                      &data_unmarshalled,
-                      &data->rc);
-    /**
-     * uint32_t that was marshalled into the data buffer should be equal to
-     * the expected value (data converted from host byte order to network
-     * byte order).
-     */
-    assert_int_equal (data_unmarshalled, data->data_host);
-    /**
-     * The Marshal_* functions advance the 'nextData' parameter by the size of
-     * the marshalled data.
-     */
-    assert_int_equal (data->buffer, nextData - sizeof (uint32_t));
-    /* Finally the return code should indicate success. */
-    assert_int_equal (data->rc, TSS2_RC_SUCCESS);
-}
-int
-main (void)
-{
-    const UnitTest tests [] = {
-        unit_test_setup_teardown (unmarshal_UINT32_good,
-                                  unmarshal_UINT32_setup,
-                                  unmarshal_UINT32_teardown),
-    };
-    return run_tests (tests);
-}