aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cryptography/bindings/openssl/api.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/cryptography/bindings/openssl/api.py b/cryptography/bindings/openssl/api.py
index ee4fbff1..f5e042e7 100644
--- a/cryptography/bindings/openssl/api.py
+++ b/cryptography/bindings/openssl/api.py
@@ -142,7 +142,7 @@ class API(object):
res = self.lib.EVP_EncryptFinal_ex(ctx, buf, outlen)
assert res != 0
res = self.lib.EVP_CIPHER_CTX_cleanup(ctx)
- assert res != 0
+ assert res == 1
return self.ffi.buffer(buf)[:outlen[0]]
def supports_hash(self, hash_cls):
@@ -166,6 +166,8 @@ class API(object):
buf = self.ffi.new("unsigned char[]", digest_size)
res = self.lib.EVP_DigestFinal_ex(ctx, buf, self.ffi.NULL)
assert res != 0
+ res = self.lib.EVP_MD_CTX_cleanup(ctx)
+ assert res == 1
return self.ffi.buffer(buf)[:digest_size]
def copy_hash_context(self, ctx):