aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-08-09 10:11:29 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2013-08-09 10:11:29 -0700
commit66d368b3e75898a0d1067a6713eec63d639081dd (patch)
tree2670b52ea6962aa69877b5c1ebbe685b8d01b0f0
parentf48cb8601449f6d658fd996bff9de3a1b1b70ae8 (diff)
downloadcryptography-66d368b3e75898a0d1067a6713eec63d639081dd.tar.gz
cryptography-66d368b3e75898a0d1067a6713eec63d639081dd.tar.bz2
cryptography-66d368b3e75898a0d1067a6713eec63d639081dd.zip
Clear the sensitive data
-rw-r--r--cryptography/bindings/openssl/api.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/cryptography/bindings/openssl/api.py b/cryptography/bindings/openssl/api.py
index abdaef02..20a85cad 100644
--- a/cryptography/bindings/openssl/api.py
+++ b/cryptography/bindings/openssl/api.py
@@ -42,6 +42,7 @@ class API(object):
int EVP_EncryptUpdate(EVP_CIPHER_CTX *, unsigned char *, int *,
unsigned char *, int);
int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *, unsigned char *, int *);
+ int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *);
""")
def create_block_cipher_context(self, cipher, mode):
@@ -78,6 +79,11 @@ class API(object):
if res == 0:
# TODO: figure out openssl errors
raise Exception
+ # TODO: this should also be called if the cipher isn't finalized.
+ res = self._lib.EVP_CIPHER_CTX_cleanup(ctx)
+ if res == 0:
+ # TODO: figure out openssl errors
+ raise Exception
return self._ffi.buffer(buf)[:outlen[0]]