diff options
-rw-r--r-- | drivers/crypto/mv_cesa.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/crypto/mv_cesa.c b/drivers/crypto/mv_cesa.c index 37d9f0688e75..018a95ce0c9b 100644 --- a/drivers/crypto/mv_cesa.c +++ b/drivers/crypto/mv_cesa.c | |||
@@ -242,6 +242,8 @@ static void dequeue_complete_req(void) | |||
242 | struct ablkcipher_request *req = cpg->cur_req; | 242 | struct ablkcipher_request *req = cpg->cur_req; |
243 | void *buf; | 243 | void *buf; |
244 | int ret; | 244 | int ret; |
245 | int need_copy_len = cpg->p.crypt_len; | ||
246 | int sram_offset = 0; | ||
245 | 247 | ||
246 | cpg->p.total_req_bytes += cpg->p.crypt_len; | 248 | cpg->p.total_req_bytes += cpg->p.crypt_len; |
247 | do { | 249 | do { |
@@ -257,14 +259,16 @@ static void dequeue_complete_req(void) | |||
257 | buf = cpg->p.dst_sg_it.addr; | 259 | buf = cpg->p.dst_sg_it.addr; |
258 | buf += cpg->p.dst_start; | 260 | buf += cpg->p.dst_start; |
259 | 261 | ||
260 | dst_copy = min(cpg->p.crypt_len, cpg->p.sg_dst_left); | 262 | dst_copy = min(need_copy_len, cpg->p.sg_dst_left); |
261 | |||
262 | memcpy(buf, cpg->sram + SRAM_DATA_OUT_START, dst_copy); | ||
263 | 263 | ||
264 | memcpy(buf, | ||
265 | cpg->sram + SRAM_DATA_OUT_START + sram_offset, | ||
266 | dst_copy); | ||
267 | sram_offset += dst_copy; | ||
264 | cpg->p.sg_dst_left -= dst_copy; | 268 | cpg->p.sg_dst_left -= dst_copy; |
265 | cpg->p.crypt_len -= dst_copy; | 269 | need_copy_len -= dst_copy; |
266 | cpg->p.dst_start += dst_copy; | 270 | cpg->p.dst_start += dst_copy; |
267 | } while (cpg->p.crypt_len > 0); | 271 | } while (need_copy_len > 0); |
268 | 272 | ||
269 | BUG_ON(cpg->eng_st != ENGINE_W_DEQUEUE); | 273 | BUG_ON(cpg->eng_st != ENGINE_W_DEQUEUE); |
270 | if (cpg->p.total_req_bytes < req->nbytes) { | 274 | if (cpg->p.total_req_bytes < req->nbytes) { |