Skip to content

Commit

Permalink
fix for tcp and base uart build
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobBarthelmeh committed Dec 12, 2023
1 parent 0d63bf2 commit 33b6ede
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/tpm2_swtpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ static TPM_RC SwTpmTransmit(TPM2_CTX* ctx, const void* buffer, ssize_t bufSz)
return rc;
}

#ifdef WOLFTPM_SWTPM_UART
#if !defined(WOLFTPM_SWTPM_UARTNS550)
static int SwTpmReceive(TPM2_CTX* ctx, void* buffer, size_t rxSz)
{
int rc;
Expand Down Expand Up @@ -228,7 +228,9 @@ static int SwTpmReceive(TPM2_CTX* ctx, void* buffer, size_t rxSz)

return rc;
}
#endif

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

#if !defined(WOLFTPM_SWTPM_UARTNS550)
if (ctx->tcpCtx.fd < 0) {
rc = SwTpmConnect(ctx, TPM2_SWTPM_HOST, TPM2_SWTPM_PORT);
}
#else
if (ctx->tcpCtx.setup == 0) {
rc = SwTpmConnect(ctx, TPM2_SWTPM_HOST, TPM2_SWTPM_PORT);
ctx->tcpCtx.setup = 1;
}

#endif
rc = SwTpmConnect(ctx, TPM2_SWTPM_HOST, TPM2_SWTPM_PORT);
}

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

0 comments on commit 33b6ede

Please sign in to comment.