Skip to content

Validate EC_PUB_X/EC_PUB_Y on import by routine them through the X9.63 point import - #467

Open
gasbytes wants to merge 1 commit into
wolfSSL:masterfrom
gasbytes:wp_ecc_set_params_pub-fix
Open

Validate EC_PUB_X/EC_PUB_Y on import by routine them through the X9.63 point import#467
gasbytes wants to merge 1 commit into
wolfSSL:masterfrom
gasbytes:wp_ecc_set_params_pub-fix

Conversation

@gasbytes

@gasbytes gasbytes commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Route EC_PUB_x/EC_PUB_Y through wc_ecc_import_x963_ex, the same validated import the encoded public key path uses, so the point is checked to be onn the curve,
both ordinates are required together, and the projective z ordinate is set.

Also, added some 3 regression tests for the off-curve and X-without-Y cases to test the edge cases of this behaviour.

Fixes F-4694.

@gasbytes gasbytes self-assigned this Aug 13, 2026
Copilot AI lite review requested due to automatic review settings August 13, 2026 12:41
@gasbytes
gasbytes marked this pull request as ready for review August 13, 2026 12:44

Copilot AI left a comment

Copy link
Copy Markdown

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 hardens ECC public key imports by validating raw EC_PUB_X/EC_PUB_Y coordinates via the same X9.63 point import path already used for encoded public keys, ensuring points are on-curve and that X/Y are provided together. It also adds regression tests to cover off-curve and incomplete-coordinate edge cases.

Changes:

  • Route EC_PUB_X/EC_PUB_Y imports through wc_ecc_import_x963_ex() by constructing an uncompressed X9.63 point, enforcing on-curve validation and proper point initialization.
  • Reject public key imports that provide only one ordinate (X without Y, or vice versa).
  • Add regression tests for off-curve XY import rejection, X-only rejection, and an ECDH derive check with an off-curve peer key.

Reviewed changes

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

File Description
test/test_ecc.c Adds regression tests for off-curve and incomplete-coordinate public key imports, plus an ECDH-path guard test.
src/wp_ecc_kmgmt.c Validates EC_PUB_X/EC_PUB_Y imports by converting to an X9.63 point and importing via wc_ecc_import_x963_ex().

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread test/test_ecc.c
@gasbytes
gasbytes force-pushed the wp_ecc_set_params_pub-fix branch from 41a341d to 6c5beb7 Compare August 13, 2026 13:23
@gasbytes gasbytes assigned padelsbach and unassigned gasbytes Aug 13, 2026
@gasbytes
gasbytes requested a review from padelsbach August 13, 2026 14:45
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