Daniel Borkmann 79e886599e crypto: algif - add and use sock_kzfree_s() instead of memzero_explicit()
Commit e1bd95bf7c25 ("crypto: algif - zeroize IV buffer") and
2a6af25befd0 ("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>
2014-11-25 22:50:39 +08:00
..
2014-07-30 19:28:41 +02:00
2014-09-18 10:54:36 +02:00
2013-12-28 17:02:46 -05:00
2014-09-26 16:14:16 -04:00
2013-11-07 19:28:58 -05:00
2014-09-30 01:02:26 -04:00
2014-06-04 22:46:38 -07:00
2013-01-27 22:46:33 -05:00
2014-06-27 15:53:35 -07:00
2014-09-05 17:40:33 -07:00
2014-01-03 20:56:48 -05:00
2014-09-30 14:00:48 -04:00
2014-10-16 14:52:35 -04:00
2014-08-15 13:51:40 +02:00
2014-03-24 12:45:01 -04:00
2014-06-02 11:00:41 -07:00
2014-05-22 14:57:15 -04:00
2014-10-01 21:35:51 -04:00
2014-07-07 21:14:21 -07:00