summaryrefslogtreecommitdiff
path: root/drivers/crypto/amcc/crypto4xx_core.c
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2020-05-20 08:43:03 -0300
committerGitHub <noreply@github.com>2020-05-20 08:43:03 -0300
commit1279cd128bba968ebe0a2df7f7ae38bae90250ef (patch)
treedf6b1a190760f51465122ca4c13492d5ac5984c6 /drivers/crypto/amcc/crypto4xx_core.c
parent0a8ab17689e628c84a666195bfc6ab85d11cf057 (diff)
parent2ae782ca839e0ee07de37122ddea362adff2e975 (diff)
Merge pull request #76 from toradex/4.9-2.3.x-imx
4.9 2.3.x imx
Diffstat (limited to 'drivers/crypto/amcc/crypto4xx_core.c')
-rw-r--r--drivers/crypto/amcc/crypto4xx_core.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c
index c7524bbbaf98..e5e83c6de536 100644
--- a/drivers/crypto/amcc/crypto4xx_core.c
+++ b/drivers/crypto/amcc/crypto4xx_core.c
@@ -400,12 +400,8 @@ static u32 crypto4xx_build_sdr(struct crypto4xx_device *dev)
dma_alloc_coherent(dev->core_dev->device,
dev->scatter_buffer_size * PPC4XX_NUM_SD,
&dev->scatter_buffer_pa, GFP_ATOMIC);
- if (!dev->scatter_buffer_va) {
- dma_free_coherent(dev->core_dev->device,
- sizeof(struct ce_sd) * PPC4XX_NUM_SD,
- dev->sdr, dev->sdr_pa);
+ if (!dev->scatter_buffer_va)
return -ENOMEM;
- }
sd_array = dev->sdr;
@@ -646,6 +642,15 @@ static u32 crypto4xx_ablkcipher_done(struct crypto4xx_device *dev,
addr = dma_map_page(dev->core_dev->device, sg_page(dst),
dst->offset, dst->length, DMA_FROM_DEVICE);
}
+
+ if (pd_uinfo->sa_va->sa_command_0.bf.save_iv == SA_SAVE_IV) {
+ struct crypto_skcipher *skcipher = crypto_skcipher_reqtfm(req);
+
+ crypto4xx_memcpy_from_le32((u32 *)req->iv,
+ pd_uinfo->sr_va->save_iv,
+ crypto_skcipher_ivsize(skcipher));
+ }
+
crypto4xx_ret_sg_desc(dev, pd_uinfo);
if (ablk_req->base.complete != NULL)
ablk_req->base.complete(&ablk_req->base, 0);