summaryrefslogtreecommitdiffstats
path: root/drivers/crypto
diff options
context:
space:
mode:
authorChristophe Leroy <christophe.leroy@c-s.fr>2019-05-15 12:29:03 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-07-26 09:10:13 +0200
commit589af2ad708b2f3461d00c8a4b93e5e2fd2a5dc9 (patch)
treeddec0563941cd881c96d3fcc7c38215451cf61d4 /drivers/crypto
parent28eb23321a658e248f0143e5b4d27f1c51e40394 (diff)
downloadlinux-stable-589af2ad708b2f3461d00c8a4b93e5e2fd2a5dc9.tar.gz
linux-stable-589af2ad708b2f3461d00c8a4b93e5e2fd2a5dc9.tar.bz2
linux-stable-589af2ad708b2f3461d00c8a4b93e5e2fd2a5dc9.zip
crypto: talitos - fix skcipher failure due to wrong output IV
[ Upstream commit 3e03e792865ae48b8cfc69a0b4d65f02f467389f ] Selftests report the following: [ 2.984845] alg: skcipher: cbc-aes-talitos encryption test failed (wrong output IV) on test vector 0, cfg="in-place" [ 2.995377] 00000000: 3d af ba 42 9d 9e b4 30 b4 22 da 80 2c 9f ac 41 [ 3.032673] alg: skcipher: cbc-des-talitos encryption test failed (wrong output IV) on test vector 0, cfg="in-place" [ 3.043185] 00000000: fe dc ba 98 76 54 32 10 [ 3.063238] alg: skcipher: cbc-3des-talitos encryption test failed (wrong output IV) on test vector 0, cfg="in-place" [ 3.073818] 00000000: 7d 33 88 93 0f 93 b2 42 This above dumps show that the actual output IV is indeed the input IV. This is due to the IV not being copied back into the request. This patch fixes that. Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Reviewed-by: Horia Geantă <horia.geanta@nxp.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/talitos.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index 8c57c5af0930..396199b2db7d 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -1606,11 +1606,15 @@ static void ablkcipher_done(struct device *dev,
int err)
{
struct ablkcipher_request *areq = context;
+ struct crypto_ablkcipher *cipher = crypto_ablkcipher_reqtfm(areq);
+ struct talitos_ctx *ctx = crypto_ablkcipher_ctx(cipher);
+ unsigned int ivsize = crypto_ablkcipher_ivsize(cipher);
struct talitos_edesc *edesc;
edesc = container_of(desc, struct talitos_edesc, desc);
common_nonsnoop_unmap(dev, edesc, areq);
+ memcpy(areq->info, ctx->iv, ivsize);
kfree(edesc);