libwd/0051-hisi-sec-v1-update-the-SEC-BD1-mode-configuration.patch
Yang Shen aa2d7cce3f libwd: backport for uadk from 2.3.24 to 2.3.27
Update some patch for uadk from mainline.
To get more infomation, please visit the homepage:
https://github.com/Linaro/uadk

Signed-off-by: Yang Shen <shenyang39@huawei.com>
2022-02-21 06:32:14 +00:00

52 lines
1.6 KiB
Diff

From 124472212b51781c8ab8ad26131d8442cd049380 Mon Sep 17 00:00:00 2001
From: Kai Ye <yekai13@huawei.com>
Date: Thu, 10 Feb 2022 14:55:44 +0800
Subject: [PATCH 55/64] hisi-sec/v1: update the SEC BD1 mode configuration
Update SEC BD1 XTS mode CI_GEN config from 3 to 0, because
ZIP XTS LBA hardware accomplish is different from SEC XTS LBA.
So we config SEC BD1 XTS ci_gen=0, which means cipher_ivin_addr
mode.
Signed-off-by: Kai Ye <yekai13@huawei.com>
---
v1/drv/hisi_sec_udrv.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/v1/drv/hisi_sec_udrv.c b/v1/drv/hisi_sec_udrv.c
index 2d06bd7..7345baf 100644
--- a/v1/drv/hisi_sec_udrv.c
+++ b/v1/drv/hisi_sec_udrv.c
@@ -298,10 +298,11 @@ static int fill_cipher_bd1_type(struct wcrypto_cipher_msg *msg,
fill_bd_addr_type(msg->data_fmt, sqe);
- if (msg->mode == WCRYPTO_CIPHER_XTS)
- sqe->type1.ci_gen = CI_GEN_BY_LBA;
- else
- sqe->type1.ci_gen = CI_GEN_BY_ADDR;
+ /*
+ * BD1 cipher only provides ci_gen=0 for compatibility, so user
+ * should prepare iv[gran_num] and iv_bytes is sum of all grans
+ */
+ sqe->type1.ci_gen = CI_GEN_BY_ADDR;
return WD_SUCCESS;
}
@@ -1453,6 +1454,12 @@ static void parse_cipher_bd1(struct wd_queue *q, struct hisi_sec_sqe *sqe,
sqe->type1.c_key_addr_l);
drv_iova_unmap(q, cipher_msg->key, (void *)(uintptr_t)dma_addr,
cipher_msg->key_bytes);
+ if (cipher_msg->iv) {
+ dma_addr = DMA_ADDR(sqe->type1.c_ivin_addr_h,
+ sqe->type1.c_ivin_addr_l);
+ drv_iova_unmap(q, cipher_msg->iv, (void *)(uintptr_t)dma_addr,
+ cipher_msg->iv_bytes);
+ }
}
static void cipher_ofb_data_handle(struct wcrypto_cipher_msg *msg)
--
2.25.1