Skip to content

Commit 33b6ede

Browse files
fix for tcp and base uart build
1 parent 0d63bf2 commit 33b6ede

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/tpm2_swtpm.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ static TPM_RC SwTpmTransmit(TPM2_CTX* ctx, const void* buffer, ssize_t bufSz)
160160
return rc;
161161
}
162162

163-
#ifdef WOLFTPM_SWTPM_UART
163+
#if !defined(WOLFTPM_SWTPM_UARTNS550)
164164
static int SwTpmReceive(TPM2_CTX* ctx, void* buffer, size_t rxSz)
165165
{
166166
int rc;
@@ -228,7 +228,9 @@ static int SwTpmReceive(TPM2_CTX* ctx, void* buffer, size_t rxSz)
228228

229229
return rc;
230230
}
231+
#endif
231232

233+
#ifdef WOLFTPM_SWTPM_UART
232234
static int SwTpmConnect(TPM2_CTX* ctx, const char* uartDev, uint32_t baud)
233235
{
234236
struct termios tty;
@@ -508,15 +510,12 @@ int TPM2_SWTPM_SendCommand(TPM2_CTX* ctx, TPM2_Packet* packet)
508510

509511
#if !defined(WOLFTPM_SWTPM_UARTNS550)
510512
if (ctx->tcpCtx.fd < 0) {
511-
rc = SwTpmConnect(ctx, TPM2_SWTPM_HOST, TPM2_SWTPM_PORT);
512-
}
513513
#else
514514
if (ctx->tcpCtx.setup == 0) {
515-
rc = SwTpmConnect(ctx, TPM2_SWTPM_HOST, TPM2_SWTPM_PORT);
516515
ctx->tcpCtx.setup = 1;
517-
}
518-
519516
#endif
517+
rc = SwTpmConnect(ctx, TPM2_SWTPM_HOST, TPM2_SWTPM_PORT);
518+
}
520519

521520
#ifdef WOLFTPM_DEBUG_VERBOSE
522521
DEBUG_PRINTF("Command size: %d\n\r", packet->pos);

0 commit comments

Comments
 (0)