[PATCH] app/crypto-perf: fix plaintext size exceeds buffer size

Ji, Kai kai.ji at intel.com
Wed Sep 3 17:45:58 CEST 2025


Acked-by: Kai Ji <kai.ji at intel.com>

________________________________
From: Shani Peretz <shperetz at nvidia.com>
Sent: 05 August 2025 07:38
To: dev at dpdk.org <dev at dpdk.org>
Cc: suanmingm at nvidia.com <suanmingm at nvidia.com>; Shani Peretz <shperetz at nvidia.com>; stable at dpdk.org <stable at dpdk.org>; Ji, Kai <kai.ji at intel.com>; Kobylinski, Michal <michal.kobylinski at intel.com>; Slawomir Mrozowicz <slawomirx.mrozowicz at intel.com>; Marcin Kerlin <marcinx.kerlin at intel.com>; Piotr Azarewicz <piotr.azarewicz at intel.com>; Doherty, Declan <declan.doherty at intel.com>
Subject: [PATCH] app/crypto-perf: fix plaintext size exceeds buffer size

When test vector plaintext exceeds buffer size, only the first
max_buffer_size bytes are processed, causing incorrect digest
verification (computed vs expected mismatch).

This patch fixes this issue by checking that the plaintext size is
larger than the buffer size and returns an error with a log.

Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test application")
Cc: stable at dpdk.org

Signed-off-by: Shani Peretz <shperetz at nvidia.com>
---
 app/test-crypto-perf/cperf_test_vector_parsing.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/app/test-crypto-perf/cperf_test_vector_parsing.c b/app/test-crypto-perf/cperf_test_vector_parsing.c
index 737d61d4af..04ca9cf019 100644
--- a/app/test-crypto-perf/cperf_test_vector_parsing.c
+++ b/app/test-crypto-perf/cperf_test_vector_parsing.c
@@ -308,6 +308,12 @@ parse_entry(char *entry, struct cperf_test_vector *vector,
         if (strstr(key_token, "plaintext")) {
                 rte_free(vector->plaintext.data);
                 vector->plaintext.data = data;
+
+               if (opts->test == CPERF_TEST_TYPE_VERIFY && data_length > opts->max_buffer_size) {
+                       printf("Global plaintext larger than buffer_sz\n");
+                       return -1;
+               }
+
                 if (tc_found)
                         vector->plaintext.length = data_length;
                 else {
--
2.34.1

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mails.dpdk.org/archives/dev/attachments/20250903/b43fc67a/attachment-0001.htm>


More information about the dev mailing list