aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives/test_cast5.py
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2014-03-08 11:09:49 -0400
committerPaul Kehrer <paul.l.kehrer@gmail.com>2014-03-08 11:09:49 -0400
commitbf2a9d9545f39ad0dd9b9c9c4aa2f7f2b5669f0f (patch)
tree083cc465c6fabdb61ff69aadc33b31e8617f2136 /tests/hazmat/primitives/test_cast5.py
parentdee5c25d35c53885698bca42015c9f7bbfb27baa (diff)
parent78c2f2d2c0a40d20edcaf37c33e91224af3ecbb6 (diff)
downloadcryptography-bf2a9d9545f39ad0dd9b9c9c4aa2f7f2b5669f0f.tar.gz
cryptography-bf2a9d9545f39ad0dd9b9c9c4aa2f7f2b5669f0f.tar.bz2
cryptography-bf2a9d9545f39ad0dd9b9c9c4aa2f7f2b5669f0f.zip
Merge branch 'master' into idea-bespoke-vectors
* master: (246 commits) Fixed python3 incompatibility Removed dependency on setuptools for version check don't need to move these definitions conditional NIDs for 0.9.8e x509 changes for 0.9.8e support more changes for 0.9.8e support, this time in the ssl.h headers macro switches in evp for 0.9.8e bind some error constants conditionally for 0.9.8e support BIO macro switch for 0.9.8e support move some nids conditionally bind AES_wrap/unwrap for 0.9.8e support Add GPG key fingerprint for lvh change comparison to be easier to read ridiculous workaround time whoops Missing imports Convert stuff Add binding for DSA_new Fix drop in coverage levels by removing branches Added check to turn of CC backend for OS X version < 10.8 ... Conflicts: docs/development/test-vectors.rst
Diffstat (limited to 'tests/hazmat/primitives/test_cast5.py')
-rw-r--r--tests/hazmat/primitives/test_cast5.py25
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))
+ )