Skip to content

Remove redundant EC_Group input validation - #6183

Open
randombit wants to merge 1 commit into
masterfrom
jack/ec-group-check
Open

randombit wants to merge 1 commit into
masterfrom
jack/ec-group-check

Conversation

@randombit

Copy link
Copy Markdown
Owner

In many cases properties of the parameters were checked 2 or 3 times...

In many cases properties of the parameters were checked 2 or 3 times...

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.

🔵 Needs a closer look

Cryptographic assurance review is warranted because strong group verification now relies on construction-time Baillie–PSW checks for external groups instead of randomized Miller–Rabin/Lucas tests with a 128-bit error target.

No open issues 🎉

What changed in this PR

This PR reduces repeated elliptic-curve parameter validation by relying on checks performed when EC_Group instances are created.

Changes:

  • Removes duplicate generator checks from internal group construction and the generic curve backend.
  • Simplifies verify_group() while retaining legacy-specific checks, and documents the validation assumptions.
  • Adds a regression test confirming custom-group registration rejects an off-curve generator.
File Description
src/​tests/​test_ec_group.cpp Tests rejection of an off-curve generator during custom-group registration.
src/​lib/​pubkey/​ec_group/​ec_inner_data.h Documents the constructor’s reliance on trusted or previously validated parameters.
src/​lib/​pubkey/​ec_group/​ec_inner_data.cpp Removes redundant generator validation and makes the Barrett include legacy-only.
src/​lib/​pubkey/​ec_group/​ec_group.h Documents reduced validation and unused verify_group() arguments.
src/​lib/​pubkey/​ec_group/​ec_group.cpp Removes repeated domain checks from verify_group(), retaining legacy-specific checks.
src/​lib/​math/​pcurves/​pcurves_generic/​pcurves_generic.cpp Removes duplicate generator validation and documents reliance on EC_Group checks.

Review effort: Balanced

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.

2 participants