Skip to content

add sanity check on keysize found with ECC point import#9989

Merged
dgarske merged 1 commit intowolfSSL:masterfrom
JacobBarthelmeh:ecc
Mar 17, 2026
Merged

add sanity check on keysize found with ECC point import#9989
dgarske merged 1 commit intowolfSSL:masterfrom
JacobBarthelmeh:ecc

Conversation

@JacobBarthelmeh
Copy link
Contributor

No description provided.

@JacobBarthelmeh JacobBarthelmeh self-assigned this Mar 16, 2026
Copilot AI review requested due to automatic review settings March 16, 2026 22:58
Copy link
Contributor

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 stricter validation when importing ECC points to reject malformed encodings (especially compressed points with missing coordinate bytes), and extends the ECC point test suite with new negative test cases.

Changes:

  • Add negative tests for malformed compressed points and invalid point-type prefixes.
  • Add a sanity check in wc_ecc_import_point_der_ex to ensure the derived coordinate length matches the curve’s expected size.

Reviewed changes

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

File Description
wolfcrypt/test/test.c Adds new negative tests to confirm malformed point encodings are rejected with the expected errors.
wolfcrypt/src/ecc.c Adds a keysize-vs-curve-size sanity check during point import to prevent undersized coordinate parsing.
Comments suppressed due to low confidence (1)

wolfcrypt/test/test.c:1

  • These negative import calls reuse point3 and then continue with subsequent imports. If the import routine partially mutates point3 before returning an error, this can make later assertions flaky or order-dependent. Consider reinitializing/clearing point3 (or using a fresh point instance) after each expected-failure import to keep the test isolated and deterministic.

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

You can also share your feedback on Copilot code review. Take the survey.

@JacobBarthelmeh JacobBarthelmeh removed their assignment Mar 17, 2026
@dgarske dgarske merged commit e023c17 into wolfSSL:master Mar 17, 2026
485 of 489 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For This Release Release version 5.9.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants