aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/backends
diff options
context:
space:
mode:
authorAyrx <terrycwk1994@gmail.com>2014-04-22 22:24:26 +0800
committerAyrx <terrycwk1994@gmail.com>2014-04-22 22:24:26 +0800
commitf09a3d6cfa198f89eca0e012fb9f9ae0a2d9591a (patch)
treeb4b6499626281c8cf92fc130470df6aab490dd4c /tests/hazmat/backends
parentb5236fe24efa4d399353327db49c23dc6e81d1f5 (diff)
downloadcryptography-f09a3d6cfa198f89eca0e012fb9f9ae0a2d9591a.tar.gz
cryptography-f09a3d6cfa198f89eca0e012fb9f9ae0a2d9591a.tar.bz2
cryptography-f09a3d6cfa198f89eca0e012fb9f9ae0a2d9591a.zip
Added missing tests for 100% coverage
Diffstat (limited to 'tests/hazmat/backends')
-rw-r--r--tests/hazmat/backends/test_openssl.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py
index c589506f..98537360 100644
--- a/tests/hazmat/backends/test_openssl.py
+++ b/tests/hazmat/backends/test_openssl.py
@@ -23,6 +23,7 @@ from cryptography.hazmat.primitives.asymmetric import dsa, padding, rsa
from cryptography.hazmat.primitives.ciphers import Cipher
from cryptography.hazmat.primitives.ciphers.algorithms import AES
from cryptography.hazmat.primitives.ciphers.modes import CBC
+from cryptography.hazmat.primitives.interfaces import BlockCipherAlgorithm
from ...utils import raises_unsupported_algorithm
@@ -291,3 +292,18 @@ class TestOpenSSLRSA(object):
def test_unsupported_mgf1_hash_algorithm(self):
assert backend.mgf1_hash_supported(DummyHash()) is False
+
+
+@pytest.mark.skipif(
+ backend._lib.OPENSSL_VERSION_NUMBER <= 0x10001000,
+ reason="Requires an OpenSSL version >= 1.0.1"
+)
+class TestOpenSSLCMAC(object):
+ def test_unsupported_cipher(self):
+ @utils.register_interface(BlockCipherAlgorithm)
+ class FakeAlgorithm(object):
+ def __init__(self):
+ self.block_size = 64
+
+ with raises_unsupported_algorithm(_Reasons.UNSUPPORTED_CIPHER):
+ backend.create_cmac_ctx(FakeAlgorithm())