Commit 7759995c75ae0cbd4c861582908449f6b6208e7a

Authored by Phil Sutter
Committed by Herbert Xu
1 parent 8652348754

crypto: mv_cesa - copy remaining bytes to SRAM only when needed

Signed-off-by: Phil Sutter <phil.sutter@viprinet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Showing 1 changed file with 6 additions and 6 deletions Side-by-side Diff

drivers/crypto/mv_cesa.c
... ... @@ -525,12 +525,6 @@
525 525 hw_bytes = req->nbytes + ctx->extra_bytes;
526 526 old_extra_bytes = ctx->extra_bytes;
527 527  
528   - if (unlikely(ctx->extra_bytes)) {
529   - memcpy(cpg->sram + SRAM_DATA_IN_START, ctx->buffer,
530   - ctx->extra_bytes);
531   - p->crypt_len = ctx->extra_bytes;
532   - }
533   -
534 528 ctx->extra_bytes = hw_bytes % SHA1_BLOCK_SIZE;
535 529 if (ctx->extra_bytes != 0
536 530 && (!ctx->last_chunk || ctx->count > MAX_HW_HASH_SIZE))
... ... @@ -545,6 +539,12 @@
545 539 p->hw_nbytes = hw_bytes;
546 540 p->complete = mv_hash_algo_completion;
547 541 p->process = mv_process_hash_current;
  542 +
  543 + if (unlikely(old_extra_bytes)) {
  544 + memcpy(cpg->sram + SRAM_DATA_IN_START, ctx->buffer,
  545 + old_extra_bytes);
  546 + p->crypt_len = old_extra_bytes;
  547 + }
548 548  
549 549 mv_process_hash_current(1);
550 550 } else {