Commit 86523487 authored by Phil Sutter's avatar Phil Sutter Committed by Herbert Xu

crypto: mv_cesa - move digest state initialisation to a better place

On one hand, the digest state registers need to be set only when
actually using the crypto engine. On the other hand, there is a check
for ctx->first_hash in mv_process_hash_current() already, so use that.
Signed-off-by: default avatarPhil Sutter <phil.sutter@viprinet.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent cc8d3505
...@@ -342,6 +342,12 @@ static void mv_process_hash_current(int first_block) ...@@ -342,6 +342,12 @@ static void mv_process_hash_current(int first_block)
op.config |= CFG_LAST_FRAG; op.config |= CFG_LAST_FRAG;
else else
op.config |= CFG_MID_FRAG; op.config |= CFG_MID_FRAG;
writel(req_ctx->state[0], cpg->reg + DIGEST_INITIAL_VAL_A);
writel(req_ctx->state[1], cpg->reg + DIGEST_INITIAL_VAL_B);
writel(req_ctx->state[2], cpg->reg + DIGEST_INITIAL_VAL_C);
writel(req_ctx->state[3], cpg->reg + DIGEST_INITIAL_VAL_D);
writel(req_ctx->state[4], cpg->reg + DIGEST_INITIAL_VAL_E);
} }
memcpy(cpg->sram + SRAM_CONFIG, &op, sizeof(struct sec_accel_config)); memcpy(cpg->sram + SRAM_CONFIG, &op, sizeof(struct sec_accel_config));
...@@ -525,14 +531,6 @@ static void mv_start_new_hash_req(struct ahash_request *req) ...@@ -525,14 +531,6 @@ static void mv_start_new_hash_req(struct ahash_request *req)
p->crypt_len = ctx->extra_bytes; p->crypt_len = ctx->extra_bytes;
} }
if (unlikely(!ctx->first_hash)) {
writel(ctx->state[0], cpg->reg + DIGEST_INITIAL_VAL_A);
writel(ctx->state[1], cpg->reg + DIGEST_INITIAL_VAL_B);
writel(ctx->state[2], cpg->reg + DIGEST_INITIAL_VAL_C);
writel(ctx->state[3], cpg->reg + DIGEST_INITIAL_VAL_D);
writel(ctx->state[4], cpg->reg + DIGEST_INITIAL_VAL_E);
}
ctx->extra_bytes = hw_bytes % SHA1_BLOCK_SIZE; ctx->extra_bytes = hw_bytes % SHA1_BLOCK_SIZE;
if (ctx->extra_bytes != 0 if (ctx->extra_bytes != 0
&& (!ctx->last_chunk || ctx->count > MAX_HW_HASH_SIZE)) && (!ctx->last_chunk || ctx->count > MAX_HW_HASH_SIZE))
......
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