Skip to content

Commit

Permalink
crypto: mv_cesa - fix hashing of chunks > 1920 bytes
Browse files Browse the repository at this point in the history
This was broken by commit 7759995 (yes,
myself). The basic problem here is since the digest state is only saved
after the last chunk, the state array is only valid when handling the
first chunk of the next buffer. Broken since linux-3.0.

Signed-off-by: Phil Sutter <[email protected]>
Cc: <[email protected]> # 3.1.x
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
Phil Sutter authored and herbertx committed Nov 21, 2011
1 parent 3acc847 commit 2742528
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions drivers/crypto/mv_cesa.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,11 +342,13 @@ static void mv_process_hash_current(int first_block)
else
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);
if (first_block) {
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));
Expand Down

0 comments on commit 2742528

Please sign in to comment.