Skip to content
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 library in FIPS mode #83

Merged
merged 3 commits into from
Dec 27, 2015
Merged

Fix library in FIPS mode #83

merged 3 commits into from
Dec 27, 2015

Conversation

tomato42
Copy link
Member

there are some additional limitations on behaviour of m2crypto and hashlib when system is working in FIPS mode - workaround those

disabling and enabling warnings is sometimes necessary
(e.g. when matching behaviour of 3rd party code),

verifying if local enabling or disabling of warnings is
not abused is reviewers job, as pylint can't check if
the disablement has a sensible comment before it
@tomato42 tomato42 force-pushed the fips-fixes branch 2 times, most recently from a0b7438 to 1ea560b Compare December 21, 2015 19:14
by using * import we are importing a lot of extraneous
garbage, use specific imports only
In FIPS mode use of MD5 is restricted while use of RC4 is
disallowed, so we need to make the library indicate to
hashlib that we will use MD5 "carefully" and in case of RC4,
we simply don't use m2crypto in FIPS mode
@tomato42 tomato42 added the review request PR finished, ready for review label Dec 22, 2015
@tomato42 tomato42 added this to the v0.6.0 milestone Dec 22, 2015
@tomato42
Copy link
Member Author

The QuantifiedCode failure is caused by the need to extend hashlib in a forward compatible way, we can ignore it.

@tomato42
Copy link
Member Author

@The-Mule: r?

@The-Mule
Copy link
Collaborator

Overall it looks good, I've just one minor remark, AFAIK hashlib uses openssl which can itself run in "FIPS mode" regardless of the rest of the system (as long as OPENSSL_FORCE_FIPS_MODE env. var. is non-empty). I am a little disappointed that hashlib does not have API for FIPS mode detection. Using just kernel fips flag might not be 100% reliable, it would be good to check /etc/system_fips albeit that is used just in RHEL and Fedora... The most reliable (and the ugliest) way would be just checking if md5 works in hashlib, if so, FIPS mode is disabled, otherwise enabled. Anyway, I am okay with the current solution for the time being (FIPS mode does not respecting kernel fips flag is really corner case).

r+

@tomato42
Copy link
Member Author

the FIPS detection is unrelated to hashlib, the tlshashlib is solving that exactly the way you suggest - to check if it works and then retry with FIPS compatible flag

while for RC4 M2Crypto uses essentially the same code: https://gitlab.com/m2crypto/m2crypto/blob/master/tests/fips.py

tomato42 added a commit that referenced this pull request Dec 27, 2015
@tomato42 tomato42 merged commit c36fbfc into master Dec 27, 2015
@tomato42 tomato42 deleted the fips-fixes branch December 27, 2015 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review request PR finished, ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants