Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 52176603 authored by Dan Carpenter's avatar Dan Carpenter Committed by James Morris
Browse files

KEYS: Use memzero_explicit() for secret data



I don't think GCC has figured out how to optimize the memset() away, but
they might eventually so let's future proof this code a bit.

Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Acked-by: default avatarMimi Zohar <zohar@linux.vnet.ibm.com>
Signed-off-by: default avatarJames Morris <james.l.morris@oracle.com>
parent 57cb17e7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -985,7 +985,7 @@ static void encrypted_destroy(struct key *key)
	if (!epayload)
		return;

	memset(epayload->decrypted_data, 0, epayload->decrypted_datalen);
	memzero_explicit(epayload->decrypted_data, epayload->decrypted_datalen);
	kfree(key->payload.data[0]);
}