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>
This commit is contained in:
parent
8652348754
commit
7759995c75
1 changed files with 6 additions and 6 deletions
|
@ -525,12 +525,6 @@ static void mv_start_new_hash_req(struct ahash_request *req)
|
||||||
hw_bytes = req->nbytes + ctx->extra_bytes;
|
hw_bytes = req->nbytes + ctx->extra_bytes;
|
||||||
old_extra_bytes = ctx->extra_bytes;
|
old_extra_bytes = ctx->extra_bytes;
|
||||||
|
|
||||||
if (unlikely(ctx->extra_bytes)) {
|
|
||||||
memcpy(cpg->sram + SRAM_DATA_IN_START, ctx->buffer,
|
|
||||||
ctx->extra_bytes);
|
|
||||||
p->crypt_len = ctx->extra_bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx->extra_bytes = hw_bytes % SHA1_BLOCK_SIZE;
|
ctx->extra_bytes = hw_bytes % SHA1_BLOCK_SIZE;
|
||||||
if (ctx->extra_bytes != 0
|
if (ctx->extra_bytes != 0
|
||||||
&& (!ctx->last_chunk || ctx->count > MAX_HW_HASH_SIZE))
|
&& (!ctx->last_chunk || ctx->count > MAX_HW_HASH_SIZE))
|
||||||
|
@ -546,6 +540,12 @@ static void mv_start_new_hash_req(struct ahash_request *req)
|
||||||
p->complete = mv_hash_algo_completion;
|
p->complete = mv_hash_algo_completion;
|
||||||
p->process = mv_process_hash_current;
|
p->process = mv_process_hash_current;
|
||||||
|
|
||||||
|
if (unlikely(old_extra_bytes)) {
|
||||||
|
memcpy(cpg->sram + SRAM_DATA_IN_START, ctx->buffer,
|
||||||
|
old_extra_bytes);
|
||||||
|
p->crypt_len = old_extra_bytes;
|
||||||
|
}
|
||||||
|
|
||||||
mv_process_hash_current(1);
|
mv_process_hash_current(1);
|
||||||
} else {
|
} else {
|
||||||
copy_src_to_buf(p, ctx->buffer + old_extra_bytes,
|
copy_src_to_buf(p, ctx->buffer + old_extra_bytes,
|
||||||
|
|
Loading…
Add table
Reference in a new issue