From 8de40f40b3a1512bd8c7f3786cda9234b04b2776 Mon Sep 17 00:00:00 2001 From: Andrew Ayer Date: Mon, 7 Jul 2014 22:41:13 -0700 Subject: [PATCH] Wipe AES key from memory after using it --- crypto-openssl.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crypto-openssl.cpp b/crypto-openssl.cpp index cb168fc..e833ada 100644 --- a/crypto-openssl.cpp +++ b/crypto-openssl.cpp @@ -37,6 +37,7 @@ #include #include #include +#include void init_crypto () { @@ -59,6 +60,8 @@ Aes_ecb_encryptor::~Aes_ecb_encryptor () { // Note: Explicit destructor necessary because class contains an auto_ptr // which contains an incomplete type when the auto_ptr is declared. + + std::memset(&impl->key, '\0', sizeof(impl->key)); } void Aes_ecb_encryptor::encrypt(const unsigned char* plain, unsigned char* cipher)