Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: mv_cesa - fix hashing of chunks > 1920 bytes

This was broken by commit 7759995c75ae0cbd4c861582908449f6b6208e7a (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 <phil.sutter@viprinet.com>
Cc: <stable@kernel.org> # 3.1.x
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Phil Sutter and committed by
Herbert Xu
27425286 3acc8473

+7 -5
+7 -5
drivers/crypto/mv_cesa.c
··· 342 342 else 343 343 op.config |= CFG_MID_FRAG; 344 344 345 - writel(req_ctx->state[0], cpg->reg + DIGEST_INITIAL_VAL_A); 346 - writel(req_ctx->state[1], cpg->reg + DIGEST_INITIAL_VAL_B); 347 - writel(req_ctx->state[2], cpg->reg + DIGEST_INITIAL_VAL_C); 348 - writel(req_ctx->state[3], cpg->reg + DIGEST_INITIAL_VAL_D); 349 - writel(req_ctx->state[4], cpg->reg + DIGEST_INITIAL_VAL_E); 345 + if (first_block) { 346 + writel(req_ctx->state[0], cpg->reg + DIGEST_INITIAL_VAL_A); 347 + writel(req_ctx->state[1], cpg->reg + DIGEST_INITIAL_VAL_B); 348 + writel(req_ctx->state[2], cpg->reg + DIGEST_INITIAL_VAL_C); 349 + writel(req_ctx->state[3], cpg->reg + DIGEST_INITIAL_VAL_D); 350 + writel(req_ctx->state[4], cpg->reg + DIGEST_INITIAL_VAL_E); 351 + } 350 352 } 351 353 352 354 memcpy(cpg->sram + SRAM_CONFIG, &op, sizeof(struct sec_accel_config));