[go: nahoru, domu]

TCTI: Update to new logging framework

Update TCTI modules to new logging framework.
Removing the callback function for logging that were not
specification compliant.

Signed-off-by: Andreas Fuchs <andreas.fuchs@sit.fraunhofer.de>
diff --git a/Makefile.am b/Makefile.am
index 2be97b7..e98742f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -138,14 +138,14 @@
 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/tcti.c tcti/tcti.h tcti/tcti_device.c \
-    test/unit/tcti-device.c
+    test/unit/tcti-device.c log/log.h log/log.c
 
 test_unit_tcti_socket_CFLAGS  = $(CMOCKA_CFLAGS) $(AM_CFLAGS)
 test_unit_tcti_socket_LDADD   = $(CMOCKA_LIBS) $(libmarshal)
 test_unit_tcti_socket_LDFLAGS = -Wl,--wrap=connect,--wrap=recv,--wrap=select,--wrap=send
 test_unit_tcti_socket_SOURCES = tcti/platformcommand.c tcti/tcti_socket.c \
     tcti/tcti.c tcti/tcti.h tcti/sockets.c tcti/sockets.h \
-    common/debug.c common/debug.h tcti/logging.h test/unit/tcti-socket.c
+     test/unit/tcti-socket.c log/log.h log/log.c
 
 test_unit_CommonPreparePrologue_CFLAGS = $(CMOCKA_CFLAGS) $(AM_CFLAGS)
 test_unit_CommonPreparePrologue_LDFLAGS = -Wl,--unresolved-symbols=ignore-all
@@ -217,7 +217,7 @@
 endif # HAVE_LD_VERSION_SCRIPT
 tcti_libtcti_device_la_LIBADD   = $(libmarshal)
 tcti_libtcti_device_la_SOURCES  = tcti/tcti_device.c tcti/tcti.c \
-    tcti/tcti.h common/debug.c common/debug.h tcti/logging.h
+    tcti/tcti.h log/log.h log/log.c
 
 tcti_libtcti_socket_la_CFLAGS   = $(AM_CFLAGS)
 if HAVE_LD_VERSION_SCRIPT
@@ -225,8 +225,7 @@
 endif # HAVE_LD_VERSION_SCRIPT
 tcti_libtcti_socket_la_LIBADD   = $(libmarshal)
 tcti_libtcti_socket_la_SOURCES  = tcti/platformcommand.c tcti/tcti_socket.c \
-    tcti/tcti.c tcti/tcti.h tcti/sockets.c tcti/sockets.h \
-    common/debug.c common/debug.h tcti/logging.h
+    tcti/tcti.c tcti/tcti.h tcti/sockets.c tcti/sockets.h log/log.h log/log.c
 
 test_tpmclient_tpmclient_int_CFLAGS   = $(AM_CFLAGS) -U_FORTIFY_SOURCE
 test_tpmclient_tpmclient_int_LDADD    = $(TESTS_LDADD)
@@ -241,7 +240,8 @@
     test/tpmclient/syscontext.h test/tpmclient/tcti_util.c \
     test/tpmclient/tcti_util.h test/tpmclient/TpmCalcPHash.c \
     test/tpmclient/tpmclient.int.c test/tpmclient/tpmclient.h \
-    test/tpmclient/TpmHandleToName.c test/tpmclient/TpmHash.c
+    test/tpmclient/TpmHandleToName.c test/tpmclient/TpmHash.c \
+    log/log.h log/log.c
 
 test_integration_libtest_utils_la_SOURCES = \
     test/integration/context-util.c test/integration/context-util.h \
diff --git a/common/debug.c b/common/debug.c
deleted file mode 100644
index 38940af..0000000
--- a/common/debug.c
+++ /dev/null
@@ -1,231 +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 <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>   // Needed for _wtoi
-
-#include "sapi/tpm20.h"
-#include "debug.h"
-
-int DebugPrintf( printf_type type, const char *format, ...)
-{
-    va_list args;
-    int rval = 0;
-
-    if( type == RM_PREFIX )
-        printf( "||  " );
-
-    va_start( args, format );
-    rval = vprintf( format, args );
-    va_end (args);
-
-    return rval;
-}
-
-/* This callback function is intended for use with the TCTI log callback
- * mechanism. It provides an additional parameter for receiving arbitrary
- * user specified data.
- */
-int DebugPrintfCallback( void *data, printf_type type, const char *format, ...)
-{
-    va_list args;
-    int rval = 0;
-
-    if( type == RM_PREFIX )
-        DebugPrintfCallback( data, NO_PREFIX,  "||  " );
-
-    va_start( args, format );
-    rval = vprintf( format, args );
-    va_end (args);
-
-    return rval;
-}
-
-void DebugPrintBuffer( printf_type type, UINT8 *buffer, UINT32 length )
-{
-    UINT32  i;
-
-    for( i = 0; i < length; i++ )
-    {
-        if( ( i % 16 ) == 0 )
-        {
-            DebugPrintf(NO_PREFIX, "\n");
-            if( type == RM_PREFIX )
-                DebugPrintf(NO_PREFIX,  "||  " );
-        }
-
-        DebugPrintf(NO_PREFIX,  "%2.2x ", buffer[i] );
-    }
-    DebugPrintf(NO_PREFIX,  "\n\n" );
-    fflush( stdout );
-}
-
-/* This callback function is intended for use with the TCTI log data
- * callback mechanism. It provides an additional parameter for receiving
- * arbitrary user specified data.
- */
-int DebugPrintBufferCallback( void *data, printf_type type, UINT8 *buffer, UINT32 length )
-{
-    DebugPrintBuffer (type, buffer, length);
-    return 0;
-}
-
-const char *commandCodeStrings[] =
-{
-    "TPM2_NV_UndefineSpaceSpecial", // 11f
-    "TPM2_EvictControl", // 120
-    "TPM2_HierarchyControl", // 121
-    "TPM2_NV_UndefineSpace",// 122
-    "", // 123
-    "TPM2_ChangeEPS", // 124
-    "TPM2_ChangePPS", // 125
-    "TPM2_Clear", // 126
-    "TPM2_ClearControl",// 127
-    "TPM2_ClockSet", // 128
-    "TPM2_HierarchyChangeAuth", // 129
-    "TPM2_NV_DefineSpace", // 12a
-    "TPM2_PCR_Allocate", // 12b
-    "TPM2_PCR_SetAuthPolicy", // 12c
-    "TPM2_PP_Commands", // 12d
-    "TPM2_SetPrimaryPolicy", // 12e
-    "TPM2_FieldUpgradeStart", // 12f
-    "TPM2_ClockRateAdjust", // 130
-    "TPM2_CreatePrimary",         // 131
-    "TPM2_NV_GlobalWriteLock", // 132
-    "TPM2_GetCommandAuditDigest", // 133
-    "TPM2_NV_Increment", // 134
-    "TPM2_NV_SetBits", // 135
-    "TPM2_NV_Extend", // 136
-    "TPM2_NV_Write", // 137
-    "TPM2_NV_WriteLock", // 138
-    "TPM2_DictionaryAttackLockReset", // 139
-    "TPM2_DictionaryAttackParameters", // 13a
-    "TPM2_NV_ChangeAuth", // 13b
-    "TPM2_PCR_Event", // 13c
-    "TPM2_PCR_Reset", // 13d
-    "TPM2_SequenceComplete",// 13e
-    "TPM2_SetAlgorithmSet", // 13f
-    "TPM2_SetCommandCodeAuditStatus", // 140
-    "TPM2_FieldUpgradeData", // 141
-    "TPM2_IncrementalSelfTest", // 142
-    "TPM2_SelfTest", // 143
-    "TPM2_Startup", // 144
-    "TPM2_Shutdown", // 145
-    "TPM2_StirRandom", // 146
-    "TPM2_ActivateCredential", // 147
-    "TPM2_Certify", // 148
-    "TPM2_PolicyNV", // 149
-    "TPM2_CertifyCreation",// 14a
-    "TPM2_Duplicate", // 14b
-    "TPM2_GetTime", // 14c
-    "TPM2_GetSessionAuditDigest", // 14d
-    "TPM2_NV_Read", // 14e
-    "TPM2_NV_ReadLock", // 14f
-    "TPM2_ObjectChangeAuth", // 150
-    "TPM2_PolicySecret", // 151
-    "TPM2_Rewrap", // 152
-    "TPM2_Create", // 153
-    "TPM2_ECDH_ZGen", // 154
-    "TPM2_HMAC", // 155
-    "TPM2_Import", // 156
-    "TPM2_Load", // 157
-    "TPM2_Quote", // 158
-    "TPM2_RSA_Decrypt",// 159
-    "", // 15a
-    "TPM2_HMAC_Start", // 15b
-    "TPM2_SequenceUpdate", // 15c
-    "TPM2_Sign", // 15d
-    "TPM2_Unseal",// 15e
-    "", // 15f
-    "TPM2_PolicySigned", // 160
-    "TPM2_ContextLoad", // 161
-    "TPM2_ContextSave", // 162
-    "TPM2_ECDH_KeyGen", // 163
-    "TPM2_EncryptDecrypt", // 164
-    "TPM2_FlushContext", // 165
-    "",
-    "TPM2_LoadExternal", // 167
-    "TPM2_MakeCredential", // 168
-    "TPM2_NV_ReadPublic", // 169
-    "TPM2_PolicyAuthorize", // 16a
-    "TPM2_PolicyAuthValue", // 16b
-    "TPM2_PolicyCommandCode", // 16c
-    "TPM2_PolicyCounterTimer", // 16d
-    "TPM2_PolicyCpHash", // 16e
-    "TPM2_PolicyLocality", // 16f
-    "TPM2_PolicyNameHash", // 170
-    "TPM2_PolicyOR", // 171
-    "TPM2_PolicyTicket", // 172
-    "TPM2_ReadPublic", // 173
-    "TPM2_RSA_Encrypt",// 174
-    "", // 175
-    "TPM2_StartAuthSession", // 176
-    "TPM2_VerifySignature", // 177
-    "TPM2_ECC_Parameters", // 178
-    "TPM2_FirmwareRead", // 179
-    "TPM2_GetCapability", // 17a
-    "TPM2_GetRandom", // 17b
-    "TPM2_GetTestResult", // 17c
-    "TPM2_Hash", // 17d
-    "TPM2_PCR_Read", // 17e
-    "TPM2_PolicyPCR", // 17f
-    "TPM2_PolicyRestart", // 180
-    "TPM2_ReadClock", // 181
-    "TPM2_PCR_Extend", // 182
-    "TPM2_PCR_SetAuthValue", // 183
-    "TPM2_NV_Certify", // 184
-    "TPM2_EventSequenceComplete", // 185
-    "TPM2_HashSequenceStart", // 186
-    "TPM2_PolicyPhysicalPresence", // 187
-    "TPM2_PolicyDuplicationSelect", // 188
-    "TPM2_PolicyGetDigest", // 189
-    "TPM2_TestParms", // 18a
-    "TPM2_Commit", // 18b
-    "TPM2_PolicyPassword", // 18c
-    "TPM2_ZGen_2Phase", // 18d
-    "TPM2_EC_Ephemeral", // 18e
-    "TPM2_PolicyNvWritten" // 18f
-};
-
-char undefinedCommandString[10] = "";
-
-const char* strTpmCommandCode( TPM2_CC code )
-{
-    if( code >= TPM2_CC_NV_UndefineSpaceSpecial && code <= TPM2_CC_PolicyNvWritten )
-    {
-        return commandCodeStrings[ code - TPM2_CC_FIRST ];
-    }
-    else
-    {
-        snprintf( &undefinedCommandString[0],
-                  sizeof (undefinedCommandString),
-                  "0x%4.4x",
-                  code );
-        return &undefinedCommandString[0];
-    }
-}
diff --git a/common/debug.h b/common/debug.h
deleted file mode 100644
index 818d798..0000000
--- a/common/debug.h
+++ /dev/null
@@ -1,57 +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.
-//**********************************************************************;
-
-#ifndef DEBUG_H
-#define DEBUG_H
-
-#include "sapi/tpm20.h"
-#include "tcti/tcti_socket.h"
-#include <stdio.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum debugLevel { DBG_NO_COMMAND = 0, DBG_COMMAND = 1, DBG_COMMAND_RM = 2, DBG_COMMAND_RM_TABLES = 3 };
-
-int DebugPrintfCallback( void *data, printf_type type, const char *format, ...);
-int DebugPrintf( printf_type type, const char *format, ...);
-void DebugPrintBuffer( printf_type type, UINT8 *command_buffer, UINT32 cnt1 );
-int DebugPrintBufferCallback( void *data, printf_type type, UINT8 *buffer, UINT32 length );
-const char* strTpmCommandCode( TPM2_CC code );
-
-#ifdef DEBUG
-#define DEBUG_PRINT_BUFFER( type, buffer, length )  DebugPrintBuffer( type, buffer, length )
-#else
-#define DEBUG_PRINT_BUFFER( type, buffer, length )
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/include/tcti/tcti_socket.h b/include/tcti/tcti_socket.h
index 024131e..baab4e9 100644
--- a/include/tcti/tcti_socket.h
+++ b/include/tcti/tcti_socket.h
@@ -50,9 +50,6 @@
 typedef struct {
     const char *hostname;
     uint16_t port;
-    TCTI_LOG_CALLBACK logCallback;
-    TCTI_LOG_BUFFER_CALLBACK logBufferCallback;
-    void *logData;
 } TCTI_SOCKET_CONF;
 
 TSS2_RC InitSocketTcti (
diff --git a/man/InitDeviceTcti.3.in b/man/InitDeviceTcti.3.in
index be113a9..7811233 100644
--- a/man/InitDeviceTcti.3.in
+++ b/man/InitDeviceTcti.3.in
@@ -7,13 +7,9 @@
 .SH SYNOPSIS
 .B #include <tcti/tcti_device.h>
 .sp
-.BI "typedef int (*TCTI_LOG_CALLBACK)( void " "*data" ", printf_type" "type" ", const char " "*format" ", "..." ");"
-.sp
 .nf
 typedef struct {
     const char *device_path;
-    TCTI_LOG_CALLBACK logCallback;
-    void *logData;
 } TCTI_DEVICE_CONF;
 .fi
 .sp
