diff mbox

linux-generic:release memory during session destory

Message ID 1458039836-30443-1-git-send-email-balakrishna.garapati@linaro.org
State Superseded
Headers show

Commit Message

Balakrishna Garapati March 15, 2016, 11:03 a.m. UTC
make sure the EVP_CIPHER memory is freed from the aes_gcm ctx
before memset the crypto session to zero.

Signed-off-by: balakrishna.garapati <balakrishna.garapati@linaro.org>
---
 platform/linux-generic/odp_crypto.c | 2 ++
 1 file changed, 2 insertions(+)

--
1.9.1
diff mbox

Patch

diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c
index 08b479d..07df747 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -704,6 +704,8 @@  int odp_crypto_session_destroy(odp_crypto_session_t session)
 	odp_crypto_generic_session_t *generic;

 	generic = (odp_crypto_generic_session_t *)(intptr_t)session;
+        if(generic->cipher.alg == ODP_CIPHER_ALG_AES128_GCM)
+        	EVP_CIPHER_CTX_free(generic->cipher.data.aes_gcm.ctx);
 	memset(generic, 0, sizeof(*generic));
 	free_session(generic);
 	return 0;