kernel_optimize_test/include/crypto
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
..
internal crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN 2020-01-09 11:30:53 +08:00
acompress.h
aead.h crypto: aead - move crypto_aead_maxauthsize() to <crypto/aead.h> 2019-12-11 16:37:00 +08:00
aes.h
akcipher.h
algapi.h crypto: api - Retain alg refcount in crypto_grab_spawn 2019-12-27 18:18:03 +08:00
arc4.h
asym_tpm_subtype.h
authenc.h
b128ops.h
blake2s.h crypto: blake2s - generic C library implementation and selftest 2019-11-17 09:02:42 +08:00
blowfish.h
cast_common.h
cast5.h
cast6.h crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN 2020-01-09 11:30:53 +08:00
cbc.h
chacha.h crypto: x86/chacha - expose SIMD ChaCha routine as library function 2019-11-17 09:02:39 +08:00
chacha20poly1305.h crypto: lib/chacha20poly1305 - reimplement crypt_from_sg() routine 2019-11-17 09:02:44 +08:00
cryptd.h
ctr.h
curve25519.h crypto: curve25519 - generic C library implementations 2019-11-17 09:02:43 +08:00
des.h
dh.h
drbg.h
ecdh.h
engine.h crypto: ablkcipher - remove deprecated and unused ablkcipher support 2019-11-17 09:02:49 +08:00
gcm.h
gf128mul.h
ghash.h
hash_info.h
hash.h crypto: shash - Add init_tfm/exit_tfm and verify descsize 2019-12-11 16:48:39 +08:00
hmac.h
if_alg.h
kpp.h
md5.h
nhpoly1305.h
null.h
padlock.h
pcrypt.h
pkcs7.h
poly1305.h crypto: poly1305 - expose init/update/final library interface 2019-11-17 09:02:41 +08:00
public_key.h
rng.h
scatterwalk.h
serpent.h crypto: x86 - Regularize glue function prototypes 2019-12-11 16:36:54 +08:00
sha.h
sha1_base.h
sha3.h
sha256_base.h
sha512_base.h
skcipher.h crypto: skcipher - add crypto_skcipher_min_keysize() 2019-12-11 16:37:00 +08:00
sm3_base.h
sm3.h
sm4.h
streebog.h
twofish.h crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN 2020-01-09 11:30:53 +08:00
xts.h crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN 2020-01-09 11:30:53 +08:00