From 77411bd6387b28e91eac1702c872712f09c62c4b Mon Sep 17 00:00:00 2001 From: Arek Kusztal Date: Mon, 1 Jul 2019 16:57:25 +0200 Subject: [PATCH] crypto/openssl: fix free of asymmetric crypto keys In case big number need to be freed, data it contains should also be cleared before especially if it is critical data like private keys. Fixes: 3e9d6bd447fb ("crypto/openssl: add RSA and mod asym operations") Cc: stable@dpdk.org Signed-off-by: Arek Kusztal Acked-by: Fiona Trahe --- drivers/crypto/openssl/rte_openssl_pmd_ops.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c b/drivers/crypto/openssl/rte_openssl_pmd_ops.c index 40217cf0db..a307c91ec8 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c +++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c @@ -912,14 +912,14 @@ static int openssl_set_asym_session_parameters( asym_session->xfrm_type = RTE_CRYPTO_ASYM_XFORM_RSA; break; err_rsa: - BN_free(n); - BN_free(e); - BN_free(d); - BN_free(p); - BN_free(q); - BN_free(dmp1); - BN_free(dmq1); - BN_free(iqmp); + BN_clear_free(n); + BN_clear_free(e); + BN_clear_free(d); + BN_clear_free(p); + BN_clear_free(q); + BN_clear_free(dmp1); + BN_clear_free(dmq1); + BN_clear_free(iqmp); return -1; } -- 2.20.1