Skip to contentSkip to conversation

app/crypto-perf: Only run AEAD decrypt with valid test vector file.

PATCH Superseded Emma Finn 3 participants 4 messages Jul 28, 2025 – Oct 1, 2025

lore
Share & tools
lore

Emma Finn

author
#0 lore raw

PATCH 1/1 app/crypto-perf: Only run AEAD decrypt with valid test vector file.

The test dummy vector data is incorrect for AEAD decryption, so we should only run when passed a valid test vector file. This patch also moves the check for correct test vector data to after the vector has been populated by test vector file or dummy data.

---
 app/test-crypto-perf/cperf_options_parsing.c | 19 +++++++++++++++++--
 app/test-crypto-perf/main.c                  | 12 ++++++------
 2 files changed, 23 insertions(+), 8 deletions(-)
app/test-crypto-perf/cperf_options_parsing.c +17 -2
index 0e0dc4fd06..12623e4cfe 100644
@@ -1482,11 +1482,26 @@ cperf_options_check(struct cperf_options *options)
 		}
 	}
 
-	if (options->test == CPERF_TEST_TYPE_THROUGHPUT &&
+	if ((options->test == CPERF_TEST_TYPE_THROUGHPUT ||
+	    options->test == CPERF_TEST_TYPE_LATENCY) &&
 	    (options->aead_op == RTE_CRYPTO_AEAD_OP_DECRYPT ||
 	     options->auth_op == RTE_CRYPTO_AUTH_OP_VERIFY) &&
 	    !options->out_of_place) {
-		RTE_LOG(ERR, USER1, "Only out-of-place is allowed in throughput decryption.\n");
+		RTE_LOG(ERR, USER1, "Only out-of-place is allowed in throughput and"
+			    " latency decryption.\n");
+		return -EINVAL;
+	}
+
+	if ((options->test == CPERF_TEST_TYPE_THROUGHPUT ||
+		 options->test == CPERF_TEST_TYPE_LATENCY) &&
+	    (options->aead_op == RTE_CRYPTO_AEAD_OP_DECRYPT ||
+	     options->auth_op == RTE_CRYPTO_AUTH_OP_VERIFY) &&
+		 options->test_name == NULL &&
+		 options->test_file == NULL) {
+		RTE_LOG(ERR, USER1, "Define path to the file with test"
+				" vectors.\n");
+		RTE_LOG(ERR, USER1, "Define test name to get the correct digest"
+				" from the test vectors.\n");
 		return -EINVAL;
 	}
 
app/test-crypto-perf/main.c +6 -6
index 2e38c0011d..ef3c71b492 100644
@@ -731,12 +731,6 @@ main(int argc, char **argv)
 					" specified file\n");
 			goto err;
 		}
-
-		if (cperf_check_test_vector(&opts, t_vec)) {
-			RTE_LOG(ERR, USER1, "Incomplete necessary test vectors"
-					"\n");
-			goto err;
-		}
 	} else {
 		t_vec = cperf_test_vector_get_dummy(&opts);
 		if (t_vec == NULL) {
@@ -746,6 +740,12 @@ main(int argc, char **argv)
 			goto err;
 		}
 	}
+	/* Add check for test vector data after dummy and file option. */
+	if (cperf_check_test_vector(&opts, t_vec)) {
+		RTE_LOG(ERR, USER1, "Incomplete necessary test vectors"
+				"\n");
+		goto err;
+	}
 
 	ret = cperf_get_op_functions(&opts, &op_fns);
 	if (ret) {
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v2 1/1 app/crypto-perf: Only run AEAD decrypt with valid test vector file.

The test dummy vector data is incorrect for AEAD decryption, so we should only run when passed a valid test vector file.

---
 app/test-crypto-perf/cperf_options_parsing.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
app/test-crypto-perf/cperf_options_parsing.c +17 -2
index 0e0dc4fd06..12623e4cfe 100644
@@ -1482,11 +1482,26 @@ cperf_options_check(struct cperf_options *options)
 		}
 	}
 