@@ -66,19 +62,6 @@
 member of this structure is a C string that contains the path to the device
 node exposed by the TPM device driver.
 .sp
-The
-.I logCallback
-parameter is a pointer to a callback function that will be called by the
-device TCTI. This is expected to be a
-.I printf
-like function.
-.sp
-The
-.I logData
-member is a void pointer to user data that will be supplied to the
-.I logCallback
-function on each invocation.
-.sp
 Once initialized, the TCTI context returned exposes the Trusted Computing
 Group (TCG) defined API for the lowest level communication with the TPM.
 Using this API the caller can exchange (send / receive) TPM2 command and
@@ -108,22 +91,6 @@
 .I config
 parameter is NULL.
 .SH EXAMPLE
-Logging function:
-.sp
-.nf
-int DebugPrintfCallback( void *data, printf_type type, const char *format, ...)
-{
-    va_list args;
-    int rval = 0;
-
-    va_start( args, format );
-    rval = vprintf( format, args );
-    va_end (args);
-
-    return rval;
-}
-.fi
-.sp
 TCTI initialization fragment:
 .sp
 .nf
@@ -137,8 +104,6 @@
 size_t size;
 TCTI_DEVICE_CONF conf = {
     .device_path = "/dev/tpm0",
-    .logCallback = DebugPrintfCallback,
-    .logData     = NULL,
 };
 
 rc = InitDeviceTcti (NULL, &size, NULL);
diff --git a/man/InitSocketTcti.3.in b/man/InitSocketTcti.3.in
index d8b448d..b1e300a 100644
--- a/man/InitSocketTcti.3.in
+++ b/man/InitSocketTcti.3.in
@@ -7,15 +7,10 @@
 .SH SYNOPSIS
 .B #include <tcti/tcti_socket.h>
 .sp
-.BI "typedef int (*TCTI_LOG_CALLBACK)( void " "*data" ", printf_type" "type" ", const char " "*format" ", "..." ");"
-.sp
 .nf
 typedef struct {
     const char *hostname;
     uint16_t port;
-    TCTI_LOG_CALLBACK logCallback;
-    TCTI_LOG_BUFFER_CALLBACK logBufferCallback;
-    void *logData;
 } TCTI_SOCKET_CONF;
 .fi
 .sp
@@ -75,24 +70,7 @@
 simulator command / response port. The simulator listens for \*(lqplatform
 commands\*(rq on
 .I port+1
-and so an additional connection will be made to this port. The
-.I logCallback
-member is a pointer to a callback function that will be called by the
-socket TCTI. This is expected to be a
-.I printf
-like function. The
-.I logBufferCallback
-mamber is a pointer to a call back function that will be invoked by the
-socket TCTI before a command buffer is transmitted or after a resposne buffer
-is received. This is expected to be a
-.I printf
-like function. The
-.I logData
-member is a void pointer that may be used to pass user data to the
-.I logCallback
-and
-.I logBufferCallback
-functions on each invocation.
+and so an additional connection will be made to this port.
 .sp
 The
 .I serverSockets
@@ -127,35 +105,6 @@
 .I config
 parameter is NULL.
 .SH EXAMPLE
-Logging functions:
-.sp
-.nf
-int DebugPrintfCallback (void *data, printf_type type, const char *format, ...)
-{
-    va_list args;
-    int rval = 0;
-
-    va_start( args, format );
-    rval = vprintf( format, args );
-    va_end (args);
-
-    return rval;
-}
-void DebugPrintBuffer (printf_type type, UINT8 *buffer, UINT32 length)
-{
-    UINT32  i;
-
-    for( i = 0; i < length; i++ )
-    {
-        if( ( i % 16 ) == 0 ) {
-            printf ("\n");
-        }
-
-        printf ("%2.2x ", buffer[i] );
-    }
-    printf ("\n\n");
-}
-.fi
 .sp
 TCTI initialization fragment:
 .sp
@@ -171,9 +120,6 @@
 TCTI_SOCKET_CONF conf = {
     .hostname          = "127.0.0.1",
     .port              = 2321,
-    .logCallback       = DebugPrintfCallback,
-    .logBufferCallback = DebugPrintBuffer,
-    .logData           = NULL,
 };
 
 rc = InitSocketTcti (NULL, &size, NULL, 0);
diff --git a/tcti/platformcommand.c b/tcti/platformcommand.c
index a5d60b8..e899d82 100644
--- a/tcti/platformcommand.c
+++ b/tcti/platformcommand.c
@@ -32,23 +32,17 @@
 // to send platform commands to the simulator.
 //
 
-//
-// NOTE:  uncomment following if you think you need to see all
-// socket communications.
-//
-//#define DEBUG_SOCKETS
-
 #include <stdio.h>
 #include <stdlib.h>   // Needed for _wtoi
 
 #include "sapi/tpm20.h"
 #include "tcti/tcti_socket.h"
 #include "sysapi_util.h"
-#include "common/debug.h"
 #include <sapi/tss2_tcti.h>
 #include "sockets.h"
 #include "tcti.h"
-#include "logging.h"
+#define LOGMODULE tcti
+#include "log/log.h"
 
 TSS2_RC PlatformCommand(
     TSS2_TCTI_CONTEXT *tctiContext,     /* in */
@@ -65,33 +59,27 @@
     // Send the command
     iResult = send (tcti_intel->otherSock, sendbuf, 4, MSG_NOSIGNAL);
     if (iResult == SOCKET_ERROR) {
-        TCTI_LOG( tctiContext, NO_PREFIX, "send failed with error: %d\n", WSAGetLastError() );
+        LOG_ERROR("send failed with error: %d", WSAGetLastError() );
         rval = TSS2_TCTI_RC_IO_ERROR;
     }
     else
     {
-#ifdef DEBUG_SOCKETS
-        TCTI_LOG( tctiContext, NO_PREFIX, "Send Bytes to socket #0x%x: \n", tcti_intel->otherSock );
-        TCTI_LOG_BUFFER( tctiContext, NO_PREFIX, (UINT8 *)sendbuf, 4 );
-#endif
+        LOGBLOB_DEBUG((uint8_t *)sendbuf, 4, "Send Bytes to socket #0x%x:", tcti_intel->otherSock);
         // Read result
         iResult = recv( tcti_intel->otherSock, recvbuf, 4, 0);
         if (iResult == SOCKET_ERROR) {
-            TCTI_LOG( tctiContext, NO_PREFIX, "In PlatformCommand, recv failed (socket: 0x%x) with error: %d\n",
+            LOG_ERROR("In PlatformCommand, recv failed (socket: 0x%x) with error: %d",
                     tcti_intel->otherSock, WSAGetLastError() );
             rval = TSS2_TCTI_RC_IO_ERROR;
         }
         else if( recvbuf[0] != 0 || recvbuf[1] != 0 || recvbuf[2] != 0 || recvbuf[3] != 0 )
         {
-            TCTI_LOG( tctiContext, NO_PREFIX, "PlatformCommand failed with error: %d\n", recvbuf[3] );
+            LOG_ERROR( "PlatformCommand failed with error: %d", recvbuf[3] );
             rval = TSS2_TCTI_RC_IO_ERROR;
         }
         else
         {
-#ifdef DEBUG_SOCKETS
-            TCTI_LOG( tctiContext, NO_PREFIX, "Receive bytes from socket #0x%x: \n", tcti_intel->otherSock );
-            TCTI_LOG_BUFFER( tctiContext, NO_PREFIX, (UINT8 *)recvbuf, 4 );
-#endif
+            LOGBLOB_DEBUG((uint8_t *)recvbuf, 4, "Receive bytes from socket #0x%x:", tcti_intel->otherSock );
         }
     }
     return rval;
diff --git a/tcti/sockets.c b/tcti/sockets.c
index aa3a411..a66fed1 100644
--- a/tcti/sockets.c
+++ b/tcti/sockets.c
@@ -2,8 +2,9 @@
 #include <netinet/in.h>
 
 #include "tcti/tcti_socket.h"
-#include "common/debug.h"
 #include "sockets.h"
+#define LOGMODULE tcti
+#include "log/log.h"
 
 void WSACleanup() {}
 int WSAGetLastError() { return errno; }
@@ -63,14 +64,11 @@
     return TSS2_RC_SUCCESS;
 }
 
-#define SAFE_CALL(func, ...) (func != NULL) ? func(__VA_ARGS__) : 0
 int
 InitSockets( const char *hostName,
              UINT16 port,
              SOCKET *otherSock,
-             SOCKET *tpmSock,
-             TCTI_LOG_CALLBACK debugfunc,
-             void* data )
+             SOCKET *tpmSock)
 {
     struct sockaddr_in otherService = { 0 };
     struct sockaddr_in tpmService = { 0 };
@@ -82,11 +80,11 @@
     *otherSock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
     if (*otherSock == INVALID_SOCKET)
     {
-        SAFE_CALL( debugfunc, data, NO_PREFIX, "socket creation failed with error = %d\n", WSAGetLastError() );
+        LOG_DEBUG("socket creation failed with error = %d", WSAGetLastError() );
         return(1);
     }
     else {
-        SAFE_CALL( debugfunc, data, NO_PREFIX, "socket created:  0x%x\n", *otherSock );
+        LOG_DEBUG("socket created:  0x%x", *otherSock );
         otherService.sin_family = AF_INET;
         otherService.sin_addr.s_addr = inet_addr( hostName );
         otherService.sin_port = htons(port + 1);
@@ -95,12 +93,12 @@
     *tpmSock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
     if (*tpmSock == INVALID_SOCKET)
     {
-        SAFE_CALL( debugfunc, data, NO_PREFIX, "socket creation failed with error = %d\n", WSAGetLastError() );
+        LOG_DEBUG("socket creation failed with error = %d", WSAGetLastError() );
         closesocket( *otherSock );
         return(1);
     }
     else {
-        SAFE_CALL( debugfunc, data, NO_PREFIX, "socket created:  0x%x\n", *tpmSock );
+        LOG_DEBUG("socket created:  0x%x", *tpmSock );
         tpmService.sin_family = AF_INET;
         tpmService.sin_addr.s_addr = inet_addr( hostName );
         tpmService.sin_port = htons( port );
@@ -130,31 +128,31 @@
     // Connect to server.
     iResult = connect(*otherSock, (SOCKADDR *) &otherService, sizeof (otherService));
     if (iResult == SOCKET_ERROR) {
-        SAFE_CALL( debugfunc, data, NO_PREFIX, "connect function failed with error: %d\n", WSAGetLastError() );
-        closesocket(*otherSock);
+        LOG_DEBUG("connect function failed with error: %d", WSAGetLastError() );
+        iResult = closesocket(*otherSock);
         WSACleanup();
         return 1;
     }
     else
     {
-        SAFE_CALL( debugfunc, data, NO_PREFIX, "Client connected to server on port:  %d\n", port + 1 );
+        LOG_DEBUG("Client connected to server on port:  %d", port + 1 );
     }
 
     // Connect to server.
     iResult = connect(*tpmSock, (SOCKADDR *) &tpmService, sizeof (tpmService));
     if (iResult == SOCKET_ERROR) {
-        SAFE_CALL( debugfunc, data, NO_PREFIX, "connect function failed with error: %d\n", WSAGetLastError() );
+        LOG_DEBUG("connect function failed with error: %d", WSAGetLastError() );
         iResult = closesocket(*otherSock);
         if (iResult == SOCKET_ERROR)
         {
-            SAFE_CALL( debugfunc, data, NO_PREFIX, "closesocket function failed with error: %d\n", WSAGetLastError() );
+            LOG_DEBUG("closesocket function failed with error: %d", WSAGetLastError() );
         }
         WSACleanup();
         return 1;
     }
     else
     {
-        SAFE_CALL( debugfunc, data, NO_PREFIX, "Client connected to server on port:  %d\n", port );
+        LOG_DEBUG("Client connected to server on port:  %d", port );
     }
 
     return 0;
diff --git a/tcti/sockets.h b/tcti/sockets.h
index 9dec8df..16ecfe0 100644
--- a/tcti/sockets.h
+++ b/tcti/sockets.h
@@ -31,9 +31,7 @@
 InitSockets( const char *hostName,
              UINT16 port,
              SOCKET *otherSock,
-             SOCKET *tpmSock,
-             TCTI_LOG_CALLBACK  logCallback,
-             void *logData );
+             SOCKET *tpmSock);
 void CloseSockets( SOCKET serverSock, SOCKET tpmSock );
 TSS2_RC recvBytes( SOCKET tpmSock, unsigned char *data, int len );
 TSS2_RC sendBytes( SOCKET tpmSock, const unsigned char *data, int len );
diff --git a/tcti/tcti.c b/tcti/tcti.c
index cd0eba1..1e2613f 100644
--- a/tcti/tcti.c
+++ b/tcti/tcti.c
@@ -31,7 +31,6 @@
 #include <tcti/common.h>
 #include "sapi/tpm20.h"
 #include "tcti.h"
-#include "common/debug.h"
 
 TSS2_RC tcti_common_checks (
     TSS2_TCTI_CONTEXT *tcti_context
diff --git a/tcti/tcti.h b/tcti/tcti.h
index 42c5e97..51f6e5f 100644
--- a/tcti/tcti.h
+++ b/tcti/tcti.h
@@ -50,9 +50,6 @@
 #define TCTI_MAGIC   0x7e18e9defa8bc9e2ULL
 #define TCTI_VERSION 0x1
 
-#define TCTI_LOG_CALLBACK(ctx) ((TSS2_TCTI_CONTEXT_INTEL*)ctx)->logCallback
-#define TCTI_LOG_DATA(ctx)     ((TSS2_TCTI_CONTEXT_INTEL*)ctx)->logData
-#define TCTI_LOG_BUFFER_CALLBACK(ctx) ((TSS2_TCTI_CONTEXT_INTEL*)ctx)->logBufferCallback
 #define TCTI_CONTEXT ((TSS2_TCTI_CONTEXT_COMMON_CURRENT *)(SYS_CONTEXT->tctiContext))
 
 typedef TSS2_RC (*TCTI_TRANSMIT_PTR)( TSS2_TCTI_CONTEXT *tctiContext, size_t size, uint8_t *command);
@@ -72,16 +69,9 @@
               TSS2_TCTI_POLL_HANDLE *handles, size_t *num_handles);
     TSS2_RC (*setLocality) (TSS2_TCTI_CONTEXT *tctiContext, uint8_t locality);
     struct {
-        UINT32 debugMsgEnabled: 1;
+        UINT32 reserved: 1; /* Used to be debugMsgEnabled which is deprecated */
         UINT32 locality: 8;
         UINT32 commandSent: 1;
-        /*
-         * Used to add a prefix to RM debug messages.  This is ONLY used
-         * for TPM commands and responses as a way to differentiate
-         * RM generated TPM commands from application generated ones.
-         */
-        UINT32 rmDebugPrefix: 1;
-        /* Following two fields used to save partial response status in case receive buffer's too small. */
         UINT32 tagReceived: 1;
         UINT32 responseSizeReceived: 1;
         UINT32 protocolResponseSizeReceived: 1;
@@ -102,9 +92,6 @@
     int devFile;
     UINT8 previousStage;            /* Used to check for sequencing errors. */
     unsigned char responseBuffer[4096];
-    TCTI_LOG_CALLBACK logCallback;
-    TCTI_LOG_BUFFER_CALLBACK logBufferCallback;
-    void *logData;
 } TSS2_TCTI_CONTEXT_INTEL;
 
 /*
diff --git a/tcti/tcti_device.c b/tcti/tcti_device.c
index 67ceb3f..99d282a 100644
--- a/tcti/tcti_device.c
+++ b/tcti/tcti_device.c
@@ -35,10 +35,11 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include "common/debug.h"
+#include <inttypes.h>
 #include "tcti.h"
 #include "tcti/tcti_device.h"
-#include "logging.h"
+#define LOGMODULE tcti
+#include "log/log.h"
 
 TSS2_RC LocalTpmSendTpmCommand(
     TSS2_TCTI_CONTEXT *tctiContext,
@@ -50,47 +51,33 @@
     TSS2_RC rval = TSS2_RC_SUCCESS;
     ssize_t size;
 
-#ifdef DEBUG
-    UINT32 commandCode;
-    UINT32 cnt;
-#endif
-    printf_type rmPrefix;
-
     rval = tcti_send_checks (tctiContext, command_buffer);
     if (rval != TSS2_RC_SUCCESS) {
         return rval;
     }
-    if (tcti_intel->status.rmDebugPrefix == 1) {
-        rmPrefix = RM_PREFIX;
-    } else {
-        rmPrefix = NO_PREFIX;
-    }
-#ifdef DEBUG
+
+#if LOGLEVEL == LOGLEVEL_DEBUG || \
+    LOGLEVEL == LOGLEVEL_TRACE
+    TPM2_ST commandCode = 0xffff;
+    UINT32 cnt = 0xffffffff;
     TSS2_RC rc;
     size_t offset = sizeof (TPM2_ST);
     rc = Tss2_MU_TPM2_ST_Unmarshal (command_buffer,
                                    command_size,
                                    &offset,
                                    &commandCode);
+    if (rc) return rc;
     rc = Tss2_MU_UINT32_Unmarshal (command_buffer,
                                    command_size,
                                    &offset,
                                    &cnt);
-    if (tcti_intel->status.debugMsgEnabled == 1) {
-        TCTI_LOG (tctiContext, rmPrefix, "");
-        TCTI_LOG (tctiContext,
-                  rmPrefix,
-                  "Cmd sent: %s\n",
-                  strTpmCommandCode (commandCode));
-        DEBUG_PRINT_BUFFER (rmPrefix, command_buffer, cnt);
-    }
+    if (rc) return rc;
+    LOGBLOB_DEBUG(command_buffer, cnt, "Cmd sent: %" PRIx16 "; Buffer:",
+        commandCode);
 #endif
     size = write (tcti_intel->devFile, command_buffer, command_size);
     if (size < 0) {
-        TCTI_LOG (tctiContext,
-                  rmPrefix,
-                  "send failed with error: %d\n",
-                  errno);
+        LOG_ERROR("send failed with error: %d", errno);
         return TSS2_TCTI_RC_IO_ERROR;
     } else if ((size_t)size != command_size) {
         return TSS2_TCTI_RC_IO_ERROR;
@@ -115,26 +102,16 @@
     TSS2_RC rval = TSS2_RC_SUCCESS;
     ssize_t  size;
     unsigned int i;
-    printf_type rmPrefix;
 
     rval = tcti_receive_checks (tctiContext, response_size, response_buffer);
     if (rval != TSS2_RC_SUCCESS) {
         goto retLocalTpmReceive;
     }
 
-    if (tcti_intel->status.rmDebugPrefix == 1) {
-        rmPrefix = RM_PREFIX;
-    } else {
-        rmPrefix = NO_PREFIX;
-    }
-
     if (tcti_intel->status.tagReceived == 0) {
         size = read (tcti_intel->devFile, tcti_intel->responseBuffer, 4096);
         if (size < 0) {
-            TCTI_LOG (tctiContext,
-                      rmPrefix,
-                      "read failed with error: %d\n",
-                      errno);
+            LOG_ERROR("send failed with error: %d", errno);
             rval = TSS2_TCTI_RC_IO_ERROR;
             goto retLocalTpmReceive;
         } else {
@@ -162,17 +139,7 @@
         response_buffer[i] = tcti_intel->responseBuffer[i];
     }
 
-#ifdef DEBUG
-    if (tcti_intel->status.debugMsgEnabled == 1 &&
-        tcti_intel->responseSize > 0)
-    {
-        TCTI_LOG (tctiContext, rmPrefix, "\n");
-        TCTI_LOG (tctiContext, rmPrefix, "Response Received: ");
-        DEBUG_PRINT_BUFFER (rmPrefix,
-                            response_buffer,
-                            tcti_intel->responseSize);
-    }
-#endif
+    LOGBLOB_DEBUG(response_buffer, tcti_intel->responseSize, "Response Received");
 
     tcti_intel->status.commandSent = 0;
 
@@ -257,11 +224,8 @@
     TSS2_TCTI_SET_LOCALITY (tctiContext) = LocalTpmSetLocality;
     tcti_intel->status.locality = 3;
     tcti_intel->status.commandSent = 0;
-    tcti_intel->status.rmDebugPrefix = 0;
     tcti_intel->currentTctiContext = 0;
     tcti_intel->previousStage = TCTI_STAGE_INITIALIZE;
-    TCTI_LOG_CALLBACK (tctiContext) = config->logCallback;
-    TCTI_LOG_DATA (tctiContext) = config->logData;
 
     tcti_intel->devFile = open (config->device_path, O_RDWR);
     if (tcti_intel->devFile < 0) {
diff --git a/tcti/tcti_socket.c b/tcti/tcti_socket.c
index 2e06117..77d5f17 100644
--- a/tcti/tcti_socket.c
+++ b/tcti/tcti_socket.c
@@ -28,16 +28,17 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/time.h>
+#include <inttypes.h>
 
 #include "sapi/tpm20.h"
 #include "sapi/tss2_mu.h"
 #include "tcti/tcti_socket.h"
 #include "sysapi_util.h"
-#include "common/debug.h"
 #include "tcti.h"
-#include "logging.h"
 #include "sockets.h"
 #include "tss2_endian.h"
+#define LOGMODULE tcti
+#include "log/log.h"
 
 static TSS2_RC tctiRecvBytes (
     TSS2_TCTI_CONTEXT *tctiContext,
@@ -49,20 +50,11 @@
     TSS2_RC result = 0;
     result = recvBytes (sock, data, len);
     if ((INT32)result == SOCKET_ERROR) {
-        TCTI_LOG (tctiContext,
-                  NO_PREFIX,
-                  "In recvBytes, recv failed (socket: 0x%x) with error: %d\n",
-                  sock,
-                  WSAGetLastError ());
+        LOG_ERROR("In recvBytes, recv failed (socket: 0x%x) with error: %d",
+                  sock, WSAGetLastError ());
         return TSS2_TCTI_RC_IO_ERROR;
     }
-#ifdef DEBUG_SOCKETS
-    TCTI_LOG (tctiContext,
-              NO_PREFIX,
-              "Receive Bytes from socket #0x%x: \n",
-              sock);
-    TCTI_LOG_BUFFER (tctiContext, NO_PREFIX, data, len);
-#endif
+    LOGBLOB_DEBUG(data, len, "Receive Bytes from socket #0x%x:", sock);
 
     return TSS2_RC_SUCCESS;
 }
@@ -76,18 +68,12 @@
 {
     TSS2_RC ret = TSS2_RC_SUCCESS;
 
-#ifdef DEBUG_SOCKETS
-    TCTI_LOG (tctiContext, NO_PREFIX, "Send Bytes to socket #0x%x: \n", sock);
-    TCTI_LOG_BUFFER (tctiContext, NO_PREFIX, (UINT8 *)data, len);
-#endif
+    LOGBLOB_DEBUG(data, len, "Send Bytes to socket #0x%x:", sock);
 
     ret = sendBytes (sock, data, len);
     if (ret != TSS2_RC_SUCCESS) {
-        TCTI_LOG (tctiContext,
-                  NO_PREFIX,
-                  "In recvBytes, recv failed (socket: 0x%x) with error: %d\n",
-                  sock,
-                  WSAGetLastError ());
+        LOG_ERROR("In recvBytes, recv failed (socket: 0x%x) with error: %d",
+                  sock, WSAGetLastError ());
     }
     return ret;
 }
@@ -134,44 +120,22 @@
     TSS2_RC rval = TSS2_RC_SUCCESS;
     size_t offset;
 
-#ifdef DEBUG
-    UINT32 commandCode;
-    printf_type rmPrefix;
-#endif
     rval = tcti_send_checks (tctiContext, command_buffer);
     if (rval != TSS2_RC_SUCCESS) {
         return rval;
     }
 
-#ifdef DEBUG
-    if (tcti_intel->status.rmDebugPrefix == 1) {
-        rmPrefix = RM_PREFIX;
-    } else {
-        rmPrefix = NO_PREFIX;
-    }
-
-    if (tcti_intel->status.debugMsgEnabled == 1) {
-        TCTI_LOG (tctiContext, rmPrefix, "");
-        offset = sizeof (TPM2_ST) + sizeof (UINT32);
-        rval = Tss2_MU_TPM2_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
-        TCTI_LOG (tctiContext,
-                  NO_PREFIX,
-                  "Cmd sent: %s\n",
-                  strTpmCommandCode (commandCode));
-#endif
-    }
+#if LOGLEVEL == LOGLEVEL_DEBUG || \
+    LOGLEVEL == LOGLEVEL_TRACE
+    UINT32 commandCode;
+    offset = sizeof (TPM2_ST) + sizeof (UINT32);
+    rval = Tss2_MU_TPM2_CC_Unmarshal (command_buffer,
+                                     command_size,
+                                     &offset,
+                                     &commandCode);
+    if (rval) return rval;
+    LOG_DEBUG("Command sent on socket #0x%x: %" PRIx16, tcti_intel->tpmSock,
+        commandCode);
 #endif
     /*
      * Size TPM 1.2 and TPM 2.0 headers overlap exactly, we can use
@@ -213,14 +177,7 @@
         return rval;
     }
 
-#ifdef DEBUG
-    if (tcti_intel->status.debugMsgEnabled == 1) {
-        TCTI_LOG (tctiContext,
-                  rmPrefix,
-                  "Locality = %d",
-                  tcti_intel->status.locality);
-    }
-#endif
+    LOG_DEBUG("Locality = %d", tcti_intel->status.locality);
 
     /* Send number of bytes. */
     cnt1 = cnt;
@@ -241,12 +198,8 @@
     if (rval != TSS2_RC_SUCCESS) {
         return rval;
     }
+    LOGBLOB_DEBUG(command_buffer, cnt1, "Sent command buffer=");
 
-#ifdef DEBUG
-    if (tcti_intel->status.debugMsgEnabled == 1) {
-        DEBUG_PRINT_BUFFER (rmPrefix, command_buffer, cnt1);
-    }
-#endif
     tcti_intel->status.commandSent = 1;
 
     tcti_intel->previousStage = TCTI_STAGE_SEND_COMMAND;
@@ -336,19 +289,12 @@
     int32_t timeoutMsecs = timeout % 1000;
     int iResult;
     unsigned char responseSizeDelta = 0;
-    printf_type rmPrefix;
 
     rval = tcti_receive_checks (tctiContext, response_size, response_buffer);
     if (rval != TSS2_RC_SUCCESS) {
         goto retSocketReceiveTpmResponse;
     }
 
-    if (tcti_intel->status.rmDebugPrefix == 1) {
-        rmPrefix = RM_PREFIX;
-    } else {
-        rmPrefix = NO_PREFIX;
-    }
-
     if (timeout == TSS2_TCTI_TIMEOUT_BLOCK) {
         tvPtr = 0;
     } else {
@@ -362,23 +308,17 @@
 
     iResult = select (tcti_intel->tpmSock + 1, &readFds, 0, 0, tvPtr);
     if (iResult == 0) {
-        TCTI_LOG (tctiContext,
-                  rmPrefix,
-                  "select failed due to timeout, socket #: 0x%x\n",
+        LOG_ERROR("select failed due to timeout, socket #: 0x%x",
                   tcti_intel->tpmSock);
         rval = TSS2_TCTI_RC_TRY_AGAIN;
         goto retSocketReceiveTpmResponse;
     } else if (iResult == SOCKET_ERROR) {
-        TCTI_LOG (tctiContext,
-                  rmPrefix,
-                  "select failed with socket error: %d\n",
+        LOG_ERROR("select failed with socket error: %d",
                   WSAGetLastError ());
         rval = TSS2_TCTI_RC_IO_ERROR;
         goto retSocketReceiveTpmResponse;
     } else if (iResult != 1) {
-        TCTI_LOG (tctiContext,
-                  rmPrefix,
-                  "select failed, read the wrong # of bytes: %d\n",
+        LOG_ERROR("select failed, read the wrong # of bytes: %d",
                   iResult);
         rval = TSS2_TCTI_RC_IO_ERROR;
         goto retSocketReceiveTpmResponse;
@@ -439,18 +379,11 @@
             }
         }
     } else {
-        if (tcti_intel->status.debugMsgEnabled == 1 &&
-            tcti_intel->responseSize > 0)
+        if (tcti_intel->responseSize > 0)
         {
-#ifdef DEBUG
-            TCTI_LOG (tctiContext, rmPrefix, "Response Received: ");
-#endif
-#ifdef DEBUG_SOCKETS
-            TCTI_LOG (tctiContext,
-                      rmPrefix,
-                      "from socket #0x%x:\n",
+            LOG_DEBUG("Response Received: ");
+            LOG_DEBUG("from socket #0x%x:",
                       tcti_intel->tpmSock);
-#endif
         }
 
         if (tcti_intel->status.tagReceived == 1) {
@@ -473,14 +406,8 @@
         if (rval != TSS2_RC_SUCCESS) {
             goto retSocketReceiveTpmResponse;
         }
-
-#ifdef DEBUG
-        if (tcti_intel->status.debugMsgEnabled == 1) {
-            DEBUG_PRINT_BUFFER (rmPrefix,
-                                response_buffer,
-                                tcti_intel->responseSize);
-        }
-#endif
+        LOGBLOB_DEBUG(response_buffer, tcti_intel->responseSize,
+            "Received response buffer=");
 
         /* Receive the appended four bytes of 0's */
         rval = tctiRecvBytes (tctiContext,
@@ -579,25 +506,18 @@
     TSS2_TCTI_CANCEL (tctiContext) = SocketCancel;
     TSS2_TCTI_GET_POLL_HANDLES (tctiContext) = SocketGetPollHandles;
     TSS2_TCTI_SET_LOCALITY (tctiContext) = SocketSetLocality;
-    tcti_intel->status.debugMsgEnabled = 0;
     tcti_intel->status.locality = 3;
     tcti_intel->status.commandSent = 0;
-    tcti_intel->status.rmDebugPrefix = 0;
     tcti_intel->status.tagReceived = 0;
     tcti_intel->status.responseSizeReceived = 0;
     tcti_intel->status.protocolResponseSizeReceived = 0;
     tcti_intel->currentTctiContext = 0;
     tcti_intel->previousStage = TCTI_STAGE_INITIALIZE;
-    TCTI_LOG_CALLBACK (tctiContext) = conf->logCallback;
-    TCTI_LOG_BUFFER_CALLBACK (tctiContext) = conf->logBufferCallback;
-    TCTI_LOG_DATA (tctiContext) = conf->logData;
 
     rval = (TSS2_RC) InitSockets (conf->hostname,
                                   conf->port,
                                   &otherSock,
-                                  &tpmSock,
-                                  TCTI_LOG_CALLBACK (tctiContext),
-                                  TCTI_LOG_DATA (tctiContext));
+                                  &tpmSock);
     if (rval == TSS2_RC_SUCCESS) {
         tcti_intel->otherSock = otherSock;
         tcti_intel->tpmSock = tpmSock;
diff --git a/test/integration/context-util.c b/test/integration/context-util.c
index 868bd21..6b89652 100644
--- a/test/integration/context-util.c
+++ b/test/integration/context-util.c
@@ -15,8 +15,6 @@
 {
     TCTI_DEVICE_CONF conf = {
         .device_path =device_path,
-        .logCallback = NULL,
-        .logData     = NULL,
     };
     size_t size;
     TSS2_RC rc;
@@ -48,8 +46,7 @@
 }
 /*
  * 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 hostname and port are the only configuration options used.
  * The caller is returned a TCTI context structure that is allocated by this
  * function. This structure must be freed by the caller.
  */
@@ -60,9 +57,6 @@
     TCTI_SOCKET_CONF conf = {
         .hostname          = address,
         .port              = port,
-        .logCallback       = NULL,
-        .logBufferCallback = NULL,
-        .logData           = NULL,
     };
     size_t size;
     TSS2_RC rc;
diff --git a/test/tpmclient/StartAuthSession.c b/test/tpmclient/StartAuthSession.c
index eac213b..3ccc7b8 100644
--- a/test/tpmclient/StartAuthSession.c
+++ b/test/tpmclient/StartAuthSession.c
@@ -29,6 +29,8 @@
 #include "sample.h"
 #include "../integration/sapi-util.h"
 #include <stdlib.h>
+#define LOGMODULE testtpmclient
+#include "log/log.h"
 
 #define SESSIONS_ARRAY_COUNT MAX_NUM_SESSIONS+1
 
@@ -47,7 +49,7 @@
 {
     SESSION_LIST_ENTRY **lastEntry, *newEntry;
 
-//    DebugPrintf( 0, "In AddSession\n" );
+//    LOG_INFO("In AddSession\n" );
 
     // find end of list.
     for( lastEntry = &sessionsList; *lastEntry != 0; lastEntry = &( (SESSION_LIST_ENTRY *)*lastEntry)->nextEntry )
@@ -74,7 +76,7 @@
     SESSION_LIST_ENTRY *predSession;
     SESSION_LIST_ENTRY *newNextEntry;
 
-//    DebugPrintf( 0, "In DeleteSession\n" );
+//    LOG_INFO("In DeleteSession\n" );
 
     if( session == &sessionsList->session )
         sessionsList = 0;
@@ -105,7 +107,7 @@
     TSS2_RC rval = TSS2_APP_RC_GET_SESSION_STRUCT_FAILED;
     SESSION_LIST_ENTRY *sessionEntry;
 
-    DebugPrintf( 0, "In GetSessionStruct\n" );
+    LOG_INFO("In GetSessionStruct\n" );
 
     if( session != 0 )
     {
@@ -131,7 +133,7 @@
     TSS2_RC rval = TSS2_APP_RC_GET_SESSION_ALG_ID_FAILED;
     SESSION *session;
 
-    DebugPrintf( 0, "In GetSessionAlgId\n" );
+    LOG_INFO("In GetSessionAlgId\n" );
 
     rval = GetSessionStruct( sessionHandle, &session );
 
diff --git a/test/tpmclient/sample.h b/test/tpmclient/sample.h
index 800910d..62fa644 100644
--- a/test/tpmclient/sample.h
+++ b/test/tpmclient/sample.h
@@ -38,7 +38,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include "syscontext.h"
-#include "common/debug.h"
 
 extern TSS2_TCTI_CONTEXT *resMgrTctiContext;
 extern TSS2_ABI_VERSION abiVersion;
diff --git a/test/tpmclient/tcti_util.c b/test/tpmclient/tcti_util.c
index 266bc1c..4abb577 100644
--- a/test/tpmclient/tcti_util.c
+++ b/test/tpmclient/tcti_util.c
@@ -1,5 +1,6 @@
 #include "tcti_util.h"
-#include "common/debug.h"
+#define LOGMODULE testtpmclient
+#include "log/log.h"
 
 TSS2_RC InitDeviceTctiContext( const TCTI_DEVICE_CONF *driverConfig, TSS2_TCTI_CONTEXT **tctiContext, const char *deviceTctiName )
 {
@@ -13,7 +14,7 @@
 
     *tctiContext = malloc(size);
 
-    DebugPrintf( NO_PREFIX, "Initializing %s Interface\n", deviceTctiName );
+    LOG_DEBUG("Initializing %s Interface\n", deviceTctiName );
     rval = InitDeviceTcti(*tctiContext, &size, driverConfig );
     return rval;
 }
diff --git a/test/tpmclient/tpmclient.int.c b/test/tpmclient/tpmclient.int.c
index 718af6b..1f9d282 100644
--- a/test/tpmclient/tpmclient.int.c
+++ b/test/tpmclient/tpmclient.int.c
@@ -41,7 +41,8 @@
 #include "tcti/tcti_device.h"
 #include "tcti/tcti_socket.h"
 #include "syscontext.h"
-#include "common/debug.h"
+#define LOGMODULE testtpmclient
+#include "log/log.h"
 
 //
 // TPM indices and sizes
@@ -96,10 +97,7 @@
 
 TCTI_SOCKET_CONF rmInterfaceConfig = {
     DEFAULT_HOSTNAME,
-    DEFAULT_SIMULATOR_TPM_PORT,
-    DebugPrintfCallback,
-    DebugPrintBufferCallback,
-    NULL
+    DEFAULT_SIMULATOR_TPM_PORT
 };
 
 TSS2_TCTI_CONTEXT *resMgrTctiContext = 0;
@@ -124,18 +122,7 @@
 
 void PrintSizedBuffer( TPM2B *sizedBuffer )
 {
-    int i;
-
-    for( i = 0; i < sizedBuffer->size; i++ )
-    {
-        DebugPrintf( NO_PREFIX, "%2.2x ", sizedBuffer->buffer[i] );
-
-        if( ( (i+1) % 16 ) == 0 )
-        {
-            DebugPrintf( NO_PREFIX, "\n" );
-        }
-    }
-    DebugPrintf( NO_PREFIX, "\n" );
+    LOGBLOB_INFO("", sizedBuffer->buffer, sizedBuffer->size);
 }
 
 #define LEVEL_STRING_SIZE 50
@@ -194,7 +181,7 @@
 
 void InitSysContextFailure()
 {
-    DebugPrintf( NO_PREFIX, "InitSysContext failed, exiting...\n" );
+    LOG_ERROR("InitSysContext failed, exiting...\n" );
     Cleanup();
 }
 
@@ -211,14 +198,14 @@
 
 #define CheckPassed(rval) {				\
     							\
-    DebugPrintf( NO_PREFIX, "\tpassing case:  " );			\
+    LOG_INFO("\tpassing case:  " );			\
     if ( rval != TPM2_RC_SUCCESS) {					\
       ErrorHandler( rval);						\
-      DebugPrintf( NO_PREFIX, "\tFAILED!  %s (%s@%u)\n",		\
+      LOG_INFO("\tFAILED!  %s (%s@%u)\n",		\
 		   errorString, __FUNCTION__, __LINE__ );		\
       Cleanup();							\
     } else {								\
-      DebugPrintf( NO_PREFIX, "\tPASSED! (%s@%u)\n",			\
+      LOG_INFO("\tPASSED! (%s@%u)\n",			\
 		   __FUNCTION__, __LINE__);				\
     }									\
     									\
@@ -231,14 +218,14 @@
 TPM2B_AUTH nullSessionHmac;
 
 #define CheckFailed(rval, expectedTpmErrorCode) {			\
-    DebugPrintf( NO_PREFIX, "\tfailing case:");				\
+    LOG_INFO("\tfailing case:");				\
     if ( rval != expectedTpmErrorCode) {				\
       ErrorHandler( rval);						\
-      DebugPrintf( NO_PREFIX, "\tFAILED!  Ret code s/b: 0x%x, but was: 0x%x (%s@%u)\n", \
+      LOG_INFO("\tFAILED!  Ret code s/b: 0x%x, but was: 0x%x (%s@%u)\n", \
 		   expectedTpmErrorCode, rval, __FUNCTION__, __LINE__ ); \
       Cleanup();							\
     }	else {								\
-      DebugPrintf( NO_PREFIX, "\tPASSED! (%s@%u)\n",			\
+      LOG_INFO("\tPASSED! (%s@%u)\n",			\
 		   __FUNCTION__, __LINE__);				\
     }									\
     Delay(0);							\
@@ -268,7 +255,7 @@
         .nonce={.size=0},
         .hmac={.size=0}}}};
 
-    DebugPrintf( NO_PREFIX, "\nDICTIONARY ATTACK LOCK RESET TEST  :\n" );
+    LOG_INFO("\nDICTIONARY ATTACK LOCK RESET TEST  :\n" );
 
     rval = Tss2_Sys_DictionaryAttackLockReset ( sysContext, TPM2_RH_LOCKOUT, &sessionsData, &sessionsDataOut );
     CheckPassed( rval );
@@ -302,7 +289,7 @@
 {
     UINT32 rval;
 
-    DebugPrintf( NO_PREFIX, "\nSTARTUP TESTS:\n" );
+    LOG_INFO("\nSTARTUP TESTS:\n" );
 
     //
     // First test the one-call interface.
@@ -370,20 +357,20 @@
     TPMI_YES_NO moreData;
     TPMS_CAPABILITY_DATA capabilityData;
 
-    DebugPrintf( NO_PREFIX, "\nGET_CAPABILITY TESTS:\n" );
+    LOG_INFO("\nGET_CAPABILITY TESTS:\n" );
 
     rval = Tss2_Sys_GetCapability( sysContext, 0, TPM2_CAP_TPM_PROPERTIES, TPM2_PT_MANUFACTURER, 1, &moreData, &capabilityData, 0 );
     CheckPassed( rval );
 
     *((UINT32 *)manuIDPtr) = BE_TO_HOST_32(capabilityData.data.tpmProperties.tpmProperty[0].value);
-    DebugPrintf( NO_PREFIX, "\t\tcount: %d, property: %x, manuId: %s\n",
+    LOG_INFO("\t\tcount: %d, property: %x, manuId: %s\n",
             capabilityData.data.tpmProperties.count,
             capabilityData.data.tpmProperties.tpmProperty[0].property,
             manuID );
 
     rval = Tss2_Sys_GetCapability( sysContext, 0, TPM2_CAP_TPM_PROPERTIES, TPM2_PT_MAX_COMMAND_SIZE, 1, &moreData, &capabilityData, 0 );
     CheckPassed( rval );
-    DebugPrintf( NO_PREFIX, "\t\tcount: %d, property: %x, max cmd size: %d\n",
+    LOG_INFO("\t\tcount: %d, property: %x, max cmd size: %d\n",
             capabilityData.data.tpmProperties.count,
             capabilityData.data.tpmProperties.tpmProperty[0].property,
             capabilityData.data.tpmProperties.tpmProperty[0].value );
@@ -391,7 +378,7 @@
 
     rval = Tss2_Sys_GetCapability( sysContext, 0, TPM2_CAP_TPM_PROPERTIES, TPM2_PT_MAX_COMMAND_SIZE, 40, &moreData, &capabilityData, 0 );
     CheckPassed( rval );
-    DebugPrintf( NO_PREFIX, "\t\tcount: %d, property: %x, max cmd size: %d\n",
+    LOG_INFO("\t\tcount: %d, property: %x, max cmd size: %d\n",
             capabilityData.data.tpmProperties.count,
             capabilityData.data.tpmProperties.tpmProperty[0].property,
             capabilityData.data.tpmProperties.tpmProperty[0].value );
@@ -399,7 +386,7 @@
 
     rval = Tss2_Sys_GetCapability( sysContext, 0, TPM2_CAP_TPM_PROPERTIES, TPM2_PT_MAX_RESPONSE_SIZE, 1, &moreData, &capabilityData, 0 );
     CheckPassed( rval );
-    DebugPrintf( NO_PREFIX, "\t count: %d, property: %x, max response size: %d\n",
+    LOG_INFO("\t count: %d, property: %x, max response size: %d\n",
             capabilityData.data.tpmProperties.count,
             capabilityData.data.tpmProperties.tpmProperty[0].property,
             capabilityData.data.tpmProperties.tpmProperty[0].value );
@@ -421,7 +408,7 @@
         .nonce=nonce,
         .hmac=hmac}}};
 
-    DebugPrintf( NO_PREFIX, "\nCLEAR and CLEAR CONTROL TESTS:\n" );
+    LOG_INFO("\nCLEAR and CLEAR CONTROL TESTS:\n" );
 
     rval = Tss2_Sys_Clear ( sysContext, TPM2_RH_PLATFORM, &sessionsDataIn, 0 );
     CheckPassed( rval );
@@ -482,7 +469,7 @@
 
     encryptedSalt.size = 0;
 
-    DebugPrintf( NO_PREFIX, "\nSTART_AUTH_SESSION TESTS:\n" );
+    LOG_INFO("\nSTART_AUTH_SESSION TESTS:\n" );
 
     symmetric.algorithm = TPM2_ALG_NULL;
     symmetric.keyBits.sym = 0;
@@ -510,7 +497,7 @@
         // Init session struct
         rval = StartAuthSessionWithParams( &sessions[i], TPM2_RH_NULL, 0, TPM2_RH_PLATFORM, 0, &nonceCaller, &encryptedSalt, TPM2_SE_POLICY, &symmetric, TPM2_ALG_SHA256, resMgrTctiContext );
         CheckPassed( rval );
-        DebugPrintf( NO_PREFIX, "Number of sessions created: %d\n\n", i+1 );
+        LOG_INFO("Number of sessions created: %d\n\n", i+1 );
 
     }
     // clean up the sessions that I don't want here.
@@ -563,7 +550,7 @@
         .nonce = {.size = 0},
         .hmac = {.size = 0}}}};
 
-    DebugPrintf( NO_PREFIX, "\nCHANGE_EPS TESTS:\n" );
+    LOG_INFO("\nCHANGE_EPS TESTS:\n" );
 
     rval = Tss2_Sys_ChangeEPS( sysContext, TPM2_RH_PLATFORM, &sessionsData, &sessionsDataOut );
     CheckPassed( rval );
@@ -581,7 +568,7 @@
         .nonce = {.size = 0},
         .hmac = {.size = 0}}}};
 
-    DebugPrintf( NO_PREFIX, "\nCHANGE_PPS TESTS:\n" );
+    LOG_INFO("\nCHANGE_PPS TESTS:\n" );
 
     rval = Tss2_Sys_ChangePPS( sysContext, TPM2_RH_PLATFORM, &sessionsData, &sessionsDataOut );
     CheckPassed( rval );
@@ -599,7 +586,7 @@
         .nonce = {.size = 0},
         .hmac = {.size = 0}}}};
 
-    DebugPrintf( NO_PREFIX, "\nHIERARCHY_CHANGE_AUTH TESTS:\n" );
+    LOG_INFO("\nHIERARCHY_CHANGE_AUTH TESTS:\n" );
 
     newAuth.size = 0;
     rval = Tss2_Sys_HierarchyChangeAuth( sysContext, TPM2_RH_PLATFORM, &sessionsData, &newAuth, 0 );
@@ -671,7 +658,7 @@
         .nonce = {.size = 0},
         .hmac = {.size = 0}}}};
 
-    DebugPrintf( NO_PREFIX, "\nPCR_EXTEND, PCR_EVENT, PCR_ALLOCATE, and PCR_READ TESTS:\n" );
+    LOG_INFO("\nPCR_EXTEND, PCR_EVENT, PCR_ALLOCATE, and PCR_READ TESTS:\n" );
 
     // Init digests
     digests.count = 1;
@@ -712,13 +699,13 @@
 
     if( pcrUpdateCounterBeforeExtend == pcrUpdateCounterAfterExtend )
     {
-        DebugPrintf( NO_PREFIX, "ERROR!! pcrUpdateCounter didn't change value\n" );
+        LOG_ERROR("ERROR!! pcrUpdateCounter didn't change value\n" );
         Cleanup();
     }
 
     if( 0 == memcmp( &( pcrBeforeExtend[0] ), &( pcrAfterExtend[0] ), 20 ) )
     {
-        DebugPrintf( NO_PREFIX, "ERROR!! PCR didn't change value\n" );
+        LOG_ERROR("ERROR!! PCR didn't change value\n" );
         Cleanup();
     }
 
@@ -742,7 +729,7 @@
     UINT32 rval;
     TSS2L_SYS_AUTH_RESPONSE sessionsDataOut;
 
-    DebugPrintf( NO_PREFIX, "\nSHUTDOWN TESTS:\n" );
+    LOG_INFO("\nSHUTDOWN TESTS:\n" );
 
     rval = Tss2_Sys_Shutdown( sysContext, 0, TPM2_SU_STATE, &sessionsDataOut );
     CheckPassed( rval );
@@ -773,7 +760,7 @@
         .nonce = {.size = 0},
         .hmac = {.size = 0}}}};
 
