-
Notifications
You must be signed in to change notification settings - Fork 36
fips: define DH_MIN_SIZE for the FIPS PILOT build #425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
aidangarske
wants to merge
3
commits into
master
Choose a base branch
from
fips-pilot-dh-min-size
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
d54e893
fips: define DH_MIN_SIZE for the FIPS PILOT build (v5.2.1 base predat…
aidangarske adc7d2b
test: use FIPS-valid RSA public exponent (65537) in RSA keygen tests
aidangarske f63ec50
fips: scope DH_MIN_SIZE to the FIPS wolfSSL build, not the whole process
aidangarske File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1192,9 +1192,12 @@ int test_rsa_pkey_keygen(void *data) | |
| * we're using wolfCrypt FIPS. Can't do 2048 because that's the default. */ | ||
| const int newKeySize = 3072; | ||
| const int badKeyGenSizes[] = {512, 1024}; | ||
| /* FIPS 186 requires the RSA public exponent >= 65537; e=3 is rejected. */ | ||
| const long newKeyExp = 65537; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could be useful to check other values here to confirm the fix. Eg: And maybe check another good value too, eg Edit: maybe this belongs in wolfcrypt (as well?). AI tells me that there is no "too small" test there either. |
||
| #else | ||
| const int newKeySize = 1024; | ||
| const int badKeyGenSizes[] = {256}; | ||
| const long newKeyExp = 3; | ||
| #endif /* HAVE_FIPS || HAVE_FIPS_VERSION */ | ||
| const int numBad = sizeof(badKeyGenSizes) / sizeof(*badKeyGenSizes); | ||
| int i = 0; | ||
|
|
@@ -1217,7 +1220,7 @@ int test_rsa_pkey_keygen(void *data) | |
| err = (eCmd = BN_new()) == NULL; | ||
| } | ||
| if (err == 0) { | ||
| err = BN_set_word(eCmd, 3) != 1; | ||
| err = BN_set_word(eCmd, newKeyExp) != 1; | ||
| } | ||
| if (err == 0) { | ||
| PRINT_MSG("Change the public exponent w/ ctrl command"); | ||
|
|
@@ -1268,6 +1271,13 @@ int test_rsa_get_params(void *data) | |
| BIGNUM *eCmd = NULL; | ||
| BIGNUM *eRet = NULL; | ||
| const int newKeySize = 2048; | ||
| #if defined(HAVE_FIPS) || defined(HAVE_FIPS_VERSION) || \ | ||
| (defined(RSA_MIN_SIZE) && RSA_MIN_SIZE >= 2048) | ||
| /* FIPS 186 requires the RSA public exponent >= 65537; e=3 is rejected. */ | ||
| const long newKeyExp = 65537; | ||
| #else | ||
| const long newKeyExp = 3; | ||
| #endif | ||
| (void)data; | ||
|
|
||
| err = (ctx = EVP_PKEY_CTX_new_from_name(wpLibCtx, "RSA", NULL)) == NULL; | ||
|
|
@@ -1284,7 +1294,7 @@ int test_rsa_get_params(void *data) | |
| err = (eCmd = BN_new()) == NULL; | ||
| } | ||
| if (err == 0) { | ||
| err = BN_set_word(eCmd, 3) != 1; | ||
| err = BN_set_word(eCmd, newKeyExp) != 1; | ||
| } | ||
| if (err == 0) { | ||
| PRINT_MSG("Change the public exponent w/ ctrl command"); | ||
|
|
@@ -1314,7 +1324,7 @@ int test_rsa_get_params(void *data) | |
| /* Check return sizes, then verify e matches the one we set */ | ||
| if (err == 0) { | ||
| if ((params[0].return_size != (size_t)(newKeySize / 8)) || | ||
| (params[1].return_size != 1)) { | ||
| (params[1].return_size != (size_t)BN_num_bytes(eCmd))) { | ||
| err = 1; | ||
| } | ||
| } | ||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: this comment is quite long