-	if (options->test == CPERF_TEST_TYPE_THROUGHPUT &&
+	if ((options->test == CPERF_TEST_TYPE_THROUGHPUT ||
+	    options->test == CPERF_TEST_TYPE_LATENCY) &&
 	    (options->aead_op == RTE_CRYPTO_AEAD_OP_DECRYPT ||
 	     options->auth_op == RTE_CRYPTO_AUTH_OP_VERIFY) &&
 	    !options->out_of_place) {
-		RTE_LOG(ERR, USER1, "Only out-of-place is allowed in throughput decryption.\n");
+		RTE_LOG(ERR, USER1, "Only out-of-place is allowed in throughput and"
+			    " latency decryption.\n");
+		return -EINVAL;
+	}
+
+	if ((options->test == CPERF_TEST_TYPE_THROUGHPUT ||
+		 options->test == CPERF_TEST_TYPE_LATENCY) &&
+	    (options->aead_op == RTE_CRYPTO_AEAD_OP_DECRYPT ||
+	     options->auth_op == RTE_CRYPTO_AUTH_OP_VERIFY) &&
+		 options->test_name == NULL &&
+		 options->test_file == NULL) {
+		RTE_LOG(ERR, USER1, "Define path to the file with test"
+				" vectors.\n");
+		RTE_LOG(ERR, USER1, "Define test name to get the correct digest"
+				" from the test vectors.\n");
 		return -EINVAL;
 	}
 
Signature · 1 line
2.34.1
Acked-by on v2 1/1
#2 lore raw

________________________________
From: Finn, Emma <[email protected]>
Sent: Tuesday, July 29, 2025 10:50
To: Ji, Kai <[email protected]>
Cc: [email protected] <[email protected]>; [email protected] <[email protected]>; Finn, Emma <[email protected]>
Subject: [v2] app/crypto-perf: Only run AEAD decrypt with valid test vector file.

The test dummy vector data is incorrect for AEAD decryption, so we should only run when passed a valid test vector file.

---
 app/test-crypto-perf/cperf_options_parsing.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
app/test-crypto-perf/cperf_options_parsing.c +17 -2
index 0e0dc4fd06..12623e4cfe 100644
@@ -1482,11 +1482,26 @@ cperf_options_check(struct cperf_options *options)
                 }
         }
 
-       if (options->test == CPERF_TEST_TYPE_THROUGHPUT &&
+       if ((options->test == CPERF_TEST_TYPE_THROUGHPUT ||
+           options->test == CPERF_TEST_TYPE_LATENCY) &&
             (options->aead_op == RTE_CRYPTO_AEAD_OP_DECRYPT ||
              options->auth_op == RTE_CRYPTO_AUTH_OP_VERIFY) &&
             !options->out_of_place) {
-               RTE_LOG(ERR, USER1, "Only out-of-place is allowed in throughput decryption.\n");
+               RTE_LOG(ERR, USER1, "Only out-of-place is allowed in throughput and"
+                           " latency decryption.\n");
+               return -EINVAL;
+       }
+
+       if ((options->test == CPERF_TEST_TYPE_THROUGHPUT ||
+                options->test == CPERF_TEST_TYPE_LATENCY) &&
+           (options->aead_op == RTE_CRYPTO_AEAD_OP_DECRYPT ||
+            options->auth_op == RTE_CRYPTO_AUTH_OP_VERIFY) &&
+                options->test_name == NULL &&
+                options->test_file == NULL) {
+               RTE_LOG(ERR, USER1, "Define path to the file with test"
+                               " vectors.\n");
+               RTE_LOG(ERR, USER1, "Define test name to get the correct digest"
+                               " from the test vectors.\n");
                 return -EINVAL;
         }
 

--
2.34.1