kernel_optimize_test/crypto
Waiman Long 453431a549 mm, treewide: rename kzfree() to kfree_sensitive()
As said by Linus:

  A symmetric naming is only helpful if it implies symmetries in use.
  Otherwise it's actively misleading.

  In "kzalloc()", the z is meaningful and an important part of what the
  caller wants.

  In "kzfree()", the z is actively detrimental, because maybe in the
  future we really _might_ want to use that "memfill(0xdeadbeef)" or
  something. The "zero" part of the interface isn't even _relevant_.

The main reason that kzfree() exists is to clear sensitive information
that should not be leaked to other future users of the same memory
objects.

Rename kzfree() to kfree_sensitive() to follow the example of the recently
added kvfree_sensitive() and make the intention of the API more explicit.
In addition, memzero_explicit() is used to clear the memory to make sure
that it won't get optimized away by the compiler.

The renaming is done by using the command sequence:

  git grep -w --name-only kzfree |\
  xargs sed -i 's/kzfree/kfree_sensitive/'

followed by some editing of the kfree_sensitive() kerneldoc and adding
a kzfree backward compatibility macro in slab.h.

[akpm@linux-foundation.org: fs/crypto/inline_crypt.c needs linux/slab.h]
[akpm@linux-foundation.org: fix fs/crypto/inline_crypt.c some more]

Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: David Howells <dhowells@redhat.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Cc: James Morris <jmorris@namei.org>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
Cc: Joe Perches <joe@perches.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "Jason A . Donenfeld" <Jason@zx2c4.com>
Link: http://lkml.kernel.org/r/20200616154311.12314-3-longman@redhat.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-08-07 11:33:22 -07:00
..
asymmetric_keys mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
async_tx
842.c
acompress.c crypto: api - permit users to specify numa node of acomp hardware 2020-07-09 18:25:23 +10:00
adiantum.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
aead.c
aegis.h
aegis128-core.c
aegis128-neon-inner.c
aegis128-neon.c
aes_generic.c
aes_ti.c
af_alg.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next 2020-08-05 20:13:21 -07:00
ahash.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
akcipher.c
algapi.c crypto: algapi - use common mechanism for inheriting flags 2020-07-16 21:49:08 +10:00
algboss.c crypto: algboss - don't wait during notifier callback 2020-06-15 17:38:54 +10:00
algif_aead.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next 2020-08-05 20:13:21 -07:00
algif_hash.c net: make ->{get,set}sockopt in proto_ops optional 2020-07-19 18:16:41 -07:00
algif_rng.c net: make ->{get,set}sockopt in proto_ops optional 2020-07-19 18:16:41 -07:00
algif_skcipher.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next 2020-08-05 20:13:21 -07:00
ansi_cprng.c
anubis.c
api.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
arc4.c
authenc.c crypto: algapi - use common mechanism for inheriting flags 2020-07-16 21:49:08 +10:00
authencesn.c crypto: algapi - use common mechanism for inheriting flags 2020-07-16 21:49:08 +10:00
blake2b_generic.c crypto: Replace HTTP links with HTTPS ones 2020-07-23 17:34:20 +10:00
blake2s_generic.c
blowfish_common.c
blowfish_generic.c
camellia_generic.c crypto: Replace HTTP links with HTTPS ones 2020-07-23 17:34:20 +10:00
cast_common.c
cast5_generic.c
cast6_generic.c
cbc.c
ccm.c crypto: algapi - use common mechanism for inheriting flags 2020-07-16 21:49:08 +10:00
cfb.c
chacha_generic.c
chacha20poly1305.c crypto: algapi - use common mechanism for inheriting flags 2020-07-16 21:49:08 +10:00
cipher.c
cmac.c crypto: algapi - use common mechanism for inheriting flags 2020-07-16 21:49:08 +10:00
compress.c
crc32_generic.c
crc32c_generic.c
crct10dif_common.c
crct10dif_generic.c
cryptd.c crypto: algapi - use common mechanism for inheriting flags 2020-07-16 21:49:08 +10:00
crypto_engine.c sched,crypto: Convert to sched_set_fifo*() 2020-06-15 14:10:20 +02:00
crypto_null.c
crypto_user_base.c
crypto_user_stat.c
ctr.c crypto: algapi - add NEED_FALLBACK to INHERITED_FLAGS 2020-07-16 21:49:08 +10:00
cts.c crypto: algapi - use common mechanism for inheriting flags 2020-07-16 21:49:08 +10:00
curve25519-generic.c
deflate.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
des_generic.c
dh_helper.c
dh.c crypto: dh - SP800-56A rev 3 local public key validation 2020-07-31 18:08:59 +10:00
drbg.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
ecb.c
ecc_curve_defs.h
ecc.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
ecc.h crypto: ecc - SP800-56A rev 3 local public key validation 2020-07-31 18:08:59 +10:00
ecdh_helper.c
ecdh.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
echainiv.c crypto: geniv - remove unneeded arguments from aead_geniv_alloc() 2020-07-16 21:49:07 +10:00
ecrdsa_defs.h
ecrdsa_params.asn1
ecrdsa_pub_key.asn1
ecrdsa.c
essiv.c crypto: algapi - use common mechanism for inheriting flags 2020-07-16 21:49:08 +10:00
fcrypt.c
fips.c
gcm.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
geniv.c crypto: algapi - use common mechanism for inheriting flags 2020-07-16 21:49:08 +10:00
gf128mul.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
ghash-generic.c
hash_info.c
hmac.c crypto: algapi - use common mechanism for inheriting flags 2020-07-16 21:49:08 +10:00
internal.h crypto: api - permit users to specify numa node of acomp hardware 2020-07-09 18:25:23 +10:00
jitterentropy-kcapi.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
jitterentropy.c crypto: Replace HTTP links with HTTPS ones 2020-07-23 17:34:20 +10:00
jitterentropy.h
Kconfig crypto: Replace HTTP links with HTTPS ones 2020-07-23 17:34:20 +10:00
keywrap.c
khazad.c
kpp.c
lrw.c crypto: Replace HTTP links with HTTPS ones 2020-07-23 17:34:20 +10:00
lz4.c
lz4hc.c
lzo-rle.c
lzo.c
Makefile
md4.c
md5.c
memneq.c
michael_mic.c
nhpoly1305.c
ofb.c
pcbc.c
pcrypt.c padata: fold padata_alloc_possible() into padata_alloc() 2020-07-23 17:34:18 +10:00
poly1305_generic.c
proc.c
ripemd.h
rmd128.c
rmd160.c
rmd256.c
rmd320.c
rng.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
rsa_helper.c
rsa-pkcs1pad.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
rsa.c
rsaprivkey.asn1
rsapubkey.asn1
salsa20_generic.c crypto: Replace HTTP links with HTTPS ones 2020-07-23 17:34:20 +10:00
scatterwalk.c
scompress.c
seed.c
seqiv.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
serpent_generic.c
sha1_generic.c crypto: lib/sha1 - fold linux/cryptohash.h into crypto/sha.h 2020-05-08 15:32:17 +10:00
sha3_generic.c crypto: Replace HTTP links with HTTPS ones 2020-07-23 17:34:20 +10:00
sha256_generic.c crypto: lib/sha256 - return void 2020-05-08 15:32:12 +10:00
sha512_generic.c
shash.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
simd.c crypto: algapi - use common mechanism for inheriting flags 2020-07-16 21:49:08 +10:00
skcipher.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
sm3_generic.c
sm4_generic.c
streebog_generic.c
tcrypt.c
tcrypt.h
tea.c
testmgr.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
testmgr.h crypto: testmgr - delete duplicated words 2020-07-23 17:34:20 +10:00
tgr192.c
twofish_common.c
twofish_generic.c
vmac.c crypto: algapi - use common mechanism for inheriting flags 2020-07-16 21:49:08 +10:00
wp512.c
xcbc.c crypto: algapi - use common mechanism for inheriting flags 2020-07-16 21:49:08 +10:00
xor.c
xts.c crypto: xts - Replace memcpy() invocation with simple assignment 2020-07-31 18:09:00 +10:00
xxhash_generic.c
zstd.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00