aboutsummaryrefslogtreecommitdiffstats
path: root/cryptography/hazmat/bindings/openssl/backend.py
diff options
context:
space:
mode:
Diffstat (limited to 'cryptography/hazmat/bindings/openssl/backend.py')
-rw-r--r--cryptography/hazmat/bindings/openssl/backend.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/cryptography/hazmat/bindings/openssl/backend.py b/cryptography/hazmat/bindings/openssl/backend.py
index 7367818a..ea1073b9 100644
--- a/cryptography/hazmat/bindings/openssl/backend.py
+++ b/cryptography/hazmat/bindings/openssl/backend.py
@@ -147,7 +147,9 @@ class _CipherContext(object):
raise UnsupportedAlgorithm
evp_cipher = adapter(self._backend, cipher, mode)
- assert evp_cipher != self._backend.ffi.NULL
+ if evp_cipher == self._backend.ffi.NULL:
+ raise UnsupportedAlgorithm
+
if isinstance(mode, interfaces.ModeWithInitializationVector):
iv_nonce = mode.initialization_vector
elif isinstance(mode, interfaces.ModeWithNonce):