Skip to content

Fix H-35, M-74, M-75 for wolfTPM#465

Open
aidangarske wants to merge 1 commit intowolfSSL:masterfrom
aidangarske:fix-coverity-2-27
Open

Fix H-35, M-74, M-75 for wolfTPM#465
aidangarske wants to merge 1 commit intowolfSSL:masterfrom
aidangarske:fix-coverity-2-27

Conversation

@aidangarske
Copy link
Member

@aidangarske aidangarske commented Feb 27, 2026

Description

Fix:
H-35, M-74, M-75

  • Pass CI
  • Copilot review
  • updated spreadsheet with findings

@aidangarske aidangarske self-assigned this Feb 27, 2026
Copilot AI review requested due to automatic review settings February 27, 2026 17:36
Copy link

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

Fixes wolfTPM issues around ECC signature formatting, IV copying during encrypt/decrypt, and RSA public exponent decoding.

Changes:

  • Correct ECC ECDSA signature assembly to left-pad R/S to the curve size.
  • Fix IV copy sizing to avoid copying more than the output IV buffer provides.
  • Decode ASN.1 RSA exponent from big-endian bytes into native UINT32.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/tpm2_wrap.c Fixes ECC signature padding and corrects IV size clamping during IV update.
src/tpm2_asn.c Fixes RSA exponent parsing by converting ASN.1 big-endian bytes to native UINT32.

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

Copy link
Member Author

@aidangarske aidangarske left a comment

Choose a reason for hiding this comment

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

The validation requested already exists in the code above this change:

  • Lines 337-340: Strip leading 0x00 sign byte if present (if (input[idx] == 0x00) { idx++; exp_len--; })
  • Lines 341-343: Reject if exp_len > sizeof(UINT32) (i.e., > 4 bytes)

The conversion loop at lines 349-351 only executes when rc == 0, which means both validations have passed. This ensures exp_len <= 4 and prevents overflow/truncation.

@dgarske dgarske assigned aidangarske and unassigned dgarske Feb 27, 2026
@aidangarske aidangarske requested a review from dgarske February 27, 2026 21:24
@aidangarske aidangarske assigned dgarske and unassigned aidangarske Feb 27, 2026
dgarske
dgarske previously approved these changes Feb 27, 2026
Copilot AI review requested due to automatic review settings February 27, 2026 21:39
@aidangarske aidangarske requested review from Copilot and dgarske and removed request for Copilot February 27, 2026 21:39
@aidangarske aidangarske requested review from Copilot and removed request for Copilot February 27, 2026 23:03
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.

4 participants