From 3c5c5123f846c124a7bf53b004de08ce2ee2bd7b Mon Sep 17 00:00:00 2001 From: David Garske Date: Fri, 20 Dec 2024 13:15:01 -0800 Subject: [PATCH] Improve TPM NV write debug logging (show before). --- src/tpm2_wrap.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/tpm2_wrap.c b/src/tpm2_wrap.c index 4ac57e02..686c0914 100644 --- a/src/tpm2_wrap.c +++ b/src/tpm2_wrap.c @@ -4564,13 +4564,6 @@ static int wolfTPM2_NVWriteData(WOLFTPM2_DEV* dev, WOLFTPM2_SESSION* tpmSession, XMEMCPY(in.write.data.buffer, &dataBuf[pos], towrite); if (!extend) { in.write.offset = offset+pos; - rc = TPM2_NV_Write(&in.write); - } - else { - rc = TPM2_NV_Extend(&in.extend); - } - if (rc != TPM_RC_SUCCESS) { - break; } #ifdef DEBUG_WOLFTPM @@ -4580,6 +4573,16 @@ static int wolfTPM2_NVWriteData(WOLFTPM2_DEV* dev, WOLFTPM2_SESSION* tpmSession, in.write.offset, in.write.data.size, extend); #endif + if (!extend) { + rc = TPM2_NV_Write(&in.write); + } + else { + rc = TPM2_NV_Extend(&in.extend); + } + if (rc != TPM_RC_SUCCESS) { + break; + } + pos += towrite; dataSz -= towrite; }