Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
6e688cb
F-7263 - Always start policy session in PCR policy example
aidangarske Jul 27, 2026
247853b
F-7272 - Honor caller response buffer capacity in FWTPM_ProcessCommand
aidangarske Jul 27, 2026
4803578
F-7277 - Return TPM_RC_TYPE for an unrecognized TestParms public type
aidangarske Jul 27, 2026
4f695f3
F-7276 - Validate classical public parameters in TestParms
aidangarske Jul 27, 2026
ab1ba32
F-7264 - Mask with RC_MAX_FMT1 when testing for TPM_RC_CURVE
aidangarske Jul 27, 2026
0e93f85
F-7266 - Mask with RC_MAX_FMT1 in bench unsupported-symmetric check
aidangarske Jul 27, 2026
e938dac
F-7269 - Skip ML-DSA verify when the sign section produced no signature
aidangarske Jul 27, 2026
51cad3b
F-7026 - Set error code when public key buffer allocation fails in quote
aidangarske Jul 27, 2026
916b937
F-7271 - Compare NV index type with equality instead of bitwise AND
aidangarske Jul 27, 2026
a860221
F-7273 - Reject secured-only vendor commands arriving in SPDM clear f…
aidangarske Jul 27, 2026
0b9debd
F-7280 - Zeroize WOLFTPM2_DEV before returning it to the heap
aidangarske Jul 27, 2026
6bae2bc
F-7279 - Scrub the shared command buffer during TPM2_Cleanup
aidangarske Jul 27, 2026
9707322
F-7265 - Remove dead short-response guard in SPDM swtpm IO callback
aidangarske Jul 27, 2026
e7345cb
F-7268 - Fail GET_PUBK when the responder public key exceeds the cont…
aidangarske Jul 27, 2026
c2fa5c0
F-7274 - Guard block round-up against wrap in hash update cache
aidangarske Jul 27, 2026
494e505
F-7267 - Bound the PSS padding block against the caller stack buffer
aidangarske Jul 27, 2026
e76f186
F-7285 - Scrub the PSS stack hash context after freeing it
aidangarske Jul 27, 2026
a317475
F-7283 - Scrub the NV index auth from the NVCreate compatibility wrapper
aidangarske Jul 27, 2026
da1cb8c
F-7284 - Scrub the hashed input copy in wolfTPM2_HashUpdate
aidangarske Jul 27, 2026
722ead4
F-7275 - Key GET_PUBK transcript insertion on the parsed vendor code
aidangarske Jul 27, 2026
e9e1e36
F-7281 - Scrub SPI transfer buffers in the advanced IO callback
aidangarske Jul 27, 2026
6aa0423
F-7282 - Clear the private blob when the outer wrap fails
aidangarske Jul 27, 2026
d029d7c
F-7261 - Use a constant-time compare for the bind entity Name test
aidangarske Jul 27, 2026
6d0cbae
F-7270 - Return a valid tag from AppendAuth on invalid arguments
aidangarske Jul 27, 2026
6cbf2d1
F-7260 - Document PKCS#1 v1.5 unpadding is for public signature data …
aidangarske Jul 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion examples/bench/bench.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ static int bench_sym_aes(WOLFTPM2_DEV* dev, WOLFTPM2_KEY* storageKey,
if (rc != 0) goto exit;
rc = wolfTPM2_CreateAndLoadKey(dev, &aesKey, &storageKey->handle,
&publicTemplate, (byte*)gUsageAuth, sizeof(gUsageAuth)-1);
if ((rc & TPM_RC_MODE) == TPM_RC_MODE || (rc & TPM_RC_VALUE) == TPM_RC_VALUE) {
if ((rc & RC_MAX_FMT1) == TPM_RC_MODE ||
(rc & RC_MAX_FMT1) == TPM_RC_VALUE) {
printf("Benchmark symmetric %s not supported!\n", desc);
rc = 0; goto exit;
}
Expand Down Expand Up @@ -234,6 +235,7 @@ static int bench_pqc_mldsa(WOLFTPM2_DEV* dev, double maxDuration,
XMEMSET(&mldsaKey, 0, sizeof(mldsaKey));
XMEMSET(&publicTemplate, 0, sizeof(publicTemplate));
XMEMSET(message, 0x11, sizeof(message));
XMEMSET(sig, 0, sizeof(sig));

rc = wolfTPM2_GetKeyTemplate_MLDSA(&publicTemplate,
TPMA_OBJECT_sign | TPMA_OBJECT_fixedTPM | TPMA_OBJECT_fixedParent |
Expand Down Expand Up @@ -275,6 +277,8 @@ static int bench_pqc_mldsa(WOLFTPM2_DEV* dev, double maxDuration,
} while (bench_stats_check(start, &count, maxDuration));
rc = bench_asym_done("ML-DSA", 65, "sign", count, start, rc);
if (rc != 0) goto exit;
if (count == 0)
goto exit; /* no signature produced; nothing to verify */

bench_stats_start(&count, &start);
do {
Expand Down
2 changes: 1 addition & 1 deletion examples/nvram/read.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ int TPM2_NVRAM_Read_Example(void* userCtx, int argc, char *argv[])

printf("NV Read: Attributes 0x%08x\n", nv.attributes);

if (((nv.attributes & TPMA_NV_TPM_NT) >> 4) & TPM_NT_EXTEND) {
if (((nv.attributes & TPMA_NV_TPM_NT) >> 4) == TPM_NT_EXTEND) {
byte digest[TPM_SHA256_DIGEST_SIZE];
word32 digestLen = (word32)sizeof(digest);
printf("NV Read Extend\n");
Expand Down
16 changes: 8 additions & 8 deletions examples/pcr/policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ int TPM2_PCR_Policy_Test(void* userCtx, int argc, char *argv[])
}
printf("wolfTPM2_Init: success\n");

if (paramEncAlg != TPM_ALG_NULL) {
/* Start an authenticated policy session (salted / unbound) */
rc = wolfTPM2_StartSession(&dev, &tpmSession, NULL, NULL,
TPM_SE_POLICY, paramEncAlg);
if (rc != 0) goto exit;
printf("TPM2_StartAuthSession: sessionHandle 0x%x\n",
(word32)tpmSession.handle.hndl);
/* Start an authenticated policy session (salted / unbound) */
rc = wolfTPM2_StartSession(&dev, &tpmSession, NULL, NULL,
TPM_SE_POLICY, paramEncAlg);
if (rc != 0) goto exit;
printf("TPM2_StartAuthSession: sessionHandle 0x%x\n",
(word32)tpmSession.handle.hndl);

/* set session for authorization of the storage key */
if (paramEncAlg != TPM_ALG_NULL) {
/* set session for parameter encryption */
rc = wolfTPM2_SetAuthSession(&dev, 0, &tpmSession,
(TPMA_SESSION_decrypt | TPMA_SESSION_encrypt | TPMA_SESSION_continueSession));
if (rc != 0) goto exit;
Expand Down
1 change: 1 addition & 0 deletions examples/pcr/quote.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ int TPM2_PCR_Quote_Test(void* userCtx, int argc, char *argv[])
pubKey = (byte*)XMALLOC(pubKeySz, NULL, DYNAMIC_TYPE_PUBLIC_KEY);
if (pubKey == NULL) {
printf("Failed to malloc buffer for public key\n");
rc = MEMORY_E;
goto exit;
}

Expand Down
17 changes: 17 additions & 0 deletions examples/run_examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,23 @@ if [ $WOLFCRYPT_ENABLE -eq 1 ]; then
fi
rm -f zip.quote

# PCR Policy tests
echo -e "PCR Policy tests"
./examples/pcr/policy 16 >> $TPMPWD/run.out 2>&1
RESULT=$?
[ $RESULT -ne 0 ] && echo -e "pcr policy failed! $RESULT" && exit 1
if [ $WOLFCRYPT_ENABLE -eq 1 ]; then
./examples/pcr/policy 16 -xor >> $TPMPWD/run.out 2>&1
RESULT=$?
[ $RESULT -ne 0 ] && echo -e "pcr policy param enc xor failed! $RESULT" && exit 1

if [ $WOLFCRYPT_DEFAULT -eq 0 ]; then
./examples/pcr/policy 16 -aes >> $TPMPWD/run.out 2>&1
RESULT=$?
[ $RESULT -ne 0 ] && echo -e "pcr policy param enc aes failed! $RESULT" && exit 1
fi
fi


# Benchmark tests
echo -e "Benchmark tests"
Expand Down
6 changes: 6 additions & 0 deletions hal/tpm_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,12 @@ int TPM2_IoCb(TPM2_CTX* ctx, INT32 isRead, UINT32 addr,
}
#endif

#if !defined(WOLFTPM_I2C) && !defined(WOLFTPM_MMIO) && !defined(WOLFTPM_FWTPM_HAL)
/* the FIFO register transfers plaintext command/response payload */
TPM2_ForceZero(txBuf, sizeof(txBuf));
TPM2_ForceZero(rxBuf, sizeof(rxBuf));
#endif

(void)ctx;

return ret;
Expand Down
Loading
Loading