aboutsummaryrefslogtreecommitdiffstats
path: root/cryptography
diff options
context:
space:
mode:
authorDavid Reid <dreid@dreid.org>2013-11-04 19:37:46 -0800
committerDavid Reid <dreid@dreid.org>2013-11-04 19:37:46 -0800
commit4a84def6d508cafef5d32d72c68b0c56fc1f810c (patch)
treee428bf2a267577f93e37ea05714cd08ab2ae3f54 /cryptography
parent79eaa7efa2aaafd62ffeee7385526f14647e5a7e (diff)
parent86f98a051c9298020ac1d6cdb06ceb513699c7fa (diff)
downloadcryptography-4a84def6d508cafef5d32d72c68b0c56fc1f810c.tar.gz
cryptography-4a84def6d508cafef5d32d72c68b0c56fc1f810c.tar.bz2
cryptography-4a84def6d508cafef5d32d72c68b0c56fc1f810c.zip
Merge pull request #216 from alex/more-error-condition
Replaced an assertion in the OpenSSL backend with a proper exception
Diffstat (limited to 'cryptography')
-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):