MCPcopy Index your code
hub / github.com/python/cpython / check_openssl_hmac

Method check_openssl_hmac

Lib/test/test_support.py:915–925  ·  view source on GitHub ↗

Check that OpenSSL HMAC interface is enabled/disabled.

(self, name, *, disabled=True)

Source from the content-addressed store, hash-verified

913 _ = do_hash(b"")
914
915 def check_openssl_hmac(self, name, *, disabled=True):
916 """Check that OpenSSL HMAC interface is enabled/disabled."""
917 if name in hashlib_helper.NON_HMAC_DIGEST_NAMES:
918 # HMAC-BLAKE and HMAC-SHAKE raise a ValueError as they are not
919 # supported at all (they do not make any sense in practice).
920 with self.assertRaises(ValueError):
921 self._hashlib.hmac_digest(b"", b"", name)
922 else:
923 with self.check_context(disabled):
924 _ = self._hashlib.hmac_digest(b"", b"", name)
925 # OpenSSL does not provide one-shot explicit HMAC functions
926
927 def check_builtin_hash(self, name, *, disabled=True):
928 """Check that HACL* HASH interface is enabled/disabled."""

Callers 1

test_disable_hashMethod · 0.95

Calls 3

check_contextMethod · 0.95
assertRaisesMethod · 0.45
hmac_digestMethod · 0.45

Tested by

no test coverage detected