History

crypto: mv_cesa - fix for hash finalisation with data

Since mv_hash_final_fallback() uses ctx->state, read out the digest state register before calling it.

Phil Sutter committed 14 years ago

Commit 4d03c501 parent 5741d2e1 file · +13 −6Browse files

Unified · Split

drivers/crypto/mv_cesa.c+13−6
@@ -423,6 +423,15 @@ out: · 422 unmodified lines
423 return rc;423 return rc;
424}424}
425 425
426static void mv_save_digest_state(struct mv_req_hash_ctx *ctx)
427{
428 ctx->state[0] = readl(cpg->reg + DIGEST_INITIAL_VAL_A);
429 ctx->state[1] = readl(cpg->reg + DIGEST_INITIAL_VAL_B);
430 ctx->state[2] = readl(cpg->reg + DIGEST_INITIAL_VAL_C);
431 ctx->state[3] = readl(cpg->reg + DIGEST_INITIAL_VAL_D);
432 ctx->state[4] = readl(cpg->reg + DIGEST_INITIAL_VAL_E);
433}
434
426static void mv_hash_algo_completion(void)435static void mv_hash_algo_completion(void)
427{436{
428 struct ahash_request *req = ahash_request_cast(cpg->cur_req);437 struct ahash_request *req = ahash_request_cast(cpg->cur_req);
@@ -437,14 +446,12 @@ static void mv_hash_algo_completion(void) · 8 unmodified lines
437 memcpy(req->result, cpg->sram + SRAM_DIGEST_BUF,446 memcpy(req->result, cpg->sram + SRAM_DIGEST_BUF,
438 crypto_ahash_digestsize(crypto_ahash_reqtfm447 crypto_ahash_digestsize(crypto_ahash_reqtfm
439 (req)));448 (req)));
440 } else449 } else {
450 mv_save_digest_state(ctx);
441 mv_hash_final_fallback(req);451 mv_hash_final_fallback(req);
452 }
442 } else {453 } else {
443 ctx->state[0] = readl(cpg->reg + DIGEST_INITIAL_VAL_A);454 mv_save_digest_state(ctx);
444 ctx->state[1] = readl(cpg->reg + DIGEST_INITIAL_VAL_B);
445 ctx->state[2] = readl(cpg->reg + DIGEST_INITIAL_VAL_C);
446 ctx->state[3] = readl(cpg->reg + DIGEST_INITIAL_VAL_D);
447 ctx->state[4] = readl(cpg->reg + DIGEST_INITIAL_VAL_E);
448 }455 }
449}456}
450 457

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t