KEYS: trusted: sanitize all key material
authorEric Biggers <ebiggers@google.com>
Thu, 8 Jun 2017 13:49:18 +0000 (14:49 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Mon, 1 Jan 2018 20:51:01 +0000 (20:51 +0000)
commit3c16f689b7430641cef4f216b0707c56184c114c
tree9d350aebb867de168a13465f088a8db97490bb4d
parent7451eb5f46e23df1f8e280af3a820cf55710137b
KEYS: trusted: sanitize all key material

commit ee618b4619b72527aaed765f0f0b74072b281159 upstream.

As the previous patch did for encrypted-keys, zero sensitive any
potentially sensitive data related to the "trusted" key type before it
is freed.  Notably, we were not zeroing the tpm_buf structures in which
the actual key is stored for TPM seal and unseal, nor were we zeroing
the trusted_key_payload in certain error paths.

Cc: Mimi Zohar <zohar@linux.vnet.ibm.com>
Cc: David Safford <safford@us.ibm.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
[bwh: Backported to 3.2:
 - Also use kzfree() in my_get_random()
 - Drop one unapplicable change
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
security/keys/trusted.c