diff options
Diffstat (limited to 'drivers/crypto/caam/caamhash.c')
-rw-r--r-- | drivers/crypto/caam/caamhash.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c index b464d03ebf40..f347ab7eea95 100644 --- a/drivers/crypto/caam/caamhash.c +++ b/drivers/crypto/caam/caamhash.c | |||
@@ -836,8 +836,9 @@ static int ahash_update_ctx(struct ahash_request *req) | |||
836 | edesc->sec4_sg + sec4_sg_src_index, | 836 | edesc->sec4_sg + sec4_sg_src_index, |
837 | chained); | 837 | chained); |
838 | if (*next_buflen) { | 838 | if (*next_buflen) { |
839 | sg_copy_part(next_buf, req->src, to_hash - | 839 | scatterwalk_map_and_copy(next_buf, req->src, |
840 | *buflen, req->nbytes); | 840 | to_hash - *buflen, |
841 | *next_buflen, 0); | ||
841 | state->current_buf = !state->current_buf; | 842 | state->current_buf = !state->current_buf; |
842 | } | 843 | } |
843 | } else { | 844 | } else { |
@@ -878,7 +879,8 @@ static int ahash_update_ctx(struct ahash_request *req) | |||
878 | kfree(edesc); | 879 | kfree(edesc); |
879 | } | 880 | } |
880 | } else if (*next_buflen) { | 881 | } else if (*next_buflen) { |
881 | sg_copy(buf + *buflen, req->src, req->nbytes); | 882 | scatterwalk_map_and_copy(buf + *buflen, req->src, 0, |
883 | req->nbytes, 0); | ||
882 | *buflen = *next_buflen; | 884 | *buflen = *next_buflen; |
883 | *next_buflen = last_buflen; | 885 | *next_buflen = last_buflen; |
884 | } | 886 | } |
@@ -1262,8 +1264,9 @@ static int ahash_update_no_ctx(struct ahash_request *req) | |||
1262 | src_map_to_sec4_sg(jrdev, req->src, src_nents, | 1264 | src_map_to_sec4_sg(jrdev, req->src, src_nents, |
1263 | edesc->sec4_sg + 1, chained); | 1265 | edesc->sec4_sg + 1, chained); |
1264 | if (*next_buflen) { | 1266 | if (*next_buflen) { |
1265 | sg_copy_part(next_buf, req->src, to_hash - *buflen, | 1267 | scatterwalk_map_and_copy(next_buf, req->src, |
1266 | req->nbytes); | 1268 | to_hash - *buflen, |
1269 | *next_buflen, 0); | ||
1267 | state->current_buf = !state->current_buf; | 1270 | state->current_buf = !state->current_buf; |
1268 | } | 1271 | } |
1269 | 1272 | ||
@@ -1304,7 +1307,8 @@ static int ahash_update_no_ctx(struct ahash_request *req) | |||
1304 | kfree(edesc); | 1307 | kfree(edesc); |
1305 | } | 1308 | } |
1306 | } else if (*next_buflen) { | 1309 | } else if (*next_buflen) { |
1307 | sg_copy(buf + *buflen, req->src, req->nbytes); | 1310 | scatterwalk_map_and_copy(buf + *buflen, req->src, 0, |
1311 | req->nbytes, 0); | ||
1308 | *buflen = *next_buflen; | 1312 | *buflen = *next_buflen; |
1309 | *next_buflen = 0; | 1313 | *next_buflen = 0; |
1310 | } | 1314 | } |
@@ -1413,9 +1417,9 @@ static int ahash_update_first(struct ahash_request *req) | |||
1413 | struct device *jrdev = ctx->jrdev; | 1417 | struct device *jrdev = ctx->jrdev; |
1414 | gfp_t flags = (req->base.flags & (CRYPTO_TFM_REQ_MAY_BACKLOG | | 1418 | gfp_t flags = (req->base.flags & (CRYPTO_TFM_REQ_MAY_BACKLOG | |
1415 | CRYPTO_TFM_REQ_MAY_SLEEP)) ? GFP_KERNEL : GFP_ATOMIC; | 1419 | CRYPTO_TFM_REQ_MAY_SLEEP)) ? GFP_KERNEL : GFP_ATOMIC; |
1416 | u8 *next_buf = state->buf_0 + state->current_buf * | 1420 | u8 *next_buf = state->current_buf ? state->buf_1 : state->buf_0; |
1417 | CAAM_MAX_HASH_BLOCK_SIZE; | 1421 | int *next_buflen = state->current_buf ? |
1418 | int *next_buflen = &state->buflen_0 + state->current_buf; | 1422 | &state->buflen_1 : &state->buflen_0; |
1419 | int to_hash; | 1423 | int to_hash; |
1420 | u32 *sh_desc = ctx->sh_desc_update_first, *desc; | 1424 | u32 *sh_desc = ctx->sh_desc_update_first, *desc; |
1421 | dma_addr_t ptr = ctx->sh_desc_update_first_dma; | 1425 | dma_addr_t ptr = ctx->sh_desc_update_first_dma; |
@@ -1476,7 +1480,8 @@ static int ahash_update_first(struct ahash_request *req) | |||
1476 | } | 1480 | } |
1477 | 1481 | ||
1478 | if (*next_buflen) | 1482 | if (*next_buflen) |
1479 | sg_copy_part(next_buf, req->src, to_hash, req->nbytes); | 1483 | scatterwalk_map_and_copy(next_buf, req->src, to_hash, |
1484 | *next_buflen, 0); | ||
1480 | 1485 | ||
1481 | sh_len = desc_len(sh_desc); | 1486 | sh_len = desc_len(sh_desc); |
1482 | desc = edesc->hw_desc; | 1487 | desc = edesc->hw_desc; |
@@ -1511,7 +1516,8 @@ static int ahash_update_first(struct ahash_request *req) | |||
1511 | state->update = ahash_update_no_ctx; | 1516 | state->update = ahash_update_no_ctx; |
1512 | state->finup = ahash_finup_no_ctx; | 1517 | state->finup = ahash_finup_no_ctx; |
1513 | state->final = ahash_final_no_ctx; | 1518 | state->final = ahash_final_no_ctx; |
1514 | sg_copy(next_buf, req->src, req->nbytes); | 1519 | scatterwalk_map_and_copy(next_buf, req->src, 0, |
1520 | req->nbytes, 0); | ||
1515 | } | 1521 | } |
1516 | #ifdef DEBUG | 1522 | #ifdef DEBUG |
1517 | print_hex_dump(KERN_ERR, "next buf@"__stringify(__LINE__)": ", | 1523 | print_hex_dump(KERN_ERR, "next buf@"__stringify(__LINE__)": ", |