FIPS: Default to 2048 bit min DH crypto#10820
Open
lealem47 wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a configurable minimum Diffie-Hellman prime size (defaulting to 2048 bits) and enforces it across the wolfCrypt DH implementation, while updating TLS-layer defaults and adjusting tests to accommodate the stronger default.
Changes:
- Add
DH_MIN_SIZE(default 2048) as the minimum allowed DH prime size, with legacy override support. - Default TLS-layer
WOLFSSL_MIN_DHKEY_BITStoDH_MIN_SIZEand add a build-time consistency check. - Enforce
DH_MIN_SIZEat runtime in DH key generation/agreement, and update tests to use 2048-bit DH params.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| wolfssl/wolfcrypt/settings.h | Introduces DH_MIN_SIZE default and legacy mapping; base for new minimum DH policy. |
| wolfssl/internal.h | Updates TLS minimum DH size defaulting and adds a consistency #error check. |
| wolfcrypt/src/dh.c | Adds runtime enforcement of minimum DH prime size in DH operations. |
| tests/api/test_dh.c | Adjusts subgroup-check test compilation based on DH_MIN_SIZE. |
| tests/api.c | Updates DH-related API tests to load/use 2048-bit DH parameters from PEM. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
86
to
88
| #if !defined(NO_DH) && !defined(WOLFSSL_SP_MATH) && !defined(HAVE_SELFTEST) && \ | ||
| (!defined(HAVE_FIPS) || FIPS_VERSION3_GT(7,0,0)) | ||
| (!defined(HAVE_FIPS) || FIPS_VERSION3_GT(7,0,0)) && DH_MIN_SIZE <= 512 | ||
| DhKey key; |
|
Contributor
Author
|
Jenkins Retest this please. |
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.
Description
Adding
DH_MIN_SIZEmacro to control DH bit security in the wolfssl build. Overridable via macro for legacy callers, and updating tests to accommodate.Testing
./configure --enable-all && make check
Checklist