From: Wenkai Lin linwenkai6@hisilicon.com
In storage scenarios, the XTS mode is used for encrypting and decrypting data on and off disks. According to the definition of this mode, the input parameter to genarate IV is the LBA, so update SEC bd1 xts mode CI_GEN from 0 to 3, which means use LBA mode.
Signed-off-by: Wenkai Lin linwenkai6@hisilicon.com --- v1/drv/hisi_sec_udrv.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/v1/drv/hisi_sec_udrv.c b/v1/drv/hisi_sec_udrv.c index c0bd73d..d4e090a 100644 --- a/v1/drv/hisi_sec_udrv.c +++ b/v1/drv/hisi_sec_udrv.c @@ -312,11 +312,10 @@ static int fill_cipher_bd1_type(struct wcrypto_cipher_msg *msg,
fill_bd_addr_type(msg->data_fmt, sqe);
- /* - * 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; + if (msg->mode == WCRYPTO_CIPHER_XTS) + sqe->type1.ci_gen = CI_GEN_BY_LBA; + else + sqe->type1.ci_gen = CI_GEN_BY_ADDR;
return WD_SUCCESS; }