DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ciara Power <ciara.power@intel.com>
To: Akhil Goyal <gakhil@marvell.com>, Fan Zhang <royzhang1980@gmail.com>
Cc: dev@dpdk.org, kai.ji@intel.com,
	Ciara Power <ciara.power@intel.com>,
	Fan Zhang <roy.fan.zhang@intel.com>,
	Pablo de Lara <pablo.de.lara.guarch@intel.com>
Subject: [PATCH v5 1/4] test/crypto: fix wireless auth digest segment
Date: Fri,  7 Oct 2022 13:46:50 +0000	[thread overview]
Message-ID: <20221007134653.929034-2-ciara.power@intel.com> (raw)
In-Reply-To: <20221007134653.929034-1-ciara.power@intel.com>

The segment size for some tests was too small to hold the auth digest.
This caused issues when using op->sym->auth.digest.data for comparisons
in AESNI_MB PMD after a subsequent patch enables SGL.

For example, if segment size is 2, and digest size is 4, then 4 bytes
are read from op->sym->auth.digest.data, which overflows into the memory
after the segment, rather than using the second segment that contains
the remaining half of the digest.

Fixes: 11c5485bb276 ("test/crypto: add scatter-gather tests for IP and OOP")

Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

---
v4: Added failure check when appending digest size to buffer.
---
 app/test/test_cryptodev.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index c6d47a035e..203b8b61fa 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -2990,6 +2990,16 @@ create_wireless_algo_auth_cipher_operation(
 			remaining_off -= rte_pktmbuf_data_len(sgl_buf);
 			sgl_buf = sgl_buf->next;
 		}
+
+		/* The last segment should be large enough to hold full digest */
+		if (sgl_buf->data_len < auth_tag_len) {
+			rte_pktmbuf_free(sgl_buf->next);
+			sgl_buf->next = NULL;
+			TEST_ASSERT_NOT_NULL(rte_pktmbuf_append(sgl_buf,
+					auth_tag_len - sgl_buf->data_len),
+					"No room to append auth tag");
+		}
+
 		sym_op->auth.digest.data = rte_pktmbuf_mtod_offset(sgl_buf,
 				uint8_t *, remaining_off);
 		sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(sgl_buf,
-- 
2.25.1


  reply	other threads:[~2022-10-07 13:47 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-12 13:23 [PATCH 0/3] add remaining SGL support to AESNI_MB Ciara Power
2022-08-12 13:23 ` [PATCH 1/3] test/crypto: fix wireless auth digest segment Ciara Power
2022-08-12 13:23 ` [PATCH 2/3] crypto/ipsec_mb: add remaining SGL support Ciara Power
2022-08-12 13:23 ` [PATCH 3/3] test/crypto: add OOP snow3g SGL tests Ciara Power
2022-08-25 14:28 ` [PATCH v2 0/5] add remaining SGL support to AESNI_MB Ciara Power
2022-08-25 14:28   ` [PATCH v2 1/5] test/crypto: fix wireless auth digest segment Ciara Power
2022-08-25 14:28   ` [PATCH v2 2/5] crypto/ipsec_mb: fix sessionless cleanup Ciara Power
2022-09-15 11:38     ` De Lara Guarch, Pablo
2022-09-21 13:02       ` Power, Ciara
2022-08-25 14:28   ` [PATCH v2 3/5] crypto/ipsec_mb: add remaining SGL support Ciara Power
2022-09-15 11:47     ` De Lara Guarch, Pablo
2022-08-25 14:29   ` [PATCH v2 4/5] test/crypto: add OOP snow3g SGL tests Ciara Power
2022-08-25 14:29   ` [PATCH v2 5/5] test/crypto: add remaining blockcipher " Ciara Power
2022-09-21 12:50 ` [PATCH v3 0/5] add remaining SGL support to AESNI_MB Ciara Power
2022-09-21 12:50   ` [PATCH v3 1/5] test/crypto: fix wireless auth digest segment Ciara Power
2022-09-21 13:32     ` Zhang, Roy Fan
2022-09-21 12:50   ` [PATCH v3 2/5] crypto/ipsec_mb: fix session creation for sessionless Ciara Power
2022-09-21 13:33     ` Zhang, Roy Fan
2022-09-21 12:50   ` [PATCH v3 3/5] crypto/ipsec_mb: add remaining SGL support Ciara Power
2022-09-21 14:50     ` Zhang, Roy Fan
2022-09-21 12:50   ` [PATCH v3 4/5] test/crypto: add OOP snow3g SGL tests Ciara Power
2022-09-21 14:54     ` Zhang, Roy Fan
2022-09-21 12:50   ` [PATCH v3 5/5] test/crypto: add remaining blockcipher " Ciara Power
2022-09-21 14:55     ` Zhang, Roy Fan
2022-09-26  8:06   ` [PATCH v3 0/5] add remaining SGL support to AESNI_MB De Lara Guarch, Pablo
2022-10-04 12:55 ` [PATCH v4 " Ciara Power
2022-10-04 12:55   ` [PATCH v4 1/5] test/crypto: fix wireless auth digest segment Ciara Power
2022-10-04 12:55   ` [PATCH v4 2/5] crypto/ipsec_mb: fix session creation for sessionless Ciara Power
2022-10-04 12:55   ` [PATCH v4 3/5] crypto/ipsec_mb: add remaining SGL support Ciara Power
2022-10-04 12:55   ` [PATCH v4 4/5] test/crypto: add OOP snow3g SGL tests Ciara Power
2022-10-04 12:55   ` [PATCH v4 5/5] test/crypto: add remaining blockcipher " Ciara Power
2022-10-07  6:53   ` [EXT] [PATCH v4 0/5] add remaining SGL support to AESNI_MB Akhil Goyal
2022-10-07 13:46 ` [PATCH v5 0/4] " Ciara Power
2022-10-07 13:46   ` Ciara Power [this message]
2022-10-07 13:46   ` [PATCH v5 2/4] crypto/ipsec_mb: add remaining SGL support Ciara Power
2022-10-07 13:46   ` [PATCH v5 3/4] test/crypto: add OOP snow3g SGL tests Ciara Power
2022-10-07 13:46   ` [PATCH v5 4/4] test/crypto: add remaining blockcipher " Ciara Power
2022-10-12 18:22   ` [EXT] [PATCH v5 0/4] add remaining SGL support to AESNI_MB 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=20221007134653.929034-2-ciara.power@intel.com \
    --to=ciara.power@intel.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=kai.ji@intel.com \
    --cc=pablo.de.lara.guarch@intel.com \
    --cc=roy.fan.zhang@intel.com \
    --cc=royzhang1980@gmail.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).