aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/backends
diff options
context:
space:
mode:
authorAlex Stapleton <alexs@prol.etari.at>2014-03-01 22:08:49 +0000
committerAlex Stapleton <alexs@prol.etari.at>2014-03-01 22:18:38 +0000
commit94ee8b5c8570a330f9e3d30ae8313ec41b10b470 (patch)
tree73ee261656d483af7ee1c288c63396577e69fb45 /tests/hazmat/backends
parent1c979c6a28385e8c2f92ecd457fc0ebe48819536 (diff)
downloadcryptography-94ee8b5c8570a330f9e3d30ae8313ec41b10b470.tar.gz
cryptography-94ee8b5c8570a330f9e3d30ae8313ec41b10b470.tar.bz2
cryptography-94ee8b5c8570a330f9e3d30ae8313ec41b10b470.zip
raise InternalError
Diffstat (limited to 'tests/hazmat/backends')
-rw-r--r--tests/hazmat/backends/test_openssl.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py
index 9d48f4e8..42c1b395 100644
--- a/tests/hazmat/backends/test_openssl.py
+++ b/tests/hazmat/backends/test_openssl.py
@@ -14,7 +14,7 @@
import pytest
from cryptography import utils
-from cryptography.exceptions import UnsupportedAlgorithm
+from cryptography.exceptions import UnsupportedAlgorithm, InternalError
from cryptography.hazmat.backends.openssl.backend import backend, Backend
from cryptography.hazmat.primitives import interfaces, hashes
from cryptography.hazmat.primitives.ciphers import Cipher
@@ -118,6 +118,15 @@ class TestOpenSSL(object):
b"data not multiple of block length"
)
+ def test_unknown_error_in_cipher_finalize(self):
+ cipher = Cipher(AES(b"\0" * 16), CBC(b"\0" * 16), backend=backend)
+ enc = cipher.encryptor()
+ enc.update(b"\0")
+ backend._lib.ERR_put_error(0, 0, 1,
+ b"test_openssl.py", -1)
+ with pytest.raises(InternalError):
+ enc.finalize()
+
def test_derive_pbkdf2_raises_unsupported_on_old_openssl(self):
if backend.pbkdf2_hmac_supported(hashes.SHA256()):
pytest.skip("Requires an older OpenSSL")