-
Notifications
You must be signed in to change notification settings - Fork 14
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
Fix and improve SetFIPS #219
Conversation
@@ -103,6 +103,7 @@ var ( | |||
providerNameFips = C.CString("fips") | |||
providerNameDefault = C.CString("default") | |||
propFIPS = C.CString("fips=yes") | |||
propNoFIPS = C.CString("-fips") |
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.
I'm not able to find any docs on -fips
, and the lack of symmetry vs. fips=yes
is a bit strange. Where does this come from?
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.
Not sure why it didn't show up in my initial searches, but found the meaning here: https://docs.openssl.org/3.0/man7/property/
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.
Arguably the name could be propIgnoreGlobalFIPS
to match the docs, but I don't know if that's meaningfully different.
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.
LGTM
#206 introduced a regression where
openssl.SetFIPS(false)
would always fail if there wasn't any FIPS-capable provider.This PR fix that issue, adds some tests for
SetFIPS
, which was previously untested.A benefit of the new implementation is that
OSSL_PROVIDER_try_load
is only called if the already loaded providers can't support the desired FIPS mode. It was previously unconditionally called, which was potentially unnecessary and could have undesired side-effects. For example, if the SymCrypt provider was already loaded and the built-in FIPS provider was not loaded but was installed in the system, then it would be loaded when callingSetFIPS(true)
, ending with two conflicting FIPS providers available.