From 0b26f787601acedf80d8fad5c71bf60c907b5201 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Fri, 9 Aug 2013 12:01:00 -0700 Subject: Address a review note --- cryptography/bindings/openssl/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cryptography/bindings/openssl/api.py b/cryptography/bindings/openssl/api.py index 78cbcbc3..07079415 100644 --- a/cryptography/bindings/openssl/api.py +++ b/cryptography/bindings/openssl/api.py @@ -65,6 +65,7 @@ class API(object): def create_block_cipher_context(self, cipher, mode): ctx = self._ffi.new("EVP_CIPHER_CTX *") + ctx = self._ffi.gc(ctx, self._lib.EVP_CIPHER_CTX_cleanup) # TODO: compute name using a better algorithm ciphername = "{0}-{1}-{2}".format( cipher.name, len(cipher.key) * 8, mode.name @@ -101,7 +102,6 @@ class API(object): res = self._lib.EVP_EncryptFinal_ex(ctx, buf, outlen) if res == 0: raise OpenSSLError(self) - # TODO: this should also be called if the cipher isn't finalized. res = self._lib.EVP_CIPHER_CTX_cleanup(ctx) if res == 0: raise OpenSSLError(self) -- cgit v1.2.3