* [PATCH] app/test: fix the check of the oop header data
@ 2025-02-26 8:16 Arkadiusz Kusztal
0 siblings, 0 replies; only message in thread
From: Arkadiusz Kusztal @ 2025-02-26 8:16 UTC (permalink / raw)
To: dev; +Cc: gakhil, brian.dooley, Arkadiusz Kusztal, stable
The data of the out-of-place header is never checked. Therefore,
the faulty PMD, which overwrites this data, will not be able to
verify that with tests. New checks to support that were added to
the GCM OOP functions.
Fixes: 51e202f0596f ("test/crypto: rename GCM test code")
Cc: stable@dpdk.org
Signed-off-by: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
---
app/test/test_cryptodev.c | 29 +++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 441ecc6ad5..6ef43a784d 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -13769,8 +13769,9 @@ test_authenticated_encryption_oop(const struct aead_test_data *tdata)
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
+ uint32_t i;
int retval;
- uint8_t *ciphertext, *auth_tag;
+ uint8_t *ciphertext, *auth_tag, *buffer_oop;
uint16_t plaintext_pad_len;
struct rte_cryptodev_info dev_info;
@@ -13846,6 +13847,18 @@ test_authenticated_encryption_oop(const struct aead_test_data *tdata)
ut_params->op->sym->cipher.data.offset);
auth_tag = ciphertext + plaintext_pad_len;
+ /* Check if the data within the offset range is not overwritten in the OOP */
+ buffer_oop = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
+ for (i = 0; i < ut_params->op->sym->cipher.data.offset; i++) {
+ if (buffer_oop[i]) {
+ RTE_LOG(ERR, USER1,
+ "Incorrect value of the output buffer header\n");
+ debug_hexdump(stdout, "Incorrect value:", buffer_oop,
+ ut_params->op->sym->cipher.data.offset);
+ return TEST_FAILED;
+ }
+ }
+
debug_hexdump(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len);
debug_hexdump(stdout, "auth tag:", auth_tag, tdata->auth_tag.len);
@@ -13878,8 +13891,9 @@ test_authenticated_decryption_oop(const struct aead_test_data *tdata)
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
+ uint32_t i;
int retval;
- uint8_t *plaintext;
+ uint8_t *plaintext, *buffer_oop;
struct rte_cryptodev_info dev_info;
rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
@@ -13957,6 +13971,17 @@ test_authenticated_decryption_oop(const struct aead_test_data *tdata)
debug_hexdump(stdout, "plaintext:", plaintext, tdata->ciphertext.len);
+ /* Check if the data within the offset range is not overwritten in the OOP */
+ buffer_oop = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *);
+ for (i = 0; i < ut_params->op->sym->cipher.data.offset; i++) {
+ if (buffer_oop[i]) {
+ RTE_LOG(ERR, USER1,
+ "Incorrect value of the output buffer header\n");
+ debug_hexdump(stdout, "Incorrect value:", buffer_oop,
+ ut_params->op->sym->cipher.data.offset);
+ return TEST_FAILED;
+ }
+ }
/* Validate obuf */
TEST_ASSERT_BUFFERS_ARE_EQUAL(
plaintext,
--
2.43.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-02-26 8:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-26 8:16 [PATCH] app/test: fix the check of the oop header data Arkadiusz Kusztal
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).