[PATCH 22.11] app/test: fix a merge problem in oop patch

Arkadiusz Kusztal arkadiuszx.kusztal at intel.com
Mon Mar 31 23:32:20 CEST 2025


Fix "app/test: fix the check of the oop header data" was incorrectly
applied: code was added into the wrong functions. This fix addresses
this issue.

Bugzilla ID: 1686
Fixes: bb8feaacb489 ("test/crypto: fix check for OOP header data")

Signed-off-by: Arkadiusz Kusztal <arkadiuszx.kusztal at intel.com>
---
 app/test/test_cryptodev.c | 58 +++++++++++++++++++--------------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index ac477431c4..92113a55d2 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -11453,8 +11453,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;
 
@@ -11526,6 +11527,18 @@ test_authenticated_encryption_oop(const struct aead_test_data *tdata)
 	debug_hexdump(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len);
 	debug_hexdump(stdout, "auth tag:", auth_tag, tdata->auth_tag.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(
 			ciphertext,
@@ -11555,8 +11568,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);
@@ -11626,6 +11640,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,
@@ -11652,9 +11677,8 @@ test_authenticated_encryption_sessionless(
 	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, *buffer_oop;
+	uint8_t *ciphertext, *auth_tag;
 	uint16_t plaintext_pad_len;
 	uint8_t key[tdata->key.len + 1];
 	struct rte_cryptodev_info dev_info;
@@ -11722,18 +11746,6 @@ test_authenticated_encryption_sessionless(
 			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);
 
@@ -11768,9 +11780,8 @@ test_authenticated_decryption_sessionless(
 	struct crypto_testsuite_params *ts_params = &testsuite_params;
 	struct crypto_unittest_params *ut_params = &unittest_params;
 
-	uint32_t i;
 	int retval;
-	uint8_t *plaintext, *buffer_oop;
+	uint8_t *plaintext;
 	uint8_t key[tdata->key.len + 1];
 	struct rte_cryptodev_info dev_info;
 
@@ -11847,17 +11858,6 @@ test_authenticated_decryption_sessionless(
 
 	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



More information about the stable mailing list