diff options
author | Tudor Ambarus <tudor.ambarus@freescale.com> | 2014-10-24 15:13:37 (GMT) |
---|---|---|
committer | Matthew Weigel <Matthew.Weigel@freescale.com> | 2014-12-11 18:41:39 (GMT) |
commit | 09a2f8fdd266c06852f5ae09f6c0f4527a2527c4 (patch) | |
tree | 8cbac24ce170082a34a5a919516b68a92aed1e95 | |
parent | 6fde2d6c98cff69b83dce499ecf0f49a2aec4062 (diff) | |
download | linux-fsl-qoriq-09a2f8fdd266c06852f5ae09f6c0f4527a2527c4.tar.xz |
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>
(cherry picked from commit 19167bfd8ae72ceeb41930343227bf8f5fb19a66)
Change-Id: I55797558a79c8113c7e299198f94caea6a0d10b5
Signed-off-by: Tudor Ambarus <tudor.ambarus@freescale.com>
Reviewed-on: http://git.am.freescale.net:8181/23480
Reviewed-by: Horia Ioan Geanta Neag <horia.geanta@freescale.com>
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Richard Schmitt <richard.schmitt@freescale.com>
-rw-r--r-- | drivers/crypto/caam/caamalg.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c index eae83c5..34f7b14 100644 --- a/drivers/crypto/caam/caamalg.c +++ b/drivers/crypto/caam/caamalg.c @@ -2766,7 +2766,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; } |