aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cryptography/hazmat/backends/openssl/backend.py7
-rw-r--r--tests/hazmat/primitives/test_cmac.py2
2 files changed, 6 insertions, 3 deletions
diff --git a/cryptography/hazmat/backends/openssl/backend.py b/cryptography/hazmat/backends/openssl/backend.py
index 7cfdd284..11731133 100644
--- a/cryptography/hazmat/backends/openssl/backend.py
+++ b/cryptography/hazmat/backends/openssl/backend.py
@@ -556,8 +556,11 @@ class Backend(object):
return self._ffi.buffer(buf)[:res]
def cmac_algorithm_supported(self, algorithm):
- return (backend._lib.Cryptography_HAS_CMAC == 1
- and backend.cipher_supported(algorithm, CBC(0)))
+ return (
+ backend._lib.Cryptography_HAS_CMAC == 1
+ and backend.cipher_supported(algorithm, CBC(
+ b"\x00" * algorithm.block_size))
+ )
def create_cmac_ctx(self, algorithm):
return _CMACContext(self, algorithm)
diff --git a/tests/hazmat/primitives/test_cmac.py b/tests/hazmat/primitives/test_cmac.py
index a1c24ada..dd7f9df4 100644
--- a/tests/hazmat/primitives/test_cmac.py
+++ b/tests/hazmat/primitives/test_cmac.py
@@ -49,7 +49,7 @@ vectors_aes = vectors_aes128 + vectors_aes192 + vectors_aes256
vectors_3des = load_vectors_from_file(
"CMAC/nist-800-38b-3des.txt", load_nist_vectors)
-fake_key = "AAAAAAAAAAAAAAAA"
+fake_key = b"\x00" * 16
@pytest.mark.cmac