diff options
Diffstat (limited to 'tests/hazmat/primitives/test_cast5.py')
-rw-r--r-- | tests/hazmat/primitives/test_cast5.py | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/tests/hazmat/primitives/test_cast5.py b/tests/hazmat/primitives/test_cast5.py index 682b4496..60228299 100644 --- a/tests/hazmat/primitives/test_cast5.py +++ b/tests/hazmat/primitives/test_cast5.py @@ -31,7 +31,7 @@ from ...utils import load_nist_vectors skip_message="Does not support CAST5 ECB", ) @pytest.mark.cipher -class TestCAST5_ECB(object): +class TestCAST5ModeECB(object): test_ECB = generate_encrypt_test( load_nist_vectors, os.path.join("ciphers", "CAST5"), @@ -48,7 +48,7 @@ class TestCAST5_ECB(object): skip_message="Does not support CAST5 CBC", ) @pytest.mark.cipher -class TestCAST5_CBC(object): +class TestCAST5ModeCBC(object): test_CBC = generate_encrypt_test( load_nist_vectors, os.path.join("ciphers", "CAST5"), @@ -65,7 +65,7 @@ class TestCAST5_CBC(object): skip_message="Does not support CAST5 OFB", ) @pytest.mark.cipher -class TestCAST5_OFB(object): +class TestCAST5ModeOFB(object): test_OFB = generate_encrypt_test( load_nist_vectors, os.path.join("ciphers", "CAST5"), @@ -82,7 +82,7 @@ class TestCAST5_OFB(object): skip_message="Does not support CAST5 CFB", ) @pytest.mark.cipher -class TestCAST5_CFB(object): +class TestCAST5ModeCFB(object): test_CFB = generate_encrypt_test( load_nist_vectors, os.path.join("ciphers", "CAST5"), @@ -90,3 +90,20 @@ class TestCAST5_CFB(object): lambda key, **kwargs: algorithms.CAST5(binascii.unhexlify((key))), lambda iv, **kwargs: modes.CFB(binascii.unhexlify(iv)) ) + + +@pytest.mark.supported( + only_if=lambda backend: backend.cipher_supported( + algorithms.CAST5("\x00" * 16), modes.CTR("\x00" * 8) + ), + skip_message="Does not support CAST5 CTR", +) +@pytest.mark.cipher +class TestCAST5ModeCTR(object): + test_CTR = generate_encrypt_test( + load_nist_vectors, + os.path.join("ciphers", "CAST5"), + ["cast5-ctr.txt"], + lambda key, **kwargs: algorithms.CAST5(binascii.unhexlify((key))), + lambda iv, **kwargs: modes.CTR(binascii.unhexlify(iv)) + ) |