ipq40xx: qce - add fixes for AES ciphers
[openwrt/staging/dedeckeh.git] / target / linux / ipq40xx / patches-5.4 / 044-crypto-qce-update-the-skcipher-IV.patch
1 From 3e806a12d10af2581aa26c37b58439286eab9782 Mon Sep 17 00:00:00 2001
2 From: Eneas U de Queiroz <cotequeiroz@gmail.com>
3 Date: Fri, 20 Dec 2019 16:02:16 -0300
4 Subject: [PATCH 05/11] crypto: qce - update the skcipher IV
5
6 Update the IV after the completion of each cipher operation.
7
8 Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
9 Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
10 ---
11 drivers/crypto/qce/skcipher.c | 2 ++
12 1 file changed, 2 insertions(+)
13
14 --- a/drivers/crypto/qce/skcipher.c
15 +++ b/drivers/crypto/qce/skcipher.c
16 @@ -21,6 +21,7 @@ static void qce_skcipher_done(void *data
17 struct qce_cipher_reqctx *rctx = skcipher_request_ctx(req);
18 struct qce_alg_template *tmpl = to_cipher_tmpl(crypto_skcipher_reqtfm(req));
19 struct qce_device *qce = tmpl->qce;
20 + struct qce_result_dump *result_buf = qce->dma.result_buf;
21 enum dma_data_direction dir_src, dir_dst;
22 u32 status;
23 int error;
24 @@ -45,6 +46,7 @@ static void qce_skcipher_done(void *data
25 if (error < 0)
26 dev_dbg(qce->dev, "skcipher operation error (%x)\n", status);
27
28 + memcpy(rctx->iv, result_buf->encr_cntr_iv, rctx->ivsize);
29 qce->async_req_done(tmpl->qce, error);
30 }
31