Skip to content

fwTPM/SPDM/src corrections and unit test additions#491

Merged
dgarske merged 16 commits intowolfSSL:masterfrom
aidangarske:fenrir-fixes-9
Apr 21, 2026
Merged

fwTPM/SPDM/src corrections and unit test additions#491
dgarske merged 16 commits intowolfSSL:masterfrom
aidangarske:fenrir-fixes-9

Conversation

@aidangarske
Copy link
Copy Markdown
Member

F-3245, F-3246, F-3247, F-3248, F-3249, F-3250, F-3251, F-3263, F-3264, F-3265, F-3266, F-3267, F-3268, F-3269, F-3270, F-3271

@aidangarske aidangarske self-assigned this Apr 21, 2026
Copilot AI review requested due to automatic review settings April 21, 2026 20:55
…ive HMAC check test for wolfSPDM_ParseKeyExchangeRsp
…ive HMAC check test for wolfSPDM_ParsePskExchangeRsp
…nside i2c_write outer loop to match i2c_read
…gestSize return with signed int before assigning to word32
… abandon path through exit label to run cleanup
…rseEccScheme in TPM2_ECC_Parameters to consume ECDAA count
…e abandon path through exit label to run cleanup
…to > in READ_BE16/READ_BE32 and data chunk length checks
…d auth compare constant-time over fixed bound
…stead of silently truncating oversize auth in NVCreateAuthPolicy, LoadKeyedHashKey,

  HmacStart, HashStart
… oversize authPolicy digest in wolfTPM2_NVCreateAuthPolicy
…l auth buffer in FwCmd_NV_DefineSpace before return
…ied list counts in TPM2_PCR_Extend, TPM2_SetCommandCodeAuditStatus, TPM2_PolicyOR
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR delivers a set of correctness and hardening fixes across the TPM2 wrapper, fwTPM command processing, and SPDM parsing, and adds/extends unit tests to cover previously untested edge cases (notably ECDAA parsing and HMAC-verify paths).

Changes:

  • Add unit tests covering ECDAA ECC_Parameters response parsing and additional TPM2B_SENSITIVE roundtrips; extend SPDM tests to validate ResponderVerifyData HMAC failure/success paths.
  • Harden multiple wrapper APIs by rejecting oversize auth/authPolicy inputs (returning BUFFER_E) instead of truncating, and reuse shared packet helpers for sensitive/scheme parsing.
  • fwTPM: refactor password-vs-authValue comparison into a constant-time helper and scrub temporary auth material; fix minor HAL/example robustness issues.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/unit_tests.c Adds ECC ECDAA response-parse regression test and expands sensitive roundtrip coverage.
src/tpm2_wrap.c Tightens input-size validation (auth/authPolicy/usageAuth) and avoids silent truncation.
src/tpm2.c Caps attacker-controlled counts, reuses TPM2_Packet_AppendSensitive, and fixes ECDAA scheme parsing via TPM2_Packet_ParseEccScheme.
src/spdm/unit_test.c Adds SPDM KE_RSP and PSK_EX_RSP tests that exercise verify-data HMAC compare paths (positive/negative).
src/fwtpm/fwtpm_command.c Introduces constant-time auth comparison helper and scrubs NV DefineSpace auth on exit.
hal/tpm_io_microchip.c Resets busy_retry each I2C transaction loop iteration to avoid stale retry counts.
hal/tpm_io_infineon.c Fixes missing semicolon on extern declaration.
examples/pkcs7/pkcs7.c Adjusts digest-size retrieval flow to use an intermediate rc and cast after validation.
examples/pcr/quote.c Splits numeric parsing from range validation for PCR index argument handling.
examples/firmware/st33_fw_update.c Uses goto exit to ensure consistent cleanup on early-return paths.
examples/firmware/ifx_fw_update.c Uses goto exit to ensure consistent cleanup on early-return paths.
examples/firmware/ifx_fw_extract.c Fixes off-by-one bounds checks in big-endian read macros and size validation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/unit_tests.c Outdated
Comment thread examples/pkcs7/pkcs7.c Outdated
…pendSensitive in TPM2_LoadExternal and extend roundtrip test coverage
@dgarske dgarske merged commit 423ce0d into wolfSSL:master Apr 21, 2026
127 of 128 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants