From: Rajesh Mudimadugula <rmudimadugul@marvell.com>
To: <dev@dpdk.org>
Cc: <jianjay.zhou@huawei.com>,
Rajesh Mudimadugula <rmudimadugul@marvell.com>
Subject: [PATCH 2/2] crypto/virtio: fix cipher data src length
Date: Thu, 3 Apr 2025 12:26:03 +0000 [thread overview]
Message-ID: <20250403122603.3508135-1-rmudimadugul@marvell.com> (raw)
In symmetric algorithm chaining, we need to consider both
cipher and auth data length for cipher source.
Fixes: 82adb12a1fce ("crypto/virtio: support burst enqueue/dequeue")
Signed-off-by: Rajesh Mudimadugula <rmudimadugul@marvell.com>
---
drivers/crypto/virtio/virtio_rxtx.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/crypto/virtio/virtio_rxtx.c b/drivers/crypto/virtio/virtio_rxtx.c
index 0cc904485c..a7f1bd9753 100644
--- a/drivers/crypto/virtio/virtio_rxtx.c
+++ b/drivers/crypto/virtio/virtio_rxtx.c
@@ -243,8 +243,10 @@ virtqueue_crypto_sym_pkt_header_arrange(
req_data->u.sym_req.u.chain.para.aad_len = session->aad.length;
req_data->u.sym_req.u.chain.para.src_data_len =
- (sym_op->cipher.data.length +
- sym_op->cipher.data.offset);
+ RTE_MAX((sym_op->cipher.data.length +
+ sym_op->cipher.data.offset),
+ (sym_op->auth.data.length +
+ sym_op->auth.data.offset));
req_data->u.sym_req.u.chain.para.dst_data_len =
req_data->u.sym_req.u.chain.para.src_data_len;
req_data->u.sym_req.u.chain.para.cipher_start_src_offset =
@@ -298,6 +300,7 @@ virtqueue_crypto_sym_enqueue_xmit_split(
uint32_t hash_result_len = 0;
struct virtio_crypto_op_cookie *crypto_op_cookie;
struct virtio_crypto_alg_chain_session_para *para;
+ uint32_t src_len;
if (unlikely(sym_op->m_src->nb_segs != 1))
return -EMSGSIZE;
@@ -371,21 +374,22 @@ virtqueue_crypto_sym_enqueue_xmit_split(
desc[idx++].flags = VRING_DESC_F_NEXT;
}
+ src_len = RTE_MAX((sym_op->cipher.data.offset +
+ sym_op->cipher.data.length),
+ (sym_op->auth.data.length +
+ sym_op->auth.data.offset));
/* indirect vring: src data */
desc[idx].addr = rte_pktmbuf_iova_offset(sym_op->m_src, 0);
- desc[idx].len = (sym_op->cipher.data.offset
- + sym_op->cipher.data.length);
+ desc[idx].len = src_len;
desc[idx++].flags = VRING_DESC_F_NEXT;
/* indirect vring: dst data */
if (sym_op->m_dst) {
desc[idx].addr = rte_pktmbuf_iova_offset(sym_op->m_dst, 0);
- desc[idx].len = (sym_op->cipher.data.offset
- + sym_op->cipher.data.length);
+ desc[idx].len = src_len;
} else {
desc[idx].addr = rte_pktmbuf_iova_offset(sym_op->m_src, 0);
- desc[idx].len = (sym_op->cipher.data.offset
- + sym_op->cipher.data.length);
+ desc[idx].len = src_len;
}
desc[idx++].flags = VRING_DESC_F_WRITE | VRING_DESC_F_NEXT;
--
2.34.1
next reply other threads:[~2025-04-03 12:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-03 12:26 Rajesh Mudimadugula [this message]
2025-04-10 5:14 ` [EXTERNAL] " Akhil Goyal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250403122603.3508135-1-rmudimadugul@marvell.com \
--to=rmudimadugul@marvell.com \
--cc=dev@dpdk.org \
--cc=jianjay.zhou@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).