crypto: remove redundant type flags from tfm allocation
authorEric Biggers <ebiggers@google.com>
Sat, 30 Jun 2018 22:16:16 +0000 (15:16 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sun, 8 Jul 2018 16:30:29 +0000 (00:30 +0800)
Some crypto API users allocating a tfm with crypto_alloc_$FOO() are also
specifying the type flags for $FOO, e.g. crypto_alloc_shash() with
CRYPTO_ALG_TYPE_SHASH.  But, that's redundant since the crypto API will
override any specified type flag/mask with the correct ones.

So, remove the unneeded flags.

This patch shouldn't change any actual behavior.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Documentation/crypto/api-samples.rst
drivers/crypto/atmel-sha.c
drivers/crypto/inside-secure/safexcel_hash.c
drivers/crypto/marvell/hash.c
drivers/crypto/qce/sha.c
security/keys/dh.c

index 006827e30d0664939d71b716e870ee08c9532852..0f6ca8b7261e9300a0da4542c03846c8e868841e 100644 (file)
@@ -162,7 +162,7 @@ Code Example For Use of Operational State Memory With SHASH
         char *hash_alg_name = "sha1-padlock-nano";
         int ret;
 
-        alg = crypto_alloc_shash(hash_alg_name, CRYPTO_ALG_TYPE_SHASH, 0);
+        alg = crypto_alloc_shash(hash_alg_name, 0, 0);
         if (IS_ERR(alg)) {
                 pr_info("can't alloc alg %s\n", hash_alg_name);
                 return PTR_ERR(alg);
index 4d43081120db1e58d1b92c4d03ec7866abda9e23..8a19df2fba6a3e11d7bbe770a0089d75bdf30017 100644 (file)
@@ -2316,9 +2316,7 @@ struct atmel_sha_authenc_ctx *atmel_sha_authenc_spawn(unsigned long mode)
                goto error;
        }
 
-       tfm = crypto_alloc_ahash(name,
-                                CRYPTO_ALG_TYPE_AHASH,
-                                CRYPTO_ALG_TYPE_AHASH_MASK);
+       tfm = crypto_alloc_ahash(name, 0, 0);
        if (IS_ERR(tfm)) {
                err = PTR_ERR(tfm);
                goto error;
index 83bd49d1249bba5922d1fdaec95f1289b1655b49..6a790f069ebf3e50e62c3ceff169bc46c7a6bf90 100644 (file)
@@ -941,8 +941,7 @@ int safexcel_hmac_setkey(const char *alg, const u8 *key, unsigned int keylen,
        u8 *ipad, *opad;
        int ret;
 
-       tfm = crypto_alloc_ahash(alg, CRYPTO_ALG_TYPE_AHASH,
-                                CRYPTO_ALG_TYPE_AHASH_MASK);
+       tfm = crypto_alloc_ahash(alg, 0, 0);
        if (IS_ERR(tfm))
                return PTR_ERR(tfm);
 
index e34d80b6b7e58b38fc1a8a036809cec35f4d6153..99ff54cc8a15edb8de4a6cefbae7f177f5c48c2a 100644 (file)
@@ -1183,8 +1183,7 @@ static int mv_cesa_ahmac_setkey(const char *hash_alg_name,
        u8 *opad;
        int ret;
 
-       tfm = crypto_alloc_ahash(hash_alg_name, CRYPTO_ALG_TYPE_AHASH,
-                                CRYPTO_ALG_TYPE_AHASH_MASK);
+       tfm = crypto_alloc_ahash(hash_alg_name, 0, 0);
        if (IS_ERR(tfm))
                return PTR_ERR(tfm);
 
index 53227d70d397031c3049385952cfcc41df694ce1..d8a5db11b7ea1f3b3fec471b2cca1e11a84d6d1e 100644 (file)
@@ -378,8 +378,7 @@ static int qce_ahash_hmac_setkey(struct crypto_ahash *tfm, const u8 *key,
        else
                return -EINVAL;
 
-       ahash_tfm = crypto_alloc_ahash(alg_name, CRYPTO_ALG_TYPE_AHASH,
-                                      CRYPTO_ALG_TYPE_AHASH_MASK);
+       ahash_tfm = crypto_alloc_ahash(alg_name, 0, 0);
        if (IS_ERR(ahash_tfm))
                return PTR_ERR(ahash_tfm);
 
index f7403821db7f0aafdec4a2e9a6804b1b8c2a599b..04072cb59a98f29cb7d4f5196a75ee0ef7285301 100644 (file)
@@ -315,7 +315,7 @@ long __keyctl_dh_compute(struct keyctl_dh_params __user *params,
        if (ret)
                goto out3;
 
-       tfm = crypto_alloc_kpp("dh", CRYPTO_ALG_TYPE_KPP, 0);
+       tfm = crypto_alloc_kpp("dh", 0, 0);
        if (IS_ERR(tfm)) {
                ret = PTR_ERR(tfm);
                goto out3;