F-4287: check public point is on curve - #461
Open
padelsbach wants to merge 2 commits into
Open
padelsbach wants to merge 2 commits into
padelsbach wants to merge 2 commits into
Conversation
padelsbach
force-pushed
the
ecc-check-point
branch
from
August 7, 2026 01:04
3517ade to
520378c
Compare
Contributor
Author
|
jenkins retest this please |
padelsbach
force-pushed
the
ecc-check-point
branch
from
September 3, 2026 03:49
3a7620c to
849dbeb
Compare
padelsbach
force-pushed
the
ecc-check-point
branch
from
October 1, 2026 17:58
849dbeb to
681df51
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The regression test does not exercise the newly added peer-setup or derive-time rejection paths.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Strengthens ECDH public-key validation to reject invalid curve points and revalidate peers before secret derivation.
Changes:
- Adds full peer-key and derive-time point validation.
- Fixes quick EC public-key validation.
- Adds invalid-point regression coverage.
| File | Description |
|---|---|
src/wp_ecdh_exch.c |
Validates peers during setup and derivation. |
src/wp_ecc_kmgmt.c |
Adds corrected point and public-key checks. |
include/wolfprovider/alg_funcs.h |
Exposes internal validation helpers. |
test/test_ecc.c |
Adds invalid EC-point tests. |
test/unit.c |
Registers the new test. |
test/unit.h |
Declares the new test. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+1207
to
+1210
| if (err == 0) { | ||
| PRINT_MSG("Import of an off-curve point must fail"); | ||
| offCurve = test_ecdh_peer_from_xy(x, badY); | ||
| err = offCurve != NULL; |
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.

wp_ecdh_set_peernow runs a full public key check (on-curve + correct order).wp_ecdh_derive_secretre-checks the point before use.Relatedly, fixes the quick-validate path, which was dead code behind USE_ECC_B_PARAM and had an inverted wc_ecc_point_is_on_curve test plus a curve id passed where an index was expected.
Fixes F-4287