Skip to content

Commit

Permalink
KEYS: Use memzero_explicit() for secret data
Browse files Browse the repository at this point in the history
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: Dan Carpenter <[email protected]>
Signed-off-by: David Howells <[email protected]>
Acked-by: Mimi Zohar <[email protected]>
Signed-off-by: James Morris <[email protected]>
  • Loading branch information
Dan Carpenter authored and James Morris committed Feb 10, 2017
1 parent 57cb17e commit 5217660
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion security/keys/encrypted-keys/encrypted.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}

Expand Down

0 comments on commit 5217660

Please sign in to comment.