summaryrefslogtreecommitdiff
path: root/drivers/crypto
diff options
context:
space:
mode:
authorTudor Ambarus <tudor.ambarus@freescale.com>2014-10-22 14:27:26 (GMT)
committerMatthew Weigel <Matthew.Weigel@freescale.com>2014-12-11 18:41:55 (GMT)
commit84c4015050a4b0d063d17bfcba62aba637763521 (patch)
tree4cdba3b978b60d4e17fed02cdf24f924264a7918 /drivers/crypto
parent258b7f66e2cc7e7f60327c717e8abb8e6523dbf2 (diff)
downloadlinux-fsl-qoriq-84c4015050a4b0d063d17bfcba62aba637763521.tar.xz
crypto: caam - fix contiguous case for tls with gcm
GCM's expected input sequence is: IV, AAD, text. Signed-off-by: Tudor Ambarus <tudor.ambarus@freescale.com> Change-Id: I35d03818ec559e607182470f0c78097fa6c63f78 Reviewed-on: http://git.am.freescale.net:8181/25434 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Horia Ioan Geanta Neag <horia.geanta@freescale.com> Reviewed-by: Mircea Pop <mircea.pop@freescale.com> Reviewed-by: Matthew Weigel <Matthew.Weigel@freescale.com>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/caam/caamalg.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c
index 6335139..ba0c55a 100644
--- a/drivers/crypto/caam/caamalg.c
+++ b/drivers/crypto/caam/caamalg.c
@@ -2773,6 +2773,7 @@ static void init_tls_job(u32 *sh_desc, dma_addr_t ptr,
u32 out_options = 0, in_options;
dma_addr_t dst_dma, src_dma;
int len, sec4_sg_index = 0;
+ bool is_gcm = false;
#ifdef DEBUG
debug("assoclen %d cryptlen %d authsize %d\n",
@@ -2791,11 +2792,19 @@ static void init_tls_job(u32 *sh_desc, dma_addr_t ptr,
desc_bytes(sh_desc), 1);
#endif
+ if (((ctx->class1_alg_type & OP_ALG_ALGSEL_MASK) ==
+ OP_ALG_ALGSEL_AES) &&
+ ((ctx->class1_alg_type & OP_ALG_AAI_MASK) == OP_ALG_AAI_GCM))
+ is_gcm = true;
+
len = desc_len(sh_desc);
init_job_desc_shared(desc, ptr, len, HDR_SHARE_DEFER | HDR_REVERSE);
if (all_contig) {
- src_dma = sg_dma_address(req->assoc);
+ if (is_gcm)
+ src_dma = edesc->iv_dma;
+ else
+ src_dma = sg_dma_address(req->assoc);
in_options = 0;
} else {
src_dma = edesc->sec4_sg_dma;