]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
crypto: shash - remove pointless checks of shash_alg::{export,import}
authorEric Biggers <ebiggers@google.com>
Mon, 7 Jan 2019 03:08:01 +0000 (19:08 -0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 18 Jan 2019 10:40:24 +0000 (18:40 +0800)
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 <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/shash.c

index 2bffdecf1f837832f444e828e3bb03f9a0ff9cdc..15b369c4745f6e6d7cfd10a5caaf17f20dc93c32 100644 (file)
@@ -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);