linux-stable/drivers/crypto/cavium/nitrox
Eric Biggers 674f368a95 crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN
The CRYPTO_TFM_RES_BAD_KEY_LEN flag was apparently meant as a way to
make the ->setkey() functions provide more information about errors.

However, no one actually checks for this flag, which makes it pointless.

Also, many algorithms fail to set this flag when given a bad length key.
Reviewing just the generic implementations, this is the case for
aes-fixed-time, cbcmac, echainiv, nhpoly1305, pcrypt, rfc3686, rfc4309,
rfc7539, rfc7539esp, salsa20, seqiv, and xcbc.  But there are probably
many more in arch/*/crypto/ and drivers/crypto/.

Some algorithms can even set this flag when the key is the correct
length.  For example, authenc and authencesn set it when the key payload
is malformed in any way (not just a bad length), the atmel-sha and ccree
drivers can set it if a memory allocation fails, and the chelsio driver
sets it for bad auth tag lengths, not just bad key lengths.

So even if someone actually wanted to start checking this flag (which
seems unlikely, since it's been unused for a long time), there would be
a lot of work needed to get it working correctly.  But it would probably
be much better to go back to the drawing board and just define 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 this flag.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2020-01-09 11:30:53 +08:00
..
Kconfig crypto: skcipher - rename the crypto_blkcipher module and kconfig option 2019-11-01 13:42:47 +08:00
Makefile crypto: cavium/nitrox - Added AEAD cipher support 2018-12-23 11:52:44 +08:00
nitrox_aead.c crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN 2020-01-09 11:30:53 +08:00
nitrox_algs.c crypto: cavium/nitrox - Added AEAD cipher support 2018-12-23 11:52:44 +08:00
nitrox_common.h crypto: cavium/nitrox - Added AEAD cipher support 2018-12-23 11:52:44 +08:00
nitrox_csr.h crypto: cavium/nitrox - Configure asymmetric queue manager Hardware unit 2019-08-15 21:52:14 +10:00
nitrox_debugfs.c crypto: cavium/nitrox - Add support for loading asymmetric crypto firmware 2019-07-26 22:08:05 +10:00
nitrox_debugfs.h crypto: cavium/nitrox - Use the correct style for SPDX License Identifier 2019-06-13 14:31:41 +08:00
nitrox_dev.h crypto: cavium/nitrox - Add mailbox message to get mcode info in VF 2019-10-05 01:06:18 +10:00
nitrox_hal.c crypto: cavium/nitrox - Configure asymmetric queue manager Hardware unit 2019-08-15 21:52:14 +10:00
nitrox_hal.h crypto: cavium/nitrox - Configure asymmetric queue manager Hardware unit 2019-08-15 21:52:14 +10:00
nitrox_isr.c crypto: cavium/nitrox - Enabled Mailbox support 2018-12-13 18:24:39 +08:00
nitrox_isr.h crypto: cavium/nitrox - Enable interrups for PF in SR-IOV mode. 2018-11-29 16:27:04 +08:00
nitrox_lib.c crypto: cavium/nitrox - Allocate asymmetric crypto command queues 2019-08-15 21:52:13 +10:00
nitrox_main.c crypto: cavium/nitrox - fix firmware assignment to AE cores 2019-10-05 01:06:20 +10:00
nitrox_mbx.c crypto: cavium/nitrox - Add mailbox message to get mcode info in VF 2019-10-05 01:06:18 +10:00
nitrox_mbx.h crypto: cavium/nitrox - Use the correct style for SPDX License Identifier 2019-06-13 14:31:41 +08:00
nitrox_req.h crypto: cavium/nitrox - Fix cbc ciphers self test failures 2019-10-05 01:06:13 +10:00
nitrox_reqmgr.c drivers: Remove explicit invocations of mmiowb() 2019-04-08 12:01:02 +01:00
nitrox_skcipher.c crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN 2020-01-09 11:30:53 +08:00
nitrox_sriov.c crypto: cavium/nitrox - Configure asymmetric queue manager Hardware unit 2019-08-15 21:52:14 +10:00