From: Eric Biggers Date: Mon, 7 Jan 2019 03:08:01 +0000 (-0800) Subject: crypto: shash - remove pointless checks of shash_alg::{export,import} X-Git-Tag: v5.1-rc1~177^2~133 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2b091e32a2d357beb9ffe283c696eec104729c2a;p=thirdparty%2Fkernel%2Flinux.git crypto: shash - remove pointless checks of shash_alg::{export,import} crypto_init_shash_ops_async() only gives the ahash tfm non-NULL ->export() and ->import() if the underlying shash alg has these non-NULL. This doesn't make sense because when an shash algorithm is registered, shash_prepare_alg() sets a default ->export() and ->import() if the implementor didn't provide them. And elsewhere it's assumed that all shash algs and ahash tfms have non-NULL ->export() and ->import(). Therefore, remove these unnecessary, always-true conditions. Signed-off-by: Eric Biggers Signed-off-by: Herbert Xu --- diff --git a/crypto/shash.c b/crypto/shash.c index 2bffdecf1f837..15b369c4745f6 100644 --- a/crypto/shash.c +++ b/crypto/shash.c @@ -388,10 +388,8 @@ int crypto_init_shash_ops_async(struct crypto_tfm *tfm) crypto_ahash_set_flags(crt, crypto_shash_get_flags(shash) & CRYPTO_TFM_NEED_KEY); - if (alg->export) - crt->export = shash_async_export; - if (alg->import) - crt->import = shash_async_import; + crt->export = shash_async_export; + crt->import = shash_async_import; crt->reqsize = sizeof(struct shash_desc) + crypto_shash_descsize(shash);