Skip to content

Commit ebedd63

Browse files
committed
Nations concerns, pr review fixes
- Upgraded NS350 firmware from 0.1.0.15 to 0.1.0.16 which adds TPM_CMD support under PSK mode (previously returned Vd_InvalidCode) - PSK mode: GET_CAPABILITIES and NEGOTIATE_ALGORITHMS are not mandatory, can go directly from GET_VERSION to PSK_EXCHANGE (noted for future optimization) - Identity key mode: END_SESSION is mandatory (noted for future addition to test sequence) - All 17/17 hardware tests pass on new firmware - Fixed SPDM cleartext fallback in TPM2_SendCommand(): positive error codes from SPDM now return immediately instead of falling through to cleartext retry - Fixed same SPDM cleartext fallback in TPM2_SendCommandAuth(): same pattern applied - Added VdCode validation in wolfTPM2_SPDM_SecuredExchange(): verifies response matches expected TPM2_CMD vendor code before accepting payload - Enabled auto-connect for Nations: changed guard from WOLFSPDM_NUVOTON to WOLFTPM_SPDM_TCG and replaced wolfTPM2_SpdmConnectNuvoton() with generic wolfTPM2_SpdmConnect() so auto-SPDM works for both vendors - Added VdCode validation in wolfSPDM_TCG_VendorCmdClear(): verifies response vendor code matches expected value after parsing
1 parent 36fad4d commit ebedd63

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/spdm/spdm_tcg.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ int wolfSPDM_TCG_VendorCmdClear(WOLFSPDM_CTX* ctx, const char* vdCode,
7373
if (rc < 0) {
7474
return rc;
7575
}
76+
/* Verify response vendor code matches expected */
77+
if (XMEMCMP(rsp->vdCode, vdCode, WOLFSPDM_VDCODE_LEN) != 0) {
78+
return WOLFSPDM_E_PEER_ERROR;
79+
}
7680
}
7781

7882
return WOLFSPDM_SUCCESS;

src/tpm2_wrap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ int wolfTPM2_Init(WOLFTPM2_DEV* dev, TPM2HalIoCb ioCb, void* userCtx)
276276
XMEMSET(dev->session, 0, sizeof(dev->session));
277277
wolfTPM2_SetAuthPassword(dev, 0, NULL);
278278

279-
#if defined(WOLFTPM_SPDM) && defined(WOLFSPDM_NUVOTON)
279+
#if defined(WOLFTPM_SPDM) && defined(WOLFTPM_SPDM_TCG)
280280
/* If TPM is in SPDM-only mode, transparently establish an SPDM session
281281
* so all subsequent TPM commands are encrypted over the bus.
282282
* This allows existing binaries (caps, wrap_test, unit.test) to work
@@ -292,7 +292,7 @@ int wolfTPM2_Init(WOLFTPM2_DEV* dev, TPM2HalIoCb ioCb, void* userCtx)
292292
return rc;
293293
}
294294

295-
rc = wolfTPM2_SpdmConnectNuvoton(dev, NULL, 0, NULL, 0);
295+
rc = wolfTPM2_SpdmConnect(dev);
296296
if (rc != 0) {
297297
#ifdef DEBUG_WOLFTPM
298298
printf("SPDM auto-connect failed: %d\n", rc);

0 commit comments

Comments
 (0)