-    DebugPrintf( NO_PREFIX, "\nNV INDEX TESTS:\n" );
+    LOG_INFO("\nNV INDEX TESTS:\n" );
 
     nvAuth.size = 20;
     for( i = 0; i < nvAuth.size; i++ ) {
@@ -911,7 +898,7 @@
         .nonce = {.size = 0},
         .hmac = {.size = 0}}}};
 
-    DebugPrintf( NO_PREFIX, "\nHIERARCHY CONTROL TESTS:\n" );
+    LOG_INFO("\nHIERARCHY CONTROL TESTS:\n" );
 
     nvAuth.size = 20;
     for( i = 0; i < nvAuth.size; i++ ) {
@@ -1000,7 +987,7 @@
         .nonce = {.size = 0},
         .hmac = {.size = 0}}}};
 
-    DebugPrintf( NO_PREFIX, "\nCREATE, CREATE PRIMARY, and LOAD TESTS:\n" );
+    LOG_INFO("\nCREATE, CREATE PRIMARY, and LOAD TESTS:\n" );
 
     inSensitive.sensitive.userAuth = loadedSha1KeyAuth;
     inSensitive.sensitive.userAuth = loadedSha1KeyAuth;
@@ -1067,7 +1054,7 @@
             &creationTicket, &name, &sessionsDataOut );
     CheckPassed( rval );
 
