diff options
Diffstat (limited to 'tests/hazmat/primitives/test_blowfish.py')
-rw-r--r-- | tests/hazmat/primitives/test_blowfish.py | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/tests/hazmat/primitives/test_blowfish.py b/tests/hazmat/primitives/test_blowfish.py index d5fbed6f..3e0e9025 100644 --- a/tests/hazmat/primitives/test_blowfish.py +++ b/tests/hazmat/primitives/test_blowfish.py @@ -27,8 +27,10 @@ class TestBlowfish(object): load_nist_vectors, os.path.join("ciphers", "Blowfish"), ["bf-ecb.txt"], - lambda key: algorithms.Blowfish(binascii.unhexlify(key)), - lambda key: modes.ECB(), + lambda **kwargs: algorithms.Blowfish( + binascii.unhexlify(kwargs["key"]) + ), + lambda **kwargs: modes.ECB(), only_if=lambda backend: backend.cipher_supported( algorithms.Blowfish("\x00" * 56), modes.ECB() ), @@ -39,8 +41,10 @@ class TestBlowfish(object): load_nist_vectors, os.path.join("ciphers", "Blowfish"), ["bf-cbc.txt"], - lambda key, iv: algorithms.Blowfish(binascii.unhexlify(key)), - lambda key, iv: modes.CBC(binascii.unhexlify(iv)), + lambda **kwargs: algorithms.Blowfish( + binascii.unhexlify(kwargs["key"]) + ), + lambda **kwargs: modes.CBC(binascii.unhexlify(kwargs["iv"])), only_if=lambda backend: backend.cipher_supported( algorithms.Blowfish("\x00" * 56), modes.CBC("\x00" * 8) ), @@ -51,8 +55,10 @@ class TestBlowfish(object): load_nist_vectors, os.path.join("ciphers", "Blowfish"), ["bf-ofb.txt"], - lambda key, iv: algorithms.Blowfish(binascii.unhexlify(key)), - lambda key, iv: modes.OFB(binascii.unhexlify(iv)), + lambda **kwargs: algorithms.Blowfish( + binascii.unhexlify(kwargs["key"]) + ), + lambda **kwargs: modes.OFB(binascii.unhexlify(kwargs["iv"])), only_if=lambda backend: backend.cipher_supported( algorithms.Blowfish("\x00" * 56), modes.OFB("\x00" * 8) ), @@ -63,8 +69,10 @@ class TestBlowfish(object): load_nist_vectors, os.path.join("ciphers", "Blowfish"), ["bf-cfb.txt"], - lambda key, iv: algorithms.Blowfish(binascii.unhexlify(key)), - lambda key, iv: modes.CFB(binascii.unhexlify(iv)), + lambda **kwargs: algorithms.Blowfish( + binascii.unhexlify(kwargs["key"]) + ), + lambda **kwargs: modes.CFB(binascii.unhexlify(kwargs["iv"])), only_if=lambda backend: backend.cipher_supported( algorithms.Blowfish("\x00" * 56), modes.CFB("\x00" * 8) ), |