diff options
author | Kim Phillips <kim.phillips@freescale.com> | 2011-07-15 11:21:40 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2011-07-15 11:21:40 +0800 |
commit | 1c2b4abb19285368808f303ad61e17b172f1a108 (patch) | |
tree | 7f725e1ae700cef5a98e78aee9e8e806f55cae87 /drivers/crypto/talitos.c | |
parent | febec54286623a540cbe483a5d471ff6576a6e2e (diff) | |
download | lwn-1c2b4abb19285368808f303ad61e17b172f1a108.tar.gz lwn-1c2b4abb19285368808f303ad61e17b172f1a108.zip |
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 <kim.phillips@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/talitos.c')
-rw-r--r-- | drivers/crypto/talitos.c | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index 521244e08fb1..8a0bb417aa11 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c @@ -1378,22 +1378,11 @@ static int ablkcipher_setkey(struct crypto_ablkcipher *cipher, const u8 *key, unsigned int keylen) { struct talitos_ctx *ctx = crypto_ablkcipher_ctx(cipher); - struct ablkcipher_alg *alg = crypto_ablkcipher_alg(cipher); - - if (keylen > TALITOS_MAX_KEY_SIZE) - goto badkey; - - if (keylen < alg->min_keysize || keylen > alg->max_keysize) - goto badkey; memcpy(&ctx->key, key, keylen); ctx->keylen = keylen; return 0; - -badkey: - crypto_ablkcipher_set_flags(cipher, CRYPTO_TFM_RES_BAD_KEY_LEN); - return -EINVAL; } static void common_nonsnoop_unmap(struct device *dev, |