-    DebugPrintf( NO_PREFIX, "\nNew key successfully created in platform hierarchy (RSA 2048).  Handle: 0x%8.8x\n",
+    LOG_INFO("\nNew key successfully created in platform hierarchy (RSA 2048).  Handle: 0x%8.8x\n",
             handle2048rsa );
 
     sessionsData.auths[0].hmac.size = 2;
@@ -1101,12 +1088,12 @@
 
     rval = TpmHandleToName( loadedSha1KeyHandle, &name1 );
     CheckPassed( rval );
-    DebugPrintf( NO_PREFIX, "Name of loaded key: " );
+    LOG_INFO("Name of loaded key: " );
     PrintSizedBuffer((TPM2B *)&name1);
     rval = CompareTPM2B((TPM2B *)&name, (TPM2B *)&name1);
     CheckPassed( rval );
 
-    DebugPrintf( NO_PREFIX, "\nLoaded key handle:  %8.8x\n", loadedSha1KeyHandle );
+    LOG_INFO("\nLoaded key handle:  %8.8x\n", loadedSha1KeyHandle );
 }
 
 void TestEvict()
@@ -1119,7 +1106,7 @@
         .nonce = {.size = 0},
         .hmac = {.size = 0}}}};
 
-    DebugPrintf( NO_PREFIX, "\nEVICT CONTROL TESTS:\n" );
+    LOG_INFO("\nEVICT CONTROL TESTS:\n" );
 
     rval = Tss2_Sys_EvictControl( sysContext, TPM2_RH_PLATFORM, handle2048rsa, &sessionsData, 0x81800000, &sessionsDataOut );
     CheckPassed( rval );
