aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto
diff options
context:
space:
mode:
authorPhil Sutter <phil.sutter@viprinet.com>2011-11-16 12:28:01 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2011-12-09 11:52:20 -0500
commite84ce11bd0183328e00accb611893b9a819dc0ba (patch)
tree88d22601f6032cacfa7ad227352c688b289748f9 /drivers/crypto
parent4d15dcb0e249cd9834afc9b44d674dbd9eb57116 (diff)
crypto: mv_cesa - fix hashing of chunks > 1920 bytes
commit 274252862f386b7868f35bf5ceaa5391a8ccfdf3 upstream. 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> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/mv_cesa.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/crypto/mv_cesa.c b/drivers/crypto/mv_cesa.c
index 3cf303ee3fe..38a3297ae2b 100644
--- a/drivers/crypto/mv_cesa.c
+++ b/drivers/crypto/mv_cesa.c
@@ -342,11 +342,13 @@ static void mv_process_hash_current(int first_block)
342 else 342 else
343 op.config |= CFG_MID_FRAG; 343 op.config |= CFG_MID_FRAG;
344 344
345 writel(req_ctx->state[0], cpg->reg + DIGEST_INITIAL_VAL_A); 345 if (first_block) {
346 writel(req_ctx->state[1], cpg->reg + DIGEST_INITIAL_VAL_B); 346 writel(req_ctx->state[0], cpg->reg + DIGEST_INITIAL_VAL_A);
347 writel(req_ctx->state[2], cpg->reg + DIGEST_INITIAL_VAL_C); 347 writel(req_ctx->state[1], cpg->reg + DIGEST_INITIAL_VAL_B);
348 writel(req_ctx->state[3], cpg->reg + DIGEST_INITIAL_VAL_D); 348 writel(req_ctx->state[2], cpg->reg + DIGEST_INITIAL_VAL_C);
349 writel(req_ctx->state[4], cpg->reg + DIGEST_INITIAL_VAL_E); 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 memcpy(cpg->sram + SRAM_CONFIG, &op, sizeof(struct sec_accel_config)); 354 memcpy(cpg->sram + SRAM_CONFIG, &op, sizeof(struct sec_accel_config));