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
Open
Validate EC_PUB_X/EC_PUB_Y on import by routine them through the X9.63 point import#467gasbytes wants to merge 1 commit into
gasbytes wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
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_Yimports throughwc_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.
gasbytes
force-pushed
the
wp_ecc_set_params_pub-fix
branch
from
August 13, 2026 13:23
41a341d to
6c5beb7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.