summaryrefslogtreecommitdiff
path: root/drivers/crypto/ccree/cc_hash.c
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2020-02-11 19:19:05 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2020-02-22 09:25:44 +0800
commite431cc04381708660b321f6c5a5500ea577a903e (patch)
tree08df89de02b650289843979becd1c73861faa950 /drivers/crypto/ccree/cc_hash.c
parent5fabab0d36d333c1d182369c845f6c7546a4afb8 (diff)
crypto: ccree - defer larval_digest_addr init until needed
While the larval digest addresses are not always used in cc_get_plain_hmac_key() and cc_hash_digest(), they are always calculated. Defer their calculations to the points where needed. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/ccree/cc_hash.c')
-rw-r--r--drivers/crypto/ccree/cc_hash.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/crypto/ccree/cc_hash.c b/drivers/crypto/ccree/cc_hash.c
index defeb35a16a6..cebbe2f08f60 100644
--- a/drivers/crypto/ccree/cc_hash.c
+++ b/drivers/crypto/ccree/cc_hash.c
@@ -429,8 +429,7 @@ static int cc_hash_digest(struct ahash_request *req)
bool is_hmac = ctx->is_hmac;
struct cc_crypto_req cc_req = {};
struct cc_hw_desc desc[CC_MAX_HASH_SEQ_LEN];
- cc_sram_addr_t larval_digest_addr =
- cc_larval_digest_addr(ctx->drvdata, ctx->hash_mode);
+ cc_sram_addr_t larval_digest_addr;
int idx = 0;
int rc = 0;
gfp_t flags = cc_gfp_flags(&req->base);
@@ -472,6 +471,8 @@ static int cc_hash_digest(struct ahash_request *req)
set_din_type(&desc[idx], DMA_DLLI, state->digest_buff_dma_addr,
ctx->inter_digestsize, NS_BIT);
} else {
+ larval_digest_addr = cc_larval_digest_addr(ctx->drvdata,
+ ctx->hash_mode);
set_din_sram(&desc[idx], larval_digest_addr,
ctx->inter_digestsize);
}