Commit c9877cbc authored by Gilad Ben-Yossef's avatar Gilad Ben-Yossef Committed by Herbert Xu

crypto: ccree - simplify AEAD ICV addr calculation

The function cc_prepare_aead_data_dlli() which calculates ICV addresses
was needlessly complicate it. This patch simplifies it without altering
its functionality.
Signed-off-by: default avatarGilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 6825cfd6
...@@ -749,27 +749,21 @@ static void cc_prepare_aead_data_dlli(struct aead_request *req, ...@@ -749,27 +749,21 @@ static void cc_prepare_aead_data_dlli(struct aead_request *req,
struct aead_req_ctx *areq_ctx = aead_request_ctx(req); struct aead_req_ctx *areq_ctx = aead_request_ctx(req);
enum drv_crypto_direction direct = areq_ctx->gen_ctx.op_type; enum drv_crypto_direction direct = areq_ctx->gen_ctx.op_type;
unsigned int authsize = areq_ctx->req_authsize; unsigned int authsize = areq_ctx->req_authsize;
struct scatterlist *sg;
ssize_t offset;
areq_ctx->is_icv_fragmented = false; areq_ctx->is_icv_fragmented = false;
if (req->src == req->dst) {
/*INPLACE*/ if ((req->src == req->dst) || direct == DRV_CRYPTO_DIRECTION_DECRYPT) {
areq_ctx->icv_dma_addr = sg_dma_address(areq_ctx->src_sgl) + sg = areq_ctx->src_sgl;
(*src_last_bytes - authsize); offset = *src_last_bytes - authsize;
areq_ctx->icv_virt_addr = sg_virt(areq_ctx->src_sgl) +
(*src_last_bytes - authsize);
} else if (direct == DRV_CRYPTO_DIRECTION_DECRYPT) {
/*NON-INPLACE and DECRYPT*/
areq_ctx->icv_dma_addr = sg_dma_address(areq_ctx->src_sgl) +
(*src_last_bytes - authsize);
areq_ctx->icv_virt_addr = sg_virt(areq_ctx->src_sgl) +
(*src_last_bytes - authsize);
} else { } else {
/*NON-INPLACE and ENCRYPT*/ sg = areq_ctx->dst_sgl;
areq_ctx->icv_dma_addr = sg_dma_address(areq_ctx->dst_sgl) + offset = *dst_last_bytes - authsize;
(*dst_last_bytes - authsize);
areq_ctx->icv_virt_addr = sg_virt(areq_ctx->dst_sgl) +
(*dst_last_bytes - authsize);
} }
areq_ctx->icv_dma_addr = sg_dma_address(sg) + offset;
areq_ctx->icv_virt_addr = sg_virt(sg) + offset;
} }
static void cc_prepare_aead_data_mlli(struct cc_drvdata *drvdata, static void cc_prepare_aead_data_mlli(struct cc_drvdata *drvdata,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment