diff options
author | Donald Stufft <donald@stufft.io> | 2013-10-20 10:46:03 -0700 |
---|---|---|
committer | Donald Stufft <donald@stufft.io> | 2013-10-20 10:46:03 -0700 |
commit | a33792415811d91338d8135440111207706e2441 (patch) | |
tree | 4a85258a3779a9037b3b06aab234b6a6a2dcac44 | |
parent | 7ef1688ad0ebf9db11586c51a9f6223e1fa865bb (diff) | |
parent | fb84cadbe89aceee31ba42f1c4aec10391864897 (diff) | |
download | cryptography-a33792415811d91338d8135440111207706e2441.tar.gz cryptography-a33792415811d91338d8135440111207706e2441.tar.bz2 cryptography-a33792415811d91338d8135440111207706e2441.zip |
Merge pull request #150 from alex/cleanup-hash-ctx
Cleanup hash ctxs when we're done with them
-rw-r--r-- | cryptography/bindings/openssl/api.py | 4 |
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): |