bpo-47101: list only activated algorithms in hashlib.algorithms_available (GH-32076)

This commit is contained in:
Christian Heimes 2022-03-23 22:30:05 +02:00 committed by GitHub
parent c62b944dfc
commit 48e2010d92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 1 deletions

View file

@ -223,6 +223,10 @@ class HashLibTestCase(unittest.TestCase):
def test_algorithms_available(self):
self.assertTrue(set(hashlib.algorithms_guaranteed).
issubset(hashlib.algorithms_available))
# all available algorithms must be loadable, bpo-47101
self.assertNotIn("undefined", hashlib.algorithms_available)
for name in hashlib.algorithms_available:
digest = hashlib.new(name, usedforsecurity=False)
def test_usedforsecurity_true(self):
hashlib.new("sha256", usedforsecurity=True)