diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2014-11-19 17:13:11 +0100 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2014-11-25 22:50:39 +0800 |
commit | 9a668a090978f98129af0c41de95b0277ac1a0b1 (patch) | |
tree | 96829cb1fbb507f8b60b14f9f39e6fc0451d4ea2 /crypto/async_tx/async_memcpy.c | |
parent | 4c76e2103ade7b1d9f14acc4d3c7fcf0f4855f18 (diff) | |
download | linux-crypto-9a668a090978f98129af0c41de95b0277ac1a0b1.tar.gz linux-crypto-9a668a090978f98129af0c41de95b0277ac1a0b1.zip |
crypto: algif - add and use sock_kzfree_s() instead of memzero_explicit()
Commit a7468e6b54f4 ("crypto: algif - zeroize IV buffer") and
8bd21048c803 ("crypto: algif - zeroize message digest buffer")
added memzero_explicit() calls on buffers that are later on
passed back to sock_kfree_s().
This is a discussed follow-up that, instead, extends the sock
API and adds sock_kzfree_s(), which internally uses kzfree()
instead of kfree() for passing the buffers back to slab.
Having sock_kzfree_s() allows to keep the changes more minimal
by just having a drop-in replacement instead of adding
memzero_explicit() calls everywhere before sock_kfree_s().
In kzfree(), the compiler is not allowed to optimize the memset()
away and thus there's no need for memzero_explicit(). Both,
sock_kfree_s() and sock_kzfree_s() are wrappers for
__sock_kfree_s() and call into kfree() resp. kzfree(); here,
__sock_kfree_s() needs to be explicitly inlined as we want the
compiler to optimize the call and condition away and thus it
produces e.g. on x86_64 the _same_ assembler output for
sock_kfree_s() before and after, and thus also allows for
avoiding code duplication.
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/async_tx/async_memcpy.c')
0 files changed, 0 insertions, 0 deletions