-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
crypto: only try to set FIPS mode if different #12210
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -212,6 +212,15 @@ testHelper( | |
| 'require("crypto").fips = false', | ||
| process.env); | ||
|
|
||
| // --force-fips makes setFipsCrypto enable a no-op (FIPS stays on) | ||
| testHelper( | ||
| compiledWithFips() ? 'stdout' : 'stderr', | ||
| ['--force-fips'], | ||
| compiledWithFips() ? FIPS_ENABLED : OPTION_ERROR_STRING, | ||
| '(require("crypto").fips = true,' + | ||
| 'require("crypto").fips)', | ||
|
||
| process.env); | ||
|
|
||
| // --force-fips and --enable-fips order does not matter | ||
| testHelper( | ||
| 'stderr', | ||
|
|
||
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.
Given this change, should we also only throw if attempting to turn FIPS off when
force_fips_cryptois on? Turning it on should likely just non-opUh oh!
There was an error while loading. Please reload this page.
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.
@jasnell if
force_fips_cryptois on, thenFIPS_mode()should already be enabled right? So doesn't theif (enable == enabled)branch already cover that?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.
good point. ok