Skip to content

Commit 9c56801

Browse files
committed
Fix coverity DEADCODE CID 900621
1 parent 438c63e commit 9c56801

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

examples/endorsement/get_ek_certs.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -369,13 +369,17 @@ int TPM2_EndorsementCert_Example(void* userCtx, int argc, char *argv[])
369369

370370
rc = wolfTPM2_NVReadAuth(&dev, &nv, nvIndex, certBuf, &certSz, 0);
371371
if (rc == 0) {
372-
if (nvPublic.dataSize <= 32 || isPolicyDigest) {
373-
printf(" Data (%u bytes):\n", certSz);
374-
dump_hex_bytes(certBuf, certSz);
375-
}
376-
else {
372+
printf(" Data (%u bytes):\n", certSz);
373+
#ifdef DEBUG_WOLFTPM
374+
/* In debug mode, show partial data for large buffers */
375+
if (certSz > 32 && !isPolicyDigest) {
377376
printf(" First 32 bytes:\n");
378-
dump_hex_bytes(certBuf, (certSz > 32) ? 32 : certSz);
377+
dump_hex_bytes(certBuf, 32);
378+
}
379+
else
380+
#endif
381+
{
382+
dump_hex_bytes(certBuf, certSz);
379383
}
380384
}
381385
}

0 commit comments

Comments
 (0)