linux/drivers/crypto/ccree
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
..
cc_aead.c crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN 2020-01-09 11:30:53 +08:00
cc_aead.h crypto: ccree - drop legacy ivgen support 2019-07-26 14:51:55 +10:00
cc_buffer_mgr.c crypto: ccree - use std api sg_zero_buffer 2019-08-09 15:05:31 +10:00
cc_buffer_mgr.h crypto: ccree - use std api sg_zero_buffer 2019-08-09 15:05:31 +10:00
cc_cipher.c crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN 2020-01-09 11:30:53 +08:00
cc_cipher.h crypto: ccree - copyright header update 2019-04-25 15:38:14 +08:00
cc_crypto_ctx.h crypto: ccree - copyright header update 2019-04-25 15:38:14 +08:00
cc_debugfs.c crypto: ccree - fix typo in debugfs error path 2019-04-25 15:38:14 +08:00
cc_debugfs.h crypto: ccree - copyright header update 2019-04-25 15:38:14 +08:00
cc_driver.c crypto: ccree - fix typos in error msgs 2019-12-11 16:36:55 +08:00
cc_driver.h crypto: ccree - remove useless define 2019-12-11 16:36:54 +08:00
cc_fips.c crypto: ccree - fix typos in comments 2019-12-11 16:36:54 +08:00
cc_fips.h crypto: ccree - add function to handle cryptocell tee fips error 2019-04-25 15:38:16 +08:00
cc_hash.c crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN 2020-01-09 11:30:53 +08:00
cc_hash.h crypto: ccree - copyright header update 2019-04-25 15:38:14 +08:00
cc_host_regs.h crypto: ccree - add HW engine config check 2019-06-27 14:28:00 +08:00
cc_hw_queue_defs.h crypto: ccree - copyright header update 2019-04-25 15:38:14 +08:00
cc_kernel_regs.h crypto: ccree - copyright header update 2019-04-25 15:38:14 +08:00
cc_lli_defs.h crypto: ccree - allow more AEAD assoc data fragments 2019-04-25 15:38:15 +08:00
cc_pm.c crypto: ccree - fix typos in comments 2019-12-11 16:36:54 +08:00
cc_pm.h crypto: ccree - prevent isr handling in case driver is suspended 2019-06-27 14:28:00 +08:00
cc_request_mgr.c crypto: ccree - fix backlog memory leak 2019-12-11 16:36:55 +08:00
cc_request_mgr.h crypto: ccree - copyright header update 2019-04-25 15:38:14 +08:00
cc_sram_mgr.c crypto: ccree - copyright header update 2019-04-25 15:38:14 +08:00
cc_sram_mgr.h crypto: ccree - copyright header update 2019-04-25 15:38:14 +08:00
Makefile crypto: ccree - drop legacy ivgen support 2019-07-26 14:51:55 +10:00