diff options
-rw-r--r-- | drivers/crypto/caam/caamhash.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c index dae1e8099969..f9c78751989e 100644 --- a/drivers/crypto/caam/caamhash.c +++ b/drivers/crypto/caam/caamhash.c | |||
@@ -909,13 +909,14 @@ static int ahash_final_ctx(struct ahash_request *req) | |||
909 | state->buflen_1; | 909 | state->buflen_1; |
910 | u32 *sh_desc = ctx->sh_desc_fin, *desc; | 910 | u32 *sh_desc = ctx->sh_desc_fin, *desc; |
911 | dma_addr_t ptr = ctx->sh_desc_fin_dma; | 911 | dma_addr_t ptr = ctx->sh_desc_fin_dma; |
912 | int sec4_sg_bytes; | 912 | int sec4_sg_bytes, sec4_sg_src_index; |
913 | int digestsize = crypto_ahash_digestsize(ahash); | 913 | int digestsize = crypto_ahash_digestsize(ahash); |
914 | struct ahash_edesc *edesc; | 914 | struct ahash_edesc *edesc; |
915 | int ret = 0; | 915 | int ret = 0; |
916 | int sh_len; | 916 | int sh_len; |
917 | 917 | ||
918 | sec4_sg_bytes = (1 + (buflen ? 1 : 0)) * sizeof(struct sec4_sg_entry); | 918 | sec4_sg_src_index = 1 + (buflen ? 1 : 0); |
919 | sec4_sg_bytes = sec4_sg_src_index * sizeof(struct sec4_sg_entry); | ||
919 | 920 | ||
920 | /* allocate space for base edesc and hw desc commands, link tables */ | 921 | /* allocate space for base edesc and hw desc commands, link tables */ |
921 | edesc = kmalloc(sizeof(struct ahash_edesc) + DESC_JOB_IO_LEN + | 922 | edesc = kmalloc(sizeof(struct ahash_edesc) + DESC_JOB_IO_LEN + |
@@ -942,7 +943,7 @@ static int ahash_final_ctx(struct ahash_request *req) | |||
942 | state->buf_dma = try_buf_map_to_sec4_sg(jrdev, edesc->sec4_sg + 1, | 943 | state->buf_dma = try_buf_map_to_sec4_sg(jrdev, edesc->sec4_sg + 1, |
943 | buf, state->buf_dma, buflen, | 944 | buf, state->buf_dma, buflen, |
944 | last_buflen); | 945 | last_buflen); |
945 | (edesc->sec4_sg + sec4_sg_bytes - 1)->len |= SEC4_SG_LEN_FIN; | 946 | (edesc->sec4_sg + sec4_sg_src_index - 1)->len |= SEC4_SG_LEN_FIN; |
946 | 947 | ||
947 | edesc->sec4_sg_dma = dma_map_single(jrdev, edesc->sec4_sg, | 948 | edesc->sec4_sg_dma = dma_map_single(jrdev, edesc->sec4_sg, |
948 | sec4_sg_bytes, DMA_TO_DEVICE); | 949 | sec4_sg_bytes, DMA_TO_DEVICE); |