Skip to content

F-4287: check public point is on curve - #461

Open
padelsbach wants to merge 2 commits into
wolfSSL:masterfrom
padelsbach:ecc-check-point
Open

padelsbach wants to merge 2 commits into
wolfSSL:masterfrom
padelsbach:ecc-check-point

Conversation

@padelsbach

Copy link
Copy Markdown
Contributor

wp_ecdh_set_peer now runs a full public key check (on-curve + correct order). wp_ecdh_derive_secret re-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

@padelsbach

padelsbach commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor Author

jenkins retest this please

@ColtonWilley ColtonWilley added the ci:all PR OSP toggle: run all label Sep 29, 2026
Copilot AI balanced review requested due to automatic review settings October 1, 2026 17:58

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.

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 Low severity

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 thread test/test_ecc.c
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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:all PR OSP toggle: run all

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants