linux/drivers/crypto/caam
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
..
caamalg_desc.c crypto: caam - update rfc4106 sh desc to support zero length input 2019-08-09 15:11:48 +10:00
caamalg_desc.h crypto: caam - update rfc4106 sh desc to support zero length input 2019-08-09 15:11:48 +10:00
caamalg_qi2.c crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN 2020-01-09 11:30:53 +08:00
caamalg_qi2.h crypto: caam - share definition for MAX_SDLEN 2019-08-30 18:05:29 +10:00
caamalg_qi.c crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN 2020-01-09 11:30:53 +08:00
caamalg.c crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN 2020-01-09 11:30:53 +08:00
caamhash_desc.c crypto: caam - keep both virtual and dma key addresses 2019-08-09 15:11:49 +10:00
caamhash_desc.h crypto: caam - keep both virtual and dma key addresses 2019-08-09 15:11:49 +10:00
caamhash.c crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN 2020-01-09 11:30:53 +08:00
caampkc.c crypto: caam - use mapped_{src,dst}_nents for descriptor 2019-10-05 01:06:21 +10:00
caampkc.h crypto: caam - use mapped_{src,dst}_nents for descriptor 2019-10-05 01:06:21 +10:00
caamrng.c crypto: caam - make CAAM_PTR_SZ dynamic 2019-08-30 18:05:30 +10:00
compat.h crypto: caam/des - switch to new verification routines 2019-08-22 14:39:39 +10:00
ctrl.c crypto: caam - Add support for i.MX8M Mini 2019-12-27 18:18:03 +08:00
ctrl.h crypto: caam - staticize caam_get_era() 2018-04-21 00:58:36 +08:00
desc_constr.h crypto: caam - select DMA address size at runtime 2019-08-30 18:05:30 +10:00
desc.h crypto: caam - fix SHA support detection 2019-01-10 21:37:31 +08:00
dpseci_cmd.h crypto: caam - add DPAA2-CAAM (DPSECI) backend API 2018-09-21 13:24:51 +08:00
dpseci-debugfs.c crypto: caam/qi2 - Add printing dpseci fq stats using debugfs 2019-08-02 14:44:01 +10:00
dpseci-debugfs.h crypto: caam/qi2 - Add printing dpseci fq stats using debugfs 2019-08-02 14:44:01 +10:00
dpseci.c crypto: caam - add DPAA2-CAAM (DPSECI) backend API 2018-09-21 13:24:51 +08:00
dpseci.h crypto: caam - add DPAA2-CAAM (DPSECI) backend API 2018-09-21 13:24:51 +08:00
error.c crypto: caam - make CAAM_PTR_SZ dynamic 2019-08-30 18:05:30 +10:00
error.h crypto: caam - fix return code in completion callbacks 2019-08-09 15:11:45 +10:00
intern.h crypto: caam - use devres to de-initialize QI 2019-11-01 13:38:30 +08:00
jr.c crypto: caam - Cast to long first before pointer conversion 2019-09-13 21:20:47 +10:00
jr.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Kconfig crypto: Kconfig - Fix indentation 2019-12-11 16:36:05 +08:00
key_gen.c crypto: caam - fix MDHA key derivation for certain user key lengths 2019-08-09 15:11:49 +10:00
key_gen.h crypto: caam - add Derived Key Protocol (DKP) support 2017-12-28 17:56:48 +11:00
Makefile crypto: caam/qi2 - Add printing dpseci fq stats using debugfs 2019-08-02 14:44:01 +10:00
pdb.h crypto: caam - select DMA address size at runtime 2019-08-30 18:05:30 +10:00
pkc_desc.c crypto: caam - select DMA address size at runtime 2019-08-30 18:05:30 +10:00
qi.c crypto: caam - use devres to de-initialize QI 2019-11-01 13:38:30 +08:00
qi.h crypto: caam - use devres to de-initialize QI 2019-11-01 13:38:30 +08:00
regs.h crypto: caam - select DMA address size at runtime 2019-08-30 18:05:30 +10:00
sg_sw_qm2.h crypto: caam - use len instead of nents for bulding HW S/G table 2019-06-20 14:18:33 +08:00
sg_sw_qm.h crypto: caam - use len instead of nents for bulding HW S/G table 2019-06-20 14:18:33 +08:00
sg_sw_sec4.h crypto: caam - use len instead of nents for bulding HW S/G table 2019-06-20 14:18:33 +08:00