diff options
| author | Ayrx <terrycwk1994@gmail.com> | 2014-04-21 11:40:47 +0800 | 
|---|---|---|
| committer | Ayrx <terrycwk1994@gmail.com> | 2014-04-22 12:12:41 +0800 | 
| commit | 458cfd5df6902f4ee427fa0ca0eb67a8031b204c (patch) | |
| tree | 519cb24cf21d96ddec48337a40889e4584b82e02 | |
| parent | 4b8628aa626413d41ebc976c1a097ca3f4e13959 (diff) | |
| download | cryptography-458cfd5df6902f4ee427fa0ca0eb67a8031b204c.tar.gz cryptography-458cfd5df6902f4ee427fa0ca0eb67a8031b204c.tar.bz2 cryptography-458cfd5df6902f4ee427fa0ca0eb67a8031b204c.zip | |
Changed stub keys and ivs to use null bytes
| -rw-r--r-- | cryptography/hazmat/backends/openssl/backend.py | 7 | ||||
| -rw-r--r-- | tests/hazmat/primitives/test_cmac.py | 2 | 
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 | 
