Visitar URL original
bpo-44048: Fix two hashlib test cases under FIPS mode by stratakis · Pull Request #26470 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20221223165932/https://github.com/python/cpython/pull/26470
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

bpo-44048: Fix two hashlib test cases under FIPS mode #26470

Merged
merged 1 commit into from Jun 4, 2021

Conversation

stratakis
Copy link
Contributor

@stratakis stratakis commented May 31, 2021 •

test_disallow_instantiation and test_readonly_types try to test all the available
digests, however under FIPS mode, while the algorithms are available, trying to use
them will fail with a ValueError.

https://bugs.python.org/issue44048

test_disallow_instantiation and test_readonly_types try to test all the available
digests, however under FIPS mode, while the algorithms are available, trying to use
them will fail with a ValueError.
@stratakis stratakis requested a review from tiran as a code owner May 31, 2021
@bedevere-bot bedevere-bot added awaiting review tests Tests in the Lib/test dir labels May 31, 2021
@stratakis
Copy link
Contributor Author

stratakis commented May 31, 2021

news entry is not required as this is a tests only fix.

# In FIPS mode some algorithms are not available raising ValueError
try:
h = constructor()
except ValueError:
Copy link
Contributor

@erlend-aasland erlend-aasland May 31, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe check that the error message contains "unsupported hash type" as well? Ditto for the other test.

Copy link
Contributor Author

@stratakis stratakis May 31, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ValueError would be in this case: [digital envelope routines: EVP_DigestInit_ex] disabled for FIPS

However this is specific to OpenSSL in RHEL7 and RHEL8 under FIPS mode. I am not entirely sure what other linux distros would be showing with their downstream FIPS patches (although from the 3.0.0 version of OpenSSL, FIPS compatibility is native so it could be more standardized).

@pablogsal pablogsal merged commit a46c220 into python:main Jun 4, 2021
12 checks passed
@pablogsal
Copy link
Member

pablogsal commented Jun 4, 2021

@stratakis does this need backport?

@miss-islington
Copy link
Contributor

miss-islington commented Jun 4, 2021

Thanks @stratakis for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

@bedevere-bot
Copy link

bedevere-bot commented Jun 4, 2021

GH-26531 is a backport of this pull request to the 3.10 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 4, 2021
test_disallow_instantiation and test_readonly_types try to test all the available
digests, however under FIPS mode, while the algorithms are available, trying to use
them will fail with a ValueError.
(cherry picked from commit a46c220)

Co-authored-by: stratakis <cstratak@redhat.com>
pablogsal pushed a commit that referenced this pull request Jun 4, 2021
…26531)

test_disallow_instantiation and test_readonly_types try to test all the available
digests, however under FIPS mode, while the algorithms are available, trying to use
them will fail with a ValueError.
(cherry picked from commit a46c220)

Co-authored-by: stratakis <cstratak@redhat.com>

Co-authored-by: stratakis <cstratak@redhat.com>
@stratakis stratakis deleted the fips_tests branch Jun 8, 2021
@stratakis
Copy link
Contributor Author

stratakis commented Jun 8, 2021

Thanks for merging it Pablo. The issue was from 3.10 and onwards and it's now resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants