WSL2-Linux-Kernel/drivers/crypto/ccp
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: ccp - add TEE support for Raven Ridge 2019-12-20 14:58:32 +08:00
ccp-crypto-aes-cmac.c crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN 2020-01-09 11:30:53 +08:00
ccp-crypto-aes-galois.c crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN 2020-01-09 11:30:53 +08:00
ccp-crypto-aes-xts.c crypto: ccp - switch from ablkcipher to skcipher 2019-11-17 09:02:45 +08:00
ccp-crypto-aes.c crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN 2020-01-09 11:30:53 +08:00
ccp-crypto-des3.c crypto: ccp - switch from ablkcipher to skcipher 2019-11-17 09:02:45 +08:00
ccp-crypto-main.c crypto: ccp - switch from ablkcipher to skcipher 2019-11-17 09:02:45 +08:00
ccp-crypto-rsa.c crypto: ccp - Switch to SPDX license identifiers 2019-07-03 22:13:12 +08:00
ccp-crypto-sha.c crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN 2020-01-09 11:30:53 +08:00
ccp-crypto.h crypto: ccp - switch from ablkcipher to skcipher 2019-11-17 09:02:45 +08:00
ccp-debugfs.c crypto: ccp - Switch to SPDX license identifiers 2019-07-03 22:13:12 +08:00
ccp-dev-v3.c crypto: ccp - set max RSA modulus size for v3 platform devices as well 2019-12-11 16:36:55 +08:00
ccp-dev-v5.c crypto: ccp - Verify access to device registers before initializing 2019-10-26 02:09:59 +11:00
ccp-dev.c crypto: ccp - Change a message to reflect status instead of failure 2019-10-26 02:09:59 +11:00
ccp-dev.h crypto: ccp - Remove unnecessary linux/pci.h include 2019-08-09 15:12:30 +10:00
ccp-dmaengine.c crypto: ccp - fix uninitialized list head 2019-10-26 02:10:00 +11:00
ccp-ops.c crypto: ccp - Release all allocated memory if sha type is invalid 2019-10-05 01:06:20 +10:00
psp-dev.c crypto: ccp - add TEE support for Raven Ridge 2019-12-20 14:58:32 +08:00
psp-dev.h crypto: ccp - add TEE support for Raven Ridge 2019-12-20 14:58:32 +08:00
sev-dev.c crypto: ccp - move SEV vdata to a dedicated data structure 2019-12-20 14:58:32 +08:00
sev-dev.h crypto: ccp - move SEV vdata to a dedicated data structure 2019-12-20 14:58:32 +08:00
sp-dev.c crypto: ccp - Switch to SPDX license identifiers 2019-07-03 22:13:12 +08:00
sp-dev.h crypto: ccp - add TEE support for Raven Ridge 2019-12-20 14:58:32 +08:00
sp-pci.c crypto: ccp - add TEE support for Raven Ridge 2019-12-20 14:58:32 +08:00
sp-platform.c crypto: ccp - use devm_platform_ioremap_resource() to simplify code 2019-08-09 15:11:59 +10:00
tee-dev.c tee: amdtee: check TEE status during driver initialization 2020-01-04 13:49:51 +08:00
tee-dev.h crypto: ccp - provide in-kernel API to submit TEE commands 2019-12-20 14:58:32 +08:00