ipq40xx: qce - add fixes for AES ciphers
[openwrt/openwrt.git] / target / linux / ipq40xx / patches-4.19 / 044-crypto-qce-update-the-skcipher-IV.patch
1 From 502ca0b7c1d856a46dbd78e67690c12c47775b97 Mon Sep 17 00:00:00 2001
2 From: Eneas U de Queiroz <cotequeiroz@gmail.com>
3 Date: Fri, 22 Nov 2019 09:00:02 -0300
4 Subject: [PATCH] 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
10 --- a/drivers/crypto/qce/skcipher.c
11 +++ b/drivers/crypto/qce/skcipher.c
12 @@ -29,6 +29,7 @@ static void qce_skcipher_done(void *data
13 struct qce_cipher_reqctx *rctx = skcipher_request_ctx(req);
14 struct qce_alg_template *tmpl = to_cipher_tmpl(crypto_skcipher_reqtfm(req));
15 struct qce_device *qce = tmpl->qce;
16 + struct qce_result_dump *result_buf = qce->dma.result_buf;
17 enum dma_data_direction dir_src, dir_dst;
18 u32 status;
19 int error;
20 @@ -53,6 +54,7 @@ static void qce_skcipher_done(void *data
21 if (error < 0)
22 dev_dbg(qce->dev, "skcipher operation error (%x)\n", status);
23
24 + memcpy(rctx->iv, result_buf->encr_cntr_iv, rctx->ivsize);
25 qce->async_req_done(tmpl->qce, error);
26 }
27