Skip to content

wolfTPM2: harden PCR/hash wrapper validation#554

Open
tmael wants to merge 1 commit into
wolfSSL:masterfrom
tmael:pcr-hash-validation
Open

wolfTPM2: harden PCR/hash wrapper validation#554
tmael wants to merge 1 commit into
wolfSSL:masterfrom
tmael:pcr-hash-validation

Conversation

@tmael

@tmael tmael commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Defensive-validation improvements in the PCR/hash wrappers:

  • wolfTPM2_ReadPCR returns TPM_RC_FAILURE on an empty response instead of
    reading digests[0] uninitialized.
  • wolfTPM2_HashStart rejects any non-hash algorithm locally via
    TPM2_GetHashDigestSize(), not only TPM_ALG_NULL.
  • wolfTPM2_ExtendPCR / wolfTPM2_ResetPCR bound pcrIndex, matching ReadPCR.

No API change; builds clean.

- ReadPCR: reject an empty response (count == 0) before dereferencing
  digests[0]
- HashStart: reject any non-hash algorithm (digest size 0), not just
  TPM_ALG_NULL
- ExtendPCR / ResetPCR: bound pcrIndex to [PCR_FIRST, PCR_LAST], matching
  ReadPCR
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.

2 participants