Skip to content

Commit ee8ac71

Browse files
ebiggersambarus
authored andcommitted
crypto: remove redundant type flags from tfm allocation
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> (cherry picked from commit 85d7311)
1 parent 0457587 commit ee8ac71

6 files changed

Lines changed: 6 additions & 11 deletions

File tree

Documentation/crypto/api-samples.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ Code Example For Use of Operational State Memory With SHASH
194194
char *hash_alg_name = "sha1-padlock-nano";
195195
int ret;
196196

197-
alg = crypto_alloc_shash(hash_alg_name, CRYPTO_ALG_TYPE_SHASH, 0);
197+
alg = crypto_alloc_shash(hash_alg_name, 0, 0);
198198
if (IS_ERR(alg)) {
199199
pr_info("can't alloc alg %s\n", hash_alg_name);
200200
return PTR_ERR(alg);

drivers/crypto/atmel-sha.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2316,9 +2316,7 @@ struct atmel_sha_authenc_ctx *atmel_sha_authenc_spawn(unsigned long mode)
23162316
goto error;
23172317
}
23182318

2319-
tfm = crypto_alloc_ahash(name,
2320-
CRYPTO_ALG_TYPE_AHASH,
2321-
CRYPTO_ALG_TYPE_AHASH_MASK);
2319+
tfm = crypto_alloc_ahash(name, 0, 0);
23222320
if (IS_ERR(tfm)) {
23232321
err = PTR_ERR(tfm);
23242322
goto error;

drivers/crypto/inside-secure/safexcel_hash.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -830,8 +830,7 @@ static int safexcel_hmac_setkey(const char *alg, const u8 *key,
830830
u8 *ipad, *opad;
831831
int ret;
832832

833-
tfm = crypto_alloc_ahash(alg, CRYPTO_ALG_TYPE_AHASH,
834-
CRYPTO_ALG_TYPE_AHASH_MASK);
833+
tfm = crypto_alloc_ahash(alg, 0, 0);
835834
if (IS_ERR(tfm))
836835
return PTR_ERR(tfm);
837836

drivers/crypto/marvell/hash.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,8 +1183,7 @@ static int mv_cesa_ahmac_setkey(const char *hash_alg_name,
11831183
u8 *opad;
11841184
int ret;
11851185

1186-
tfm = crypto_alloc_ahash(hash_alg_name, CRYPTO_ALG_TYPE_AHASH,
1187-
CRYPTO_ALG_TYPE_AHASH_MASK);
1186+
tfm = crypto_alloc_ahash(hash_alg_name, 0, 0);
11881187
if (IS_ERR(tfm))
11891188
return PTR_ERR(tfm);
11901189

drivers/crypto/qce/sha.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,7 @@ static int qce_ahash_hmac_setkey(struct crypto_ahash *tfm, const u8 *key,
394394
else
395395
return -EINVAL;
396396

397-
ahash_tfm = crypto_alloc_ahash(alg_name, CRYPTO_ALG_TYPE_AHASH,
398-
CRYPTO_ALG_TYPE_AHASH_MASK);
397+
ahash_tfm = crypto_alloc_ahash(alg_name, 0, 0);
399398
if (IS_ERR(ahash_tfm))
400399
return PTR_ERR(ahash_tfm);
401400

security/keys/dh.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ long __keyctl_dh_compute(struct keyctl_dh_params __user *params,
324324
if (ret)
325325
goto out3;
326326

327-
tfm = crypto_alloc_kpp("dh", CRYPTO_ALG_TYPE_KPP, 0);
327+
tfm = crypto_alloc_kpp("dh", 0, 0);
328328
if (IS_ERR(tfm)) {
329329
ret = PTR_ERR(tfm);
330330
goto out3;

0 commit comments

Comments
 (0)