[1/2] vhost: fix cipher data length

Message ID 20250403122234.3508100-1-rmudimadugul@marvell.com (mailing list archive)
State New
Delegated to: Maxime Coquelin
Headers
Series [1/2] vhost: fix cipher data length |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Rajesh Mudimadugula April 3, 2025, 12:22 p.m. UTC
This patch fixes cipher data length, in the event of algorithm
chaining. When enqueuing crypto op to vhost backend
cipher.data.length is set correctly which is in
virtqueue_crypto_sym_pkt_header_arrange(). This field is computed
and assigned wrongly instead of using passed value. This is
rectified and using correct cipher data length in vhost crypto.

Fixes: 3bb595ecd682 ("vhost/crypto: add request handler")

Signed-off-by: Rajesh Mudimadugula <rmudimadugul@marvell.com>
---
 lib/vhost/vhost_crypto.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Comments

Akhil Goyal April 10, 2025, 5:12 a.m. UTC | #1
> This patch fixes cipher data length, in the event of algorithm
> chaining. When enqueuing crypto op to vhost backend
> cipher.data.length is set correctly which is in
> virtqueue_crypto_sym_pkt_header_arrange(). This field is computed
> and assigned wrongly instead of using passed value. This is
> rectified and using correct cipher data length in vhost crypto.
> 
> Fixes: 3bb595ecd682 ("vhost/crypto: add request handler")
Cc: stable@dpdk.org
> 
> Signed-off-by: Rajesh Mudimadugula <rmudimadugul@marvell.com>

Acked-by: Akhil Goyal <gakhil@marvell.com>
  

Patch

diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
index 3c6c5dc114..ddcd93738b 100644
--- a/lib/vhost/vhost_crypto.c
+++ b/lib/vhost/vhost_crypto.c
@@ -1358,8 +1358,7 @@  prepare_sym_chain_op(struct vhost_crypto *vcrypto, struct rte_crypto_op *op,
 	op->sess_type = RTE_CRYPTO_OP_WITH_SESSION;
 
 	op->sym->cipher.data.offset = chain->para.cipher_start_src_offset;
-	op->sym->cipher.data.length = chain->para.src_data_len -
-			chain->para.cipher_start_src_offset;
+	op->sym->cipher.data.length = chain->para.len_to_cipher;
 
 	op->sym->auth.data.offset = chain->para.hash_start_src_offset;
 	op->sym->auth.data.length = chain->para.len_to_hash;