@@ -1589,7 +1576,7 @@
     unsigned int i;
     SESSION *policySession = 0;
 
-    DebugPrintf( NO_PREFIX, "\nPOLICY TESTS:\n" );
+    LOG_INFO("\nPOLICY TESTS:\n" );
 
     for( i = 0; i < ( sizeof( policyTestSetups ) / sizeof( POLICY_TEST_SETUP ) ); i++ )
     {
@@ -1599,26 +1586,21 @@
 
         rval = TPM2_RC_SUCCESS;
 
-        DebugPrintf( NO_PREFIX, "Policy Test: %s\n", policyTestSetups[i].name );
+        LOG_INFO("Policy Test: %s\n", policyTestSetups[i].name );
 
         // Create trial policy session and run policy commands, in order to create policyDigest.
         if( policyTestSetups[i].buildPolicyFn != 0)
         {
             rval = BuildPolicy( sysContext, &policySession, policyTestSetups[i].buildPolicyFn, &policyDigest, true );
             CheckPassed( rval );
-#ifdef DEBUG
-            DebugPrintf( NO_PREFIX, "Built policy digest:  \n" );
-            DebugPrintBuffer( NO_PREFIX, &(policyDigest.buffer[0]), policyDigest.size );
-#endif
+            LOGBLOB_DEBUG("Built policy digest:", &(policyDigest.buffer[0]), policyDigest.size );
         }
 
         // Create entity that will use that policyDigest as authPolicy.
         if( policyTestSetups[i].createObjectFn != 0 )
         {
-#ifdef DEBUG
-            DebugPrintf( NO_PREFIX, "Policy digest used to create object:  \n" );
-            DebugPrintBuffer( NO_PREFIX, &(policyDigest.buffer[0]), policyDigest.size );
-#endif
+            LOGBLOB_DEBUG("Policy digest used to create object:",
+                &(policyDigest.buffer[0]), policyDigest.size );
 
             rval = ( *policyTestSetups[i].createObjectFn )( sysContext, &policySession, &policyDigest);
             CheckPassed( rval );
@@ -1630,10 +1612,8 @@
         {
             rval = BuildPolicy( sysContext, &policySession, policyTestSetups[i].buildPolicyFn, &policyDigest, false );
             CheckPassed( rval );
-#ifdef DEBUG
-            DebugPrintf( NO_PREFIX, "Command policy digest:  \n" );
-            DebugPrintBuffer( NO_PREFIX, &(policyDigest.buffer[0]), policyDigest.size );
-#endif
+            LOGBLOB_DEBUG("Command policy digest: ",
+                &(policyDigest.buffer[0]), policyDigest.size );
         }
 
         if( policySession )
@@ -1743,7 +1723,7 @@
             { 0xB3, 0xFD, 0x6A, 0xD2, 0x9F, 0xD0, 0x13, 0x52, 0xBA, 0xFC,
               0x8B, 0x22, 0xC9, 0x6D, 0x88, 0x42, 0xA3, 0x3C, 0xB0, 0xC9 };
 
-    DebugPrintf( NO_PREFIX, "\nHASH TESTS:\n" );
+    LOG_INFO("\nHASH TESTS:\n" );
 
     auth.size = 2;
     auth.buffer[0] = 0;
@@ -1771,7 +1751,7 @@
 
     // Test the resulting hash.
     if (memcmp(result.buffer, goodHashValue, result.size)) {
-        DebugPrintf( NO_PREFIX, "ERROR!! resulting hash is incorrect.\n" );
+        LOG_ERROR("ERROR!! resulting hash is incorrect.\n" );
         Cleanup();
     }
 }
@@ -1792,7 +1772,7 @@
         .nonce={.size=0},
         .hmac={.size=2, .buffer={0x00,0xff}}}}};
 
