virtio-crypto: zeroize the key material before free
commit02ed3e7c1665205ddae052774d6f26c71d3d9b30
authorGonglei <arei.gonglei@huawei.com>
Thu, 22 Dec 2016 03:01:28 +0000 (22 11:01 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 10 Jan 2017 05:02:52 +0000 (10 07:02 +0200)
tree44c94571b153a3e46808212a6cf4393815c485b3
parentef69d971cd63cd427e602098837bd09bcddd9410
virtio-crypto: zeroize the key material before free

Common practice with sensitive information (key material, passwords,
etc). Prevents sensitive information from being exposed by accident later in
coredumps, memory disclosure bugs when heap memory is reused, etc.

Sensitive information is sometimes also held in mlocked pages to prevent
it being swapped to disk but that's not being done here.

Let's zeroize the memory of CryptoDevBackendSymOpInfo structure pointed
for key material security.

[Thanks to Stefan for help with crafting the commit message]

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/virtio/virtio-crypto.c