-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
crypto: only try to set FIPS mode if different #12210
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)', | ||
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. I personally would use a single line for this argument as all other arguments are also on a single line but that is just taste and does not have to be addressed. 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. I copied this from a test further up. There are a few things I'd change about this test file, but I thought I'd try to keep this diff clean. |
||
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_crypto
is on? Turning it on should likely just non-opThere 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_crypto
is 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