Refactor openssl.FIPS to support third-party FIPS providers #184
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.
Our current
openssl.FIPS
implementation only works with the built-in FIPS provider, as it checks whether it is available or not to determine if FIPS is enabled, which precludes using other FIPS providers.This PR removes the
OSSL_PROVIDER_available(nil, "fips")
check fromopenssl.FIPS
so it is not tied to the built-in provider.The new implementation should be as good as the previous: if
EVP_default_properties_is_fips_enabled
returns1
, we can be sure that only providers matching thefips=1
property will be used, so we can say that FIPS mode is enabled. To avoid breacking backwards compatibility, I've added an additional check that tried to fetch a SHA256 digets using the default properties (which should containfips=1
at that point). If it succeeds, then it means that there is a provider that matches thefips=1
query.