-    DebugPrintf( NO_PREFIX, "\nQUOTE CONTROL TESTS:\n" );
+    LOG_INFO("\nQUOTE CONTROL TESTS:\n" );
 
     qualifyingData.size = sizeof( qualDataString );
     memcpy( &( qualifyingData.buffer[0] ), qualDataString, sizeof( qualDataString ) );
@@ -1841,7 +1821,7 @@
         .nonce={.size=0},
         .hmac={.size=0}}}};
 
-    DebugPrintf( NO_PREFIX, "\nPROVISION OTHER NV INDICES:\n" );
+    LOG_INFO("\nPROVISION OTHER NV INDICES:\n" );
 
     //
     // AUX index: Write is controlled by TPM2_PolicyLocality; Read is controlled by authValue and is unrestricted since authValue is set to emptyBuffer
@@ -1861,7 +1841,7 @@
     CheckPassed( rval );
 
     // Now save the policy digest from the first OR branch.
-    DEBUG_PRINT_BUFFER( NO_PREFIX, &( nvPolicyHash.buffer[0] ), nvPolicyHash.size );
+    LOGBLOB_INFO("", &( nvPolicyHash.buffer[0] ), nvPolicyHash.size );
 
     // init nvAuth
     nvAuth.size = 0;
@@ -1933,7 +1913,7 @@
         .nonce={.size=0},
         .hmac={.size=0}}}};
 
-    DebugPrintf( NO_PREFIX, "\nPROVISION NV AUX:\n" );
+    LOG_INFO("\nPROVISION NV AUX:\n" );
 
     //
     // AUX index: Write is controlled by TPM2_PolicyLocality; Read is controlled by authValue and is unrestricted since authValue is set to emptyBuffer
@@ -1953,7 +1933,7 @@
     CheckPassed( rval );
 
     // Now save the policy digest.
-    DEBUG_PRINT_BUFFER( NO_PREFIX, &( nvPolicyHash.buffer[0] ), nvPolicyHash.size );
+    LOGBLOB_INFO("", &( nvPolicyHash.buffer[0] ), nvPolicyHash.size );
 
     // init nvAuth
     nvAuth.size = 0;
@@ -2045,7 +2025,7 @@
     int testLocality;
     TPM2B_MAX_NV_BUFFER nvData;
 
-    DebugPrintf( NO_PREFIX, "TPM AUX READ/WRITE TEST\n" );
+    LOG_INFO("TPM AUX READ/WRITE TEST\n" );
 
     nullSessionsData.auths[0].sessionAttributes &= ~TPMA_SESSION_CONTINUESESSION;
 
@@ -2081,7 +2061,7 @@
 
     nullSessionsData.auths[0].sessionHandle = TPM2_RS_PW;
 
-    DebugPrintf( NO_PREFIX, "TPM OTHER READ/WRITE TEST\n" );
+    LOG_INFO("TPM OTHER READ/WRITE TEST\n" );
 
     nvWriteData.size = 4;
     for( i = 0; i < nvWriteData.size; i++ )
@@ -2106,7 +2086,7 @@
 {
     UINT32 rval;
 
-    DebugPrintf( NO_PREFIX, "\nNV INDEX PROTOTYPE TESTS:\n" );
+    LOG_INFO("\nNV INDEX PROTOTYPE TESTS:\n" );
 
 
     // AUX index: Write is controlled by TPM2_PolicyLocality; Read is controlled by authValue and is unrestricted since authValue is set to emptyBuffer
@@ -2150,7 +2130,7 @@
         .nonce={.size=0},
         .hmac={.size=0}}}};
 
-    DebugPrintf( NO_PREFIX, "\nPCR ALLOCATE TEST  :\n" );
+    LOG_INFO("\nPCR ALLOCATE TEST  :\n" );
 
     pcrSelection.count = 0;
 
@@ -2207,7 +2187,7 @@
     const char authStr[] = "test";
     const char sensitiveData[] = "this is sensitive";
 
-    DebugPrintf( NO_PREFIX, "\nUNSEAL TEST  :\n" );
+    LOG_INFO("\nUNSEAL TEST  :\n" );
 
     inSensitive.sensitive.userAuth.size = sizeof( authStr ) - 1;
     memcpy( &( inSensitive.sensitive.userAuth.buffer[0] ), authStr, sizeof( authStr ) - 1 );
@@ -2331,7 +2311,7 @@
 
     TPM2B_MAX_NV_BUFFER nvWriteData;
 
-    DebugPrintf( NO_PREFIX, "\nPASSWORD TESTS:\n" );
+    LOG_INFO("\nPASSWORD TESTS:\n" );
 
     // Create an NV index that will use password
     // authorizations the password will be
@@ -2412,7 +2392,7 @@
 
     nonceCaller.size = 0;
 
-    DebugPrintf( NO_PREFIX, "\nSIMPLE POLICY TEST:\n" );
+    LOG_INFO("\nSIMPLE POLICY TEST:\n" );
 
     //
     // Create NV index.
@@ -2622,7 +2602,7 @@
     if( memcmp( (void *)&nvReadData.buffer[0],
             (void *)&nvWriteData.buffer[0], nvReadData.size ) )
     {
-        DebugPrintf( NO_PREFIX, "ERROR!! read data not equal to written data\n" );
+        LOG_ERROR("ERROR!! read data not equal to written data\n" );
         Cleanup();
     }
 
@@ -2677,7 +2657,7 @@
 
     nonceCaller.size = 0;
 
-    DebugPrintf( NO_PREFIX, "\nSIMPLE HMAC SESSION TEST:\n" );
+    LOG_INFO("\nSIMPLE HMAC SESSION TEST:\n" );
 
     //
     // Create NV index.
@@ -2851,7 +2831,7 @@
     if( memcmp( (void *)&nvReadData.buffer[0],
             (void *)&nvWriteData.buffer[0], nvReadData.size ) )
     {
-        DebugPrintf( NO_PREFIX, "ERROR!! read data not equal to written data\n" );
+        LOG_ERROR("ERROR!! read data not equal to written data\n" );
         Cleanup();
     }
 
@@ -2922,7 +2902,7 @@
     else
         testString = testStringPolicy;
 
-    DebugPrintf( NO_PREFIX, "\nSIMPLE %s SESSION TEST:\n", testString );
+    LOG_INFO("\nSIMPLE %s SESSION TEST:\n", testString );
 
     // Create sysContext structure.
     simpleTestContext = InitSysContext( 1000, resMgrTctiContext, &abiVersion );
@@ -3184,7 +3164,7 @@
     if( memcmp( (void *)&nvReadData.buffer[0],
             (void *)&nvWriteData.buffer[0], nvReadData.size ) )
     {
-        DebugPrintf( NO_PREFIX, "ERROR!! read data not equal to written data\n" );
+        LOG_ERROR("ERROR!! read data not equal to written data\n" );
         Cleanup();
     }
 
@@ -3246,7 +3226,7 @@
         .nonce={.size=0},
         .hmac={.size=0}}}};
 
-    DebugPrintf( NO_PREFIX, "\n\nDECRYPT/ENCRYPT SESSION TESTS:\n" );
+    LOG_INFO("\n\nDECRYPT/ENCRYPT SESSION TESTS:\n" );
 
     writeData.size = sizeof( writeDataString );
     memcpy( (void *)&writeData.buffer, (void *)&writeDataString,
@@ -3354,7 +3334,7 @@
             // param; decryptParamSize should be 0.
             if( decryptParamSize != 0 )
             {
-                DebugPrintf( NO_PREFIX, "ERROR!! decryptParamSize != 0\n" );
+                LOG_ERROR("ERROR!! decryptParamSize != 0\n" );
                 Cleanup();
             }
         }
@@ -3418,7 +3398,7 @@
         if( memcmp( (void *)&readData.buffer[0],
                 (void *)&writeData.buffer[0], readData.size ) )
         {
-            DebugPrintf( NO_PREFIX, "ERROR!! read data not equal to written data\n" );
+            LOG_ERROR("ERROR!! read data not equal to written data\n" );
             Cleanup();
         }
 
@@ -3484,14 +3464,14 @@
         rval = Tss2_Sys_NV_Read_Complete( sysContext, &readData );
         CheckPassed( rval );
 
-        DebugPrintf( NO_PREFIX, "Decrypted read data = " );
-        DEBUG_PRINT_BUFFER( NO_PREFIX, &readData.buffer[0], (UINT32 )readData.size );
+        LOG_INFO("Decrypted read data = " );
+        LOGBLOB_INFO("", &readData.buffer[0], (UINT32 )readData.size );
 
         // Check that write and read data are equal.
         if( memcmp( (void *)&readData.buffer[0],
                 (void *)&writeData.buffer[0], readData.size ) )
         {
-            DebugPrintf( NO_PREFIX, "ERROR!! read data not equal to written data\n" );
+            LOG_ERROR("ERROR!! read data not equal to written data\n" );
             Cleanup();
         }
 
@@ -3521,7 +3501,7 @@
     int i;
     TSS2_SYS_CONTEXT *decryptParamTestSysContext;
 
-    DebugPrintf( NO_PREFIX, "\nGET/SET DECRYPT PARAM TESTS:\n" );
+    LOG_INFO("\nGET/SET DECRYPT PARAM TESTS:\n" );
 
     // Create two sysContext structures.
     decryptParamTestSysContext = InitSysContext( TPM2_MAX_NV_BUFFER_SIZE, resMgrTctiContext, &abiVersion );
@@ -3583,7 +3563,7 @@
     {
         if( decryptParamBuffer[i] != nvWriteData.buffer[i] )
         {
-            DebugPrintf( NO_PREFIX, "ERROR!!  decryptParamBuffer[%d] s/b: %2.2x, was: %2.2x\n", i, nvWriteData.buffer[i], decryptParamBuffer[i] );
+            LOG_ERROR("ERROR!!  decryptParamBuffer[%d] s/b: %2.2x, was: %2.2x\n", i, nvWriteData.buffer[i], decryptParamBuffer[i] );
             Cleanup();
         }
     }
@@ -3591,10 +3571,7 @@
     rval = Tss2_Sys_GetCpBuffer( decryptParamTestSysContext, &cpBufferUsedSize1, &cpBuffer1 );
     CheckPassed( rval );
 
-#ifdef DEBUG
-    DebugPrintf( NO_PREFIX, "cpBuffer = ");
-#endif
-    DEBUG_PRINT_BUFFER( NO_PREFIX, (UINT8 *)cpBuffer1, cpBufferUsedSize1 );
+    LOGBLOB_DEBUG("cpBuffer = ", (UINT8 *)cpBuffer1, cpBufferUsedSize1 );
 
     // Test for no decrypt param.
     rval = Tss2_Sys_NV_Read_Prepare( decryptParamTestSysContext, TPM20_INDEX_PASSWORD_TEST, TPM20_INDEX_PASSWORD_TEST, sizeof( nvWriteData ) - 2, 0 );
@@ -3617,7 +3594,7 @@
     // Check that size == 0.
     if( decryptParamSize != 0 )
     {
-        DebugPrintf( NO_PREFIX, "ERROR!!  decryptParamSize s/b: 0, was: %u\n", (unsigned int)decryptParamSize );
+        LOG_ERROR("ERROR!!  decryptParamSize s/b: 0, was: %u\n", (unsigned int)decryptParamSize );
         Cleanup();
     }
 
@@ -3649,21 +3626,18 @@
     rval = Tss2_Sys_GetCpBuffer( decryptParamTestSysContext, &cpBufferUsedSize2, &cpBuffer2 );
     CheckPassed( rval );
 
