Skip to content

Add new WOLFTPM2_ECC_DEFAULT_CURVE#519

Open
dgarske wants to merge 1 commit into
wolfSSL:masterfrom
dgarske:zd21780
Open

Add new WOLFTPM2_ECC_DEFAULT_CURVE#519
dgarske wants to merge 1 commit into
wolfSSL:masterfrom
dgarske:zd21780

Conversation

@dgarske
Copy link
Copy Markdown
Member

@dgarske dgarske commented Jun 3, 2026

Fixes ZD 21780

@dgarske dgarske self-assigned this Jun 3, 2026
Copilot AI review requested due to automatic review settings June 3, 2026 23:24
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

Adds a configurable default ECC curve for wolfTPM wrapper key templates and centralizes curve→hash selection logic to keep name/scheme hashes consistent with the chosen curve (Fixes ZD 21780).

Changes:

  • Introduces TPM2_GetCurveHashAlg() to map TPM ECC curves to recommended digest algorithms based on curve size.
  • Adds WOLFTPM2_ECC_DEFAULT_CURVE build-time configuration and uses it to remap P-256 template requests to the configured default curve.
  • Replaces ad-hoc curve/hash selection in the crypto callback with the shared helper.

Reviewed changes

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

Show a summary per file
File Description
wolftpm/tpm2.h Declares new TPM2_GetCurveHashAlg() public API.
wolftpm/tpm2_types.h Adds WOLFTPM2_ECC_DEFAULT_CURVE configuration macro and fallback logic.
src/tpm2.c Implements TPM2_GetCurveHashAlg() based on curve byte size.
src/tpm2_wrap.c Remaps P-256 template requests to the configured default curve and derives matching hashes.
src/tpm2_cryptocb.c Uses TPM2_GetCurveHashAlg() for ECDSA template hash selection.

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

Comment thread wolftpm/tpm2_types.h
Comment thread src/tpm2.c
@dgarske dgarske assigned wolfSSL-Bot and unassigned dgarske Jun 5, 2026
@dgarske dgarske requested a review from aidangarske June 5, 2026 17:22
Copy link
Copy Markdown
Member

@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.

Skoll Multi-Scan Review

Modes: review + review-securityOverall recommendation: REQUEST_CHANGES
Findings: 3 total — 3 posted, 0 skipped
3 finding(s) posted as inline comments (see file-level comments below)

Posted findings

  • [High] [review+review-security] Default-curve remap overrides explicit P-256 curve requestssrc/tpm2_wrap.c:8237-8242
  • [High] [review+review-security] Default-curve remap leaves policy callers using the stale SHA-256 hashsrc/tpm2_wrap.c:8240-8242
  • [Medium] [review] No tests cover the new default-curve behavior or hash helpersrc/tpm2.c:7037-7048

Review generated by Skoll

Comment thread src/tpm2_wrap.c Outdated
Comment thread src/tpm2_wrap.c
Comment thread src/tpm2.c
Copy link
Copy Markdown

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #519

Scan targets checked: none
Failed targets: wolftpm-bugs, wolftpm-src

⚠️ Review incomplete — one or more scan targets failed before findings could be produced. See the Fenrir PR review detail page for logs.

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown
Member

@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.

Skoll Code Review

Scan type: reviewOverall recommendation: COMMENT
Findings: 5 total — 3 posted, 2 skipped
3 finding(s) posted as inline comments (see file-level comments below)

Posted findings

  • [Medium] New EK test assertions fail under NO_ECC256 buildstests/unit_tests.c:2582-2586
  • [Low] AIK template test does not verify the resolved nameAlg/sigHashtests/unit_tests.c:2578-2580
  • [Low] Crypto callback changes ECDSA hash for Brainpool curvessrc/tpm2_cryptocb.c:237-246

Skipped findings

  • [Low] New public API and build option not recorded in ChangeLog.md
  • [Info] Multi-line explanatory comments exceed one-line policy

Review generated by Skoll

Comment thread tests/unit_tests.c Outdated
Comment thread tests/unit_tests.c Outdated
Comment thread src/tpm2_cryptocb.c
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.

5 participants