Skip to content

Commit 1c2b4ab

Browse files
kimphillherbertx
authored andcommitted
crypto: talitos - don't bad_key in ablkcipher setkey
crypto/ablkcipher.c's setkey() has already checked against the min, max key sizes before it calls here, and all max_keysize assignments in the algorithm template array do not exceed TALITOS_MAX_KEY_SIZE. Signed-off-by: Kim Phillips <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent febec54 commit 1c2b4ab

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

drivers/crypto/talitos.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,22 +1378,11 @@ static int ablkcipher_setkey(struct crypto_ablkcipher *cipher,
13781378
const u8 *key, unsigned int keylen)
13791379
{
13801380
struct talitos_ctx *ctx = crypto_ablkcipher_ctx(cipher);
1381-
struct ablkcipher_alg *alg = crypto_ablkcipher_alg(cipher);
1382-
1383-
if (keylen > TALITOS_MAX_KEY_SIZE)
1384-
goto badkey;
1385-
1386-
if (keylen < alg->min_keysize || keylen > alg->max_keysize)
1387-
goto badkey;
13881381

13891382
memcpy(&ctx->key, key, keylen);
13901383
ctx->keylen = keylen;
13911384

13921385
return 0;
1393-
1394-
badkey:
1395-
crypto_ablkcipher_set_flags(cipher, CRYPTO_TFM_RES_BAD_KEY_LEN);
1396-
return -EINVAL;
13971386
}
13981387

13991388
static void common_nonsnoop_unmap(struct device *dev,

0 commit comments

Comments
 (0)