Crypto: Hide forbidden algorithms when FIPS enabled #10312
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.
Fixes #9520
Problem
crypto:supports/0
is currently undocumented but i will add a doc string to it.Crypto returns some algorithms which are indirectly forbidden under FIPS (i.e. listed as available but not working).
The Expectation
Expected: All algorithms returned by
crypto:supports/0
will be available at least in one way.Bonus points for returning forbidden algorithm names separately so that the users will not complain that something "has disappeared" and will see the reason.
Solution
The call to
crypto:supports/0
under FIPS build with fips=enabled incrypto
app settings, will filter the algorithms by their availability in a much more strict way (by actually trying to initialize each algorithm and recording the failures as a sign of unavailability) and will return an additional section in the results containing disabled algorithms:Note this will only appear if FIPS is enabled. And this will only appear if SSL API is 3.0 or later.
The behaviour with FIPS disabled or older SSL will remain unchanged.