8000 bpo-45150: Fix testing under FIPS mode (GH-32046) by tiran · Pull Request #32046 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-45150: Fix testing under FIPS mode (GH-32046) #32046

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

Merged
merged 2 commits into from
Mar 22, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
8000
Diff view
Next Next commit
bpo-45150: Fix testing under FIPS mode
  • Loading branch information
tiran committed Mar 22, 2022
commit 7bdbd1c67e5d113eab18d4aac1112321f467ca68
9 changes: 8 additions & 1 deletion Lib/test/test_hashlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,14 @@ def check(self, name, data, hexdigest, shake=False, **kwargs):

def check_file_digest(self, name, data, hexdigest):
hexdigest = hexdigest.lower()
digests = [name]
digests = []
try:
hashlib.new(name)
except ValueError:
# algorithm is blocked by security policy.
pass
else:
digests.append(name)
digests.extend(self.constructors_to_test[name])

with open(os_helper.TESTFN, "wb") as f:
Expand Down
0