[PATCH 1/3] crypto: atmel - use memzero_explicit() for clearing data

From: Kai Ye
Date: Thu Mar 25 2021 - 21:24:03 EST


use memzero_explicit instead of memset to clear sensitive data, such as key.

Signed-off-by: Kai Ye <yekai13@xxxxxxxxxx>
---
drivers/crypto/atmel-sha.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c
index 352d80c..4a08b2a 100644
--- a/drivers/crypto/atmel-sha.c
+++ b/drivers/crypto/atmel-sha.c
@@ -1622,7 +1622,7 @@ static inline void atmel_sha_hmac_key_init(struct atmel_sha_hmac_key *hkey)
static inline void atmel_sha_hmac_key_release(struct atmel_sha_hmac_key *hkey)
{
kfree(hkey->keydup);
- memset(hkey, 0, sizeof(*hkey));
+ memzero_explicit(hkey, sizeof(*hkey));
}

static inline int atmel_sha_hmac_key_set(struct atmel_sha_hmac_key *hkey,
--
2.8.1