-#ifdef DEBUG
-    DebugPrintf( NO_PREFIX, "cpBuffer = ");
-#endif
-    DEBUG_PRINT_BUFFER( NO_PREFIX, (UINT8 *)cpBuffer2, cpBufferUsedSize2 );
+    LOGBLOB_INFO("cpBuffer = ", (UINT8 *)cpBuffer2, cpBufferUsedSize2 );
 
     if( cpBufferUsedSize1 != cpBufferUsedSize2 )
     {
-        DebugPrintf( NO_PREFIX, "ERROR!!  cpBufferUsedSize1(%x) != cpBufferUsedSize2(%x)\n", (UINT32)cpBufferUsedSize1, (UINT32)cpBufferUsedSize2 );
+        LOG_ERROR("ERROR!!  cpBufferUsedSize1(%x) != cpBufferUsedSize2(%x)\n", (UINT32)cpBufferUsedSize1, (UINT32)cpBufferUsedSize2 );
         Cleanup();
     }
     for( i = 0; i < (int)cpBufferUsedSize1; i++ )
     {
         if( cpBuffer1[i] != cpBuffer2[i] )
         {
-            DebugPrintf( NO_PREFIX, "ERROR!! cpBufferUsedSize1[%d] s/b: %2.2x, was: %2.2x\n", i, cpBuffer1[i], cpBuffer2[i] );
+            LOG_ERROR("ERROR!! cpBufferUsedSize1[%d] s/b: %2.2x, was: %2.2x\n", i, cpBuffer1[i], cpBuffer2[i] );
             Cleanup();
         }
     }
@@ -3682,7 +3656,7 @@
 
 void SysFinalizeTests()
 {
-    DebugPrintf( NO_PREFIX, "\nSYS FINALIZE TESTS:\n" );
+    LOG_INFO("\nSYS FINALIZE TESTS:\n" );
 
     Tss2_Sys_Finalize( 0 );
 
@@ -3694,7 +3668,7 @@
     TSS2_RC rval = TSS2_RC_SUCCESS;
     TSS2_SYS_CONTEXT *testSysContext;
 
-    DebugPrintf( NO_PREFIX, "\nSYS GETCONTEXTSIZE TESTS:\n" );
+    LOG_INFO("\nSYS GETCONTEXTSIZE TESTS:\n" );
 
     testSysContext = InitSysContext( 9, resMgrTctiContext, &abiVersion );
     if( testSysContext == 0 )
@@ -3719,7 +3693,7 @@
     TSS2_SYS_CONTEXT *testSysContext;
     TSS2_TCTI_CONTEXT *tctiContext;
 
-    DebugPrintf( NO_PREFIX, "\nSYS GETTCTICONTEXT TESTS:\n" );
+    LOG_INFO("\nSYS GETTCTICONTEXT TESTS:\n" );
 
     testSysContext = InitSysContext( 9, resMgrTctiContext, &abiVersion );
     if( testSysContext == 0 )
@@ -3755,7 +3729,7 @@
     TPM2B_MAX_NV_BUFFER nvReadData;
     const uint8_t 		*cpBuffer;
 
-    DebugPrintf( NO_PREFIX, "\nGET/SET ENCRYPT PARAM TESTS:\n" );
+    LOG_INFO("\nGET/SET ENCRYPT PARAM TESTS:\n" );
 
     // Do Prepare.
     rval = Tss2_Sys_NV_Write_Prepare( sysContext, TPM20_INDEX_PASSWORD_TEST,
@@ -3867,7 +3841,7 @@
     {
         if( encryptParamBuffer[i] != encryptParamBuffer1[i] )
         {
-            DebugPrintf( NO_PREFIX, "ERROR!! encryptParamBuffer[%d] s/b: %2.2x, was: %2.2x\n", i, encryptParamBuffer[i], encryptParamBuffer1[i] );
+            LOG_ERROR("ERROR!! encryptParamBuffer[%d] s/b: %2.2x, was: %2.2x\n", i, encryptParamBuffer[i], encryptParamBuffer1[i] );
             Cleanup();
         }
     }
@@ -3899,7 +3873,7 @@
     TPM2B_ECC_POINT Q;
     UINT16 counter;
 
-    DebugPrintf( NO_PREFIX, "\nEC Ephemeral TESTS:\n" );
+    LOG_INFO("\nEC Ephemeral TESTS:\n" );
 
     // Test SAPI for case of Q size field not being set to 0.
     INIT_SIMPLE_TPM2B_SIZE( Q );
diff --git a/test/unit/tcti-device.c b/test/unit/tcti-device.c
index f956a53..2a13d44 100644
--- a/test/unit/tcti-device.c
+++ b/test/unit/tcti-device.c
@@ -7,7 +7,6 @@
 
 #include "sapi/tss2_mu.h"
 #include "tcti/tcti_device.h"
-#include "tcti/logging.h"
 #include "tcti/tcti.h"
 
 /**
@@ -51,78 +50,6 @@
     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);
-    /* the 'called' variable should be changed from false to true after this */
-    TCTI_LOG (ctx, NO_PREFIX, "test log call");
-    assert_true (called);
-    free (ctx);
-}
-/* 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)
@@ -150,8 +77,6 @@
     TSS2_TCTI_CONTEXT *ctx = NULL;
     TCTI_DEVICE_CONF conf = {
         .device_path = "/dev/null",
-        .logCallback = NULL,
-        .logData     = NULL
     };
 
     ret = InitDeviceTcti (NULL, &tcti_size, NULL);
@@ -241,8 +166,6 @@
     const struct CMUnitTest tests[] = {
         cmocka_unit_test (tcti_device_init_all_null_test),
         cmocka_unit_test(tcti_device_init_size_test),
-        cmocka_unit_test (tcti_device_init_log_test),
-        cmocka_unit_test (tcti_device_log_called_test),
         cmocka_unit_test (tcti_device_init_null_config_test),
         cmocka_unit_test_setup_teardown (tcti_device_receive_success,
                                   tcti_device_setup_with_command,
diff --git a/test/unit/tcti-socket.c b/test/unit/tcti-socket.c
index b0e458f..2175d98 100644
--- a/test/unit/tcti-socket.c
+++ b/test/unit/tcti-socket.c
@@ -34,7 +34,6 @@
 
 #include "sapi/tpm20.h"
 #include "tcti/tcti.h"
-#include "tcti/logging.h"
 #include "tcti/tcti_socket.h"
 
 /* When passed all NULL values ensure that we get back the expected RC. */
@@ -168,134 +167,6 @@
     assert_int_equal (ret, TSS2_RC_SUCCESS);
     return ctx;
 }
-/* begin tcti_socket_init_log */
-/*
- * This test configures the socket 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_socket_init_log_callback (void        *data,
-                               printf_type  type,
-                               const char  *format,
-                               ...)
-{
-    return 0;
-}
-
-static void
-tcti_socket_init_log_test (void **state)
-{
-    uint8_t my_data = 0x9;
-    TSS2_TCTI_CONTEXT *ctx = NULL;
-    TCTI_SOCKET_CONF conf = {
-        "localhost", 666, tcti_socket_init_log_callback, NULL, &my_data
-    };
-
-    ctx = tcti_socket_init_from_conf (&conf);
-    assert_true (TCTI_LOG_CALLBACK (ctx) == tcti_socket_init_log_callback);
-    assert_int_equal (*(uint8_t*)TCTI_LOG_DATA (ctx), my_data);
-    if (ctx)
-        free (ctx);
-}
-/* end tcti_socket_init_log */
-
-/* begin tcti_socket_init_buff_log */
-/*
- * This test configures the socket TCTI with the buffer 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_socket_init_log_buffer_callback (void        *data,
-                                      printf_type  type,
-                                      uint8_t     *buffer,
-                                      uint32_t     length)
-{
-    return 0;
-}
-
-static void
-tcti_socket_init_log_buffer_test (void **state)
-{
-    uint8_t my_data = 0x9;
-    TSS2_TCTI_CONTEXT *ctx = NULL;
-    TCTI_SOCKET_CONF conf = {
-        "localhost", 666, NULL, tcti_socket_init_log_buffer_callback, &my_data
-    };
-
-    ctx = tcti_socket_init_from_conf (&conf);
-    assert_true (TCTI_LOG_BUFFER_CALLBACK (ctx) == tcti_socket_init_log_buffer_callback);
-    assert_int_equal (*(uint8_t*)TCTI_LOG_DATA (ctx), my_data);
-    if (ctx)
-        free (ctx);
-}
-/* end tcti_socket_init_log */
-
-/* begin tcti_socket_log_called_test */
-/*
- * This test configures the socket TCTI with a logging callback and some user
- * data. It then invokes the logging function and checks to be sure that the
- * supplied user data is changed in the expected way.
- */
-int
-tcti_socket_log_called_callback (void        *data,
-                                 printf_type  type,
-                                 const char  *format,
-                                 ...)
-{
-    *(bool*)data = true;
-    return 0;
-}
-
-static void
-tcti_socket_log_called_test (void **state)
-{
-    bool called = false;
-    TSS2_TCTI_CONTEXT *ctx = NULL;
-    TCTI_SOCKET_CONF conf = {
-        "localhost", 666, tcti_socket_log_called_callback, NULL, &called
-    };
-
-    ctx = tcti_socket_init_from_conf (&conf);
-    TCTI_LOG (ctx, NO_PREFIX, "test log call");
-    if (ctx)
-        free (ctx);
-    assert_true (called);
-}
-/* end tcti_socket_init_log */
-/* begin tcti_socket_log_buffer_called_test */
-/*
- * This test configures the socket TCTI with the buffer logging callback and
- * some user data. It checks to be sure that when invoked, the buffer logging
- * callback sets the user data to a known value.
- */
-int
-tcti_socket_log_buffer_called_callback (void        *data,
-                                        printf_type  type,
-                                        uint8_t     *buffer,
-                                        uint32_t     length)
-{
-    *(bool*)data = true;
-    return 0;
-}
-
-static void
-tcti_socket_log_buffer_called_test (void **state)
-{
-    bool called = false;
-    TSS2_TCTI_CONTEXT *ctx = NULL;
-    TCTI_SOCKET_CONF conf = {
-        "localhost", 666, NULL, tcti_socket_log_buffer_called_callback, &called
-    };
-
-    ctx = tcti_socket_init_from_conf (&conf);
-    TCTI_LOG_BUFFER (ctx, NO_PREFIX, NULL, 0);
-    if (ctx)
-        free (ctx);
-    assert_true (called);
-}
-/* end tcti_socket_init_log */
 
 /*
  * This is a utility function to setup the "default" TCTI context.
@@ -307,9 +178,6 @@
     TCTI_SOCKET_CONF conf = {
         .hostname          = "localhost",
         .port              = 666,
-        .logCallback       = NULL,
-        .logBufferCallback = NULL,
-        .logData           = NULL
     };
 
     ctx = tcti_socket_init_from_conf (&conf);
@@ -407,10 +275,6 @@
         cmocka_unit_test (tcti_socket_init_all_null_test),
         cmocka_unit_test (tcti_socket_init_size_test),
         cmocka_unit_test (tcti_socket_init_null_config_test),
-        cmocka_unit_test (tcti_socket_init_log_test),
-        cmocka_unit_test (tcti_socket_init_log_buffer_test),
-        cmocka_unit_test (tcti_socket_log_called_test),
-        cmocka_unit_test (tcti_socket_log_buffer_called_test),
         cmocka_unit_test_setup_teardown (tcti_socket_receive_success_test,
                                   tcti_socket_setup,
                                   tcti_socket_teardown),