Skip to content

crypto: skip DH checks for recognized groups - #67071

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
panva:fix-dh-named-group-check
Nov 4, 2026
Merged

nodejs-github-bot merged 1 commit into
nodejs:mainfrom
panva:fix-dh-named-group-check

Conversation

@panva

@panva panva commented Oct 27, 2026

Copy link
Copy Markdown
Member

Explicit DH parameters are recognized as named groups during OpenSSL provider import, but DHPointer::check() only skips primality checks for groups constructed by name. This makes createDiffieHellman() block for seconds on standard MODP groups.

Query the imported key's group name to restore the legacy DH_check() shortcut without changing key generation. Add a deterministic regression test with randomness disabled and cover explicit and padded parameters through the JavaScript API.

Fixes: #67067

Explicit DH parameters are recognized as named groups during OpenSSL
provider import, but DHPointer::check() only skips primality checks for
groups constructed by name. This makes createDiffieHellman() block for
seconds on standard MODP groups.

Query the imported key's group name to restore the legacy DH_check()
shortcut without changing key generation. Add a deterministic regression
test with randomness disabled and cover explicit and padded parameters
through the JavaScript API.

Fixes: nodejs#67067
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Assisted-by: Codex
@panva panva added the lts-watch-v24.x PRs that may need to be released in v24.x label Oct 27, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/crypto
  • @nodejs/security-wg

@nodejs-github-bot nodejs-github-bot added dependencies PRs that add, update, or configure Node.js dependencies. needs-ci PRs that need a full CI run. labels Oct 27, 2026
@codecov

codecov Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.67%. Comparing base (75191c4) to head (d9f2aab).
⚠️ Report is 105 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67071      +/-   ##
==========================================
- Coverage   92.97%   90.67%   -2.30%     
==========================================
  Files         428      797     +369     
  Lines      195284   278320   +83036     
  Branches    30205    53528   +23323     
==========================================
+ Hits       181560   252370   +70810     
- Misses      13397    16328    +2931     
- Partials      327     9622    +9295     

see 500 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@panva panva added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Oct 27, 2026
@panva panva added the lts-watch-v26.x PRs that may need to be released in v26.x. label Oct 29, 2026
@panva
panva requested a review from jasnell October 30, 2026 13:49
@panva panva added review wanted PRs that need review. and removed request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Oct 31, 2026
@panva panva added author ready PRs with CI started, the required approvals, and no outstanding review comments. request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. and removed review wanted PRs that need review. labels Nov 3, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 3, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@panva panva added the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 4, 2026
@nodejs-github-bot
nodejs-github-bot merged commit 3b209b2 into nodejs:main Nov 4, 2026
96 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 3b209b2

@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 4, 2026
@panva
panva deleted the fix-dh-named-group-check branch November 4, 2026 09:30
@paulrutter

Copy link
Copy Markdown

@panva do you know in which Node 26 version this will land?

@panva

panva commented Nov 4, 2026

Copy link
Copy Markdown
Member Author

The fix will be included in future 24.x and 26.x releases, following the usual release policy (at least two weeks in a current or alpha release first). Inclusion in any immediate next release is not guaranteed, as potential security releases follow a separate process.

aduh95 pushed a commit that referenced this pull request Nov 11, 2026
Explicit DH parameters are recognized as named groups during OpenSSL
provider import, but DHPointer::check() only skips primality checks for
groups constructed by name. This makes createDiffieHellman() block for
seconds on standard MODP groups.

Query the imported key's group name to restore the legacy DH_check()
shortcut without changing key generation. Add a deterministic regression
test with randomness disabled and cover explicit and padded parameters
through the JavaScript API.

Fixes: #67067
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Assisted-by: Codex
PR-URL: #67071
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. dependencies PRs that add, update, or configure Node.js dependencies. lts-watch-v24.x PRs that may need to be released in v24.x lts-watch-v26.x PRs that may need to be released in v26.x. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

crypto: createDiffieHellman(prime, generator) blocks for seconds with standard MODP primes (regression since 24.20.0 and 26.6.0)

4 participants