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

hashlib.md5 doesn't work when FIPS is enabled #414

Closed
dantebben opened this issue Nov 30, 2021 · 3 comments · Fixed by #415
Closed

hashlib.md5 doesn't work when FIPS is enabled #414

dantebben opened this issue Nov 30, 2021 · 3 comments · Fixed by #415

Comments

@dantebben
Copy link

Python Version

3.9.9

pytest Version

6.2.5

Package Version

3.10.2

Description

On a system where FIPS is enabled, pytest-randomly fails on line 275

hasher = hashlib.md5()

with the following error

ValueError: [digital envelope routines: EVP_DigestInit_ex] disabled for FIPS

This appears to be common among tools that use hashlib. The following workaround seems to fix the problem, edit pytest_randomly/__init__.py line 275 to be:

hasher = hashlib.md5(usedforsecurity=False)

I found this idea for a fix here: s3tools/s3cmd#1005 (comment). This issue was related to another package using hashlib.md5

@johnthagen
Copy link

Note that usedforsecurity was introduced in 3.9: https://docs.python.org/3/library/hashlib.html#hash-algorithms

Some kind of conditional will be needed to support older versions of Python.

python-version:
- 3.6
- 3.7
- 3.8
- 3.9
- '3.10'

@adamchainz
Copy link
Member

Thanks for the report. This has been fixed in #415 and released in version 3.10.3. Enjoy.

@dantebben
Copy link
Author

awesome! thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants