diff options
author | Victoria Milhoan <vicki.milhoan@freescale.com> | 2015-06-15 23:52:57 (GMT) |
---|---|---|
committer | Alex Porosanu <alexandru.porosanu@freescale.com> | 2015-11-03 09:49:46 (GMT) |
commit | 16d4087fef605b53c187e6f059747c8c31b93df1 (patch) | |
tree | 0f755a93951dd31fb462e061a6b2be96eb52be10 | |
parent | 270c77083258df3d3be4664bfdfaf832ba08d67b (diff) | |
download | linux-fsl-qoriq-16d4087fef605b53c187e6f059747c8c31b93df1.tar.xz |
crypto: caam - Fix incorrect size when DMA unmapping buffer
The CAAM driver uses two data buffers to store data for a hashing operation,
with one buffer defined as active. This change forces switching of the
active buffer when executing a hashing operation to avoid a later DMA unmap
using the length of the opposite buffer.
Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
(cherry picked from commit 8af7b0f809a3d34657433ec545d64dff9808ce34)
-rw-r--r-- | drivers/crypto/caam/caamhash.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c index 27cefaa..8b22117 100644 --- a/drivers/crypto/caam/caamhash.c +++ b/drivers/crypto/caam/caamhash.c @@ -835,17 +835,17 @@ static int ahash_update_ctx(struct ahash_request *req) src_map_to_sec4_sg(jrdev, req->src, src_nents, edesc->sec4_sg + sec4_sg_src_index, chained); - if (*next_buflen) { + if (*next_buflen) scatterwalk_map_and_copy(next_buf, req->src, to_hash - *buflen, *next_buflen, 0); - state->current_buf = !state->current_buf; - } } else { (edesc->sec4_sg + sec4_sg_src_index - 1)->len |= SEC4_SG_LEN_FIN; } + state->current_buf = !state->current_buf; + sh_len = desc_len(sh_desc); desc = edesc->hw_desc; init_job_desc_shared(desc, ptr, sh_len, HDR_SHARE_DEFER | @@ -1268,9 +1268,10 @@ static int ahash_update_no_ctx(struct ahash_request *req) scatterwalk_map_and_copy(next_buf, req->src, to_hash - *buflen, *next_buflen, 0); - state->current_buf = !state->current_buf; } + state->current_buf = !state->current_buf; + sh_len = desc_len(sh_desc); desc = edesc->hw_desc; init_job_desc_shared(desc, ptr, sh_len, HDR_SHARE_DEFER | |