From 62bff4aff1e1c7bb363914ea41170b01d62bc14f Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 3 Sep 2018 17:44:17 +0200 Subject: [PATCH] wrapper: Use explicit_bzero() in crypto_free() Signed-off-by: Andreas Schneider Reviewed-by: Jakub Jelen --- src/wrapper.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wrapper.c b/src/wrapper.c index 7fc10293..354bc0de 100644 --- a/src/wrapper.c +++ b/src/wrapper.c @@ -177,11 +177,11 @@ void crypto_free(struct ssh_crypto_struct *crypto) } #endif if (crypto->session_id != NULL) { - memset(crypto->session_id, '\0', crypto->digest_len); + explicit_bzero(crypto->session_id, crypto->digest_len); SAFE_FREE(crypto->session_id); } if (crypto->secret_hash != NULL) { - memset(crypto->secret_hash, '\0', crypto->digest_len); + explicit_bzero(crypto->secret_hash, crypto->digest_len); SAFE_FREE(crypto->secret_hash); } #ifdef WITH_ZLIB @@ -202,11 +202,11 @@ void crypto_free(struct ssh_crypto_struct *crypto) SAFE_FREE(crypto->encryptMAC); SAFE_FREE(crypto->decryptMAC); if (crypto->encryptkey != NULL) { - memset(crypto->encryptkey, 0, crypto->digest_len); + explicit_bzero(crypto->encryptkey, crypto->digest_len); SAFE_FREE(crypto->encryptkey); } if (crypto->decryptkey != NULL) { - memset(crypto->decryptkey, 0, crypto->digest_len); + explicit_bzero(crypto->decryptkey, crypto->digest_len); SAFE_FREE(crypto->decryptkey); }