Skip to content

Commit 1d3eb1d

Browse files
committed
amend test
1 parent a9ea6ad commit 1d3eb1d

File tree

1 file changed

+0
-27
lines changed

1 file changed

+0
-27
lines changed

Lib/test/test_support.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,6 @@ def setUpClass(cls):
812812
# the built-in implementation while allowing OpenSSL or vice-versa
813813
# may result in failures depending on the exposed built-in hashes.
814814
cls._hashlib = import_helper.import_module("_hashlib")
815-
cls._hmac = import_helper.import_module("_hmac")
816815
cls._md5 = import_helper.import_module("_md5")
817816

818817
def skip_if_fips_mode(self):
@@ -856,10 +855,6 @@ def fetch_hash_function(self, name, implementation):
856855
fullname = info.fullname(implementation)
857856
return self.try_import_attribute(fullname)
858857

859-
def fetch_hmac_function(self, name):
860-
fullname = hashlib_helper._EXPLICIT_HMAC_CONSTRUCTORS[name]
861-
return self.try_import_attribute(fullname)
862-
863858
def check_openssl_hash(self, name, *, disabled=True):
864859
"""Check that OpenSSL HASH interface is enabled/disabled."""
865860
with self.check_context(disabled):
@@ -888,27 +883,6 @@ def check_builtin_hash(self, name, *, disabled=True):
888883
with self.check_context(disabled):
889884
_ = do_hash(b"")
890885

891-
def check_builtin_hmac(self, name, *, disabled=True):
892-
"""Check that HACL* HMAC interface is enabled/disabled."""
893-
if name in hashlib_helper.NON_HMAC_DIGEST_NAMES:
894-
# HMAC-BLAKE and HMAC-SHAKE raise a ValueError as they are not
895-
# supported at all (they do not make any sense in practice).
896-
with self.assertRaises(ValueError):
897-
self._hmac.compute_digest(b"", b"", name)
898-
else:
899-
with self.check_context(disabled):
900-
_ = self._hmac.compute_digest(b"", b"", name)
901-
902-
with self.check_context(disabled):
903-
_ = self._hmac.new(b"", b"", name)
904-
905-
if do_hmac := self.fetch_hmac_function(name):
906-
self.assertStartsWith(do_hmac.__name__, 'compute_')
907-
with self.check_context(disabled):
908-
_ = do_hmac(b"", b"")
909-
else:
910-
self.assertIn(name, hashlib_helper.NON_HMAC_DIGEST_NAMES)
911-
912886
@support.subTests(
913887
('name', 'allow_openssl', 'allow_builtin'),
914888
itertools.product(
@@ -954,7 +928,6 @@ def test_disable_hash(self, name, allow_openssl, allow_builtin):
954928
_ = self.hmac.digest(b"", b"", name)
955929

956930
self.check_openssl_hmac(name, disabled=not allow_openssl)
957-
self.check_builtin_hmac(name, disabled=not allow_builtin)
958931

959932
@hashlib_helper.block_algorithm("md5")
960933
def test_disable_hash_md5_in_fips_mode(self):

0 commit comments

Comments
 (0)