[PATCH 1/2] vhost: fix cipher data length

Rajesh Mudimadugula rmudimadugul at marvell.com
Thu Apr 3 14:22:34 CEST 2025


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 at marvell.com>
---
 lib/vhost/vhost_crypto.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

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;
-- 
2.34.1



More information about the dev mailing list