Skip to content

Commit 5178d79

Browse files
committed
Fix Copilot x Fenrir review
1 parent ddf990a commit 5178d79

2 files changed

Lines changed: 3 additions & 20 deletions

File tree

src/spdm/spdm_context.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,10 +414,11 @@ int wolfSPDM_SendReceive(WOLFSPDM_CTX* ctx,
414414
tcgTx, sizeof(tcgTx));
415415
} else {
416416
/* Secured record - prepend TCG secured header (0x8201) */
417-
word32 totalSz = WOLFSPDM_TCG_HEADER_SIZE + txSz;
418-
if (totalSz > sizeof(tcgTx)) {
417+
word32 totalSz;
418+
if (txSz > sizeof(tcgTx) - WOLFSPDM_TCG_HEADER_SIZE) {
419419
return WOLFSPDM_E_BUFFER_SMALL;
420420
}
421+
totalSz = WOLFSPDM_TCG_HEADER_SIZE + txSz;
421422
wolfSPDM_WriteTcgHeader(tcgTx, WOLFSPDM_TCG_TAG_SECURED,
422423
totalSz, ctx->connectionHandle, ctx->fipsIndicator);
423424
XMEMCPY(tcgTx + WOLFSPDM_TCG_HEADER_SIZE, txBuf, txSz);

src/spdm/spdm_tcg.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -495,24 +495,6 @@ int wolfSPDM_ConnectTCG(WOLFSPDM_CTX* ctx)
495495
}
496496
#endif
497497

498-
/* SPDM 1.3+: Replace VCA with Hash(VCA) in transcript.
499-
* DSP0274 1.3 section 10.17.1: th = Hash(Hash(A) || Ct || K)
500-
* TODO: verify with both Nuvoton and Nations hardware */
501-
if (0 && ctx->spdmVersion >= SPDM_VERSION_13 && ctx->transcriptLen > 12) {
502-
byte vcaHash[WOLFSPDM_HASH_SIZE];
503-
rc = wolfSPDM_TranscriptHash(ctx, vcaHash);
504-
if (rc == WOLFSPDM_SUCCESS) {
505-
wolfSPDM_TranscriptReset(ctx);
506-
rc = wolfSPDM_TranscriptAdd(ctx, vcaHash, WOLFSPDM_HASH_SIZE);
507-
wolfSPDM_DebugPrint(ctx, "TCG: VCA hashed (%u -> %u bytes)\n",
508-
ctx->transcriptLen, WOLFSPDM_HASH_SIZE);
509-
}
510-
if (rc != WOLFSPDM_SUCCESS) {
511-
ctx->state = WOLFSPDM_STATE_ERROR;
512-
return rc;
513-
}
514-
}
515-
516498
/* Step 4: GET_PUBK */
517499
wolfSPDM_DebugPrint(ctx, "TCG Step 4: GET_PUBK\n");
518500
pubKeySz = sizeof(pubKey);

0 commit comments

Comments
 (0)