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
423423 return rc;
424424 }
425425
426+static 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+
426435 static void mv_hash_algo_completion(void)
427436 {
428437 struct ahash_request *req = ahash_request_cast(cpg->cur_req);
@@ -437,14 +446,12 @@ static void mv_hash_algo_completion(void) · 8 unmodified lines
437446 memcpy(req->result, cpg->sram + SRAM_DIGEST_BUF,
438447 crypto_ahash_digestsize(crypto_ahash_reqtfm
439448 (req)));
440− } else
449+ } else {
450+ mv_save_digest_state(ctx);
441451 mv_hash_final_fallback(req);
452+ }
442453 } else {
443− ctx->state[0] = readl(cpg->reg + DIGEST_INITIAL_VAL_A);
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);
454+ mv_save_digest_state(ctx);
448455 }
449456 }
450457

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