summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/marvell/tdma.c
diff options
context:
space:
mode:
authorRomain Perier <romain.perier@free-electrons.com>2016-12-14 15:15:07 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2016-12-16 19:59:39 +0800
commit8759fec4af222f338d08f8f1a7ad6a77ca6cb301 (patch)
tree095109417f57fdbc6b2558e827ca8a5bb3f73128 /drivers/crypto/marvell/tdma.c
parent18e615ad87bce9125ef3990377a4a946ec0f21f3 (diff)
downloadlinux-8759fec4af222f338d08f8f1a7ad6a77ca6cb301.tar.bz2
crypto: marvell - Copy IVDIG before launching partial DMA ahash requests
Currently, inner IV/DIGEST data are only copied once into the hash engines and not set explicitly before launching a request that is not a first frag. This is an issue especially when multiple ahash reqs are computed in parallel or chained with cipher request, as the state of the request being computed is not updated into the hash engine. It leads to non-deterministic corrupted digest results. Fixes: commit 2786cee8e50b ("crypto: marvell - Move SRAM I/O operations to step functions") Signed-off-by: Romain Perier <romain.perier@free-electrons.com> Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com> Cc: <stable@vger.kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/marvell/tdma.c')
-rw-r--r--drivers/crypto/marvell/tdma.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/crypto/marvell/tdma.c b/drivers/crypto/marvell/tdma.c
index 4416b88eca70..c76375ff376d 100644
--- a/drivers/crypto/marvell/tdma.c
+++ b/drivers/crypto/marvell/tdma.c
@@ -109,7 +109,14 @@ void mv_cesa_tdma_chain(struct mv_cesa_engine *engine,
last->next = dreq->chain.first;
engine->chain.last = dreq->chain.last;
- if (!(last->flags & CESA_TDMA_BREAK_CHAIN))
+ /*
+ * Break the DMA chain if the CESA_TDMA_BREAK_CHAIN is set on
+ * the last element of the current chain, or if the request
+ * being queued needs the IV regs to be set before lauching
+ * the request.
+ */
+ if (!(last->flags & CESA_TDMA_BREAK_CHAIN) &&
+ !(dreq->chain.first->flags & CESA_TDMA_SET_STATE))
last->next_dma = dreq->chain.first->cur_dma;
}
}