path: root/crypto/cipher.c
diff options
authorEric Biggers <>2019-12-30 21:19:38 -0600
committerHerbert Xu <>2020-01-09 11:30:53 +0800
commitaf5034e8e4a5838fc77e476c1a91822e449d5869 (patch)
treef561a8db9f88931072210330128fed231e3b8b0b /crypto/cipher.c
parentc4c4db0d59774f6ab726edd012711490437345c2 (diff)
crypto: remove propagation of CRYPTO_TFM_RES_* flags
The CRYPTO_TFM_RES_* flags were apparently meant as a way to make the ->setkey() functions provide more information about errors. But these flags weren't actually being used or tested, and in many cases they weren't being set correctly anyway. So they've now been removed. Also, if someone ever actually needs to start better distinguishing ->setkey() errors (which is somewhat unlikely, as this has been unneeded for a long time), we'd be much better off just defining different return values, like -EINVAL if the key is invalid for the algorithm vs. -EKEYREJECTED if the key was rejected by a policy like "no weak keys". That would be much simpler, less error-prone, and easier to test. So just remove CRYPTO_TFM_RES_MASK and all the unneeded logic that propagates these flags around. Signed-off-by: Eric Biggers <> Signed-off-by: Herbert Xu <>
Diffstat (limited to 'crypto/cipher.c')
1 files changed, 0 insertions, 1 deletions
diff --git a/crypto/cipher.c b/crypto/cipher.c
index 0fb7042a709d..fd78150deb1c 100644
--- a/crypto/cipher.c
+++ b/crypto/cipher.c
@@ -45,7 +45,6 @@ int crypto_cipher_setkey(struct crypto_cipher *tfm,
struct cipher_alg *cia = crypto_cipher_alg(tfm);
unsigned long alignmask = crypto_cipher_alignmask(tfm);
- crypto_cipher_clear_flags(tfm, CRYPTO_TFM_RES_MASK);
if (keylen < cia->cia_min_keysize || keylen > cia->cia_max_keysize)
return -EINVAL;