summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTudor Ambarus <tudor.ambarus@freescale.com>2014-10-24 17:13:37 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2014-11-06 16:15:00 +0100
commit19167bfd8ae72ceeb41930343227bf8f5fb19a66 (patch)
tree85be83b386b3b5180731faff2977a9448157281b /drivers
parentcrypto: qat - Move BAR definitions to device specific module (diff)
downloadlinux-19167bfd8ae72ceeb41930343227bf8f5fb19a66.tar.xz
linux-19167bfd8ae72ceeb41930343227bf8f5fb19a66.zip
crypto: caam - fix output sequence contiguity check
This patch fixes the assumption that output sequence is not contiguous when input sequence is not contiguous and in-place encryption is done. Output sequence does not need to be contiguous with associated data. Signed-off-by: Tudor Ambarus <tudor.ambarus@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r--drivers/crypto/caam/caamalg.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c
index c17154c32031..36434d9eefad 100644
--- a/drivers/crypto/caam/caamalg.c
+++ b/drivers/crypto/caam/caamalg.c
@@ -2185,7 +2185,8 @@ static struct aead_edesc *aead_giv_edesc_alloc(struct aead_givcrypt_request
assoc_nents = assoc_nents ? : 1;
src_nents = src_nents ? : 1;
sec4_sg_len += assoc_nents + 1 + src_nents;
- if (likely(req->src == req->dst))
+ if (req->src == req->dst &&
+ (src_nents || iv_dma + ivsize != sg_dma_address(req->src)))
contig &= ~GIV_DST_CONTIG;
}