[dpdk-dev] [PATCH] app/test-crypto-perf: fix segmentation fault when use qat pmd

Slawomir Mrozowicz slawomirx.mrozowicz at intel.com
Thu Feb 9 14:52:23 CET 2017


Fix segmentation fault happened when use QAT PMD's kasumi, snow3g or zug
algorithm to do cipher-then-auth performance test application.
The mentioned algorithms required authentication key data be set value
equal to cipher key data.

Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test application")

Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz at intel.com>
---
 app/test-crypto-perf/cperf_test_vectors.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/app/test-crypto-perf/cperf_test_vectors.c b/app/test-crypto-perf/cperf_test_vectors.c
index e47a581..a27565f 100644
--- a/app/test-crypto-perf/cperf_test_vectors.c
+++ b/app/test-crypto-perf/cperf_test_vectors.c
@@ -439,14 +439,25 @@ cperf_test_vector_get_dummy(struct cperf_options *options)
 			t_vec->aad.data = NULL;
 		} else if (options->auth_algo == RTE_CRYPTO_AUTH_AES_GCM ||
 				options->auth_algo ==
-						RTE_CRYPTO_AUTH_AES_GMAC ||
-				options->auth_algo ==
+						RTE_CRYPTO_AUTH_AES_GMAC) {
+			t_vec->auth_key.data = NULL;
+			t_vec->aad.data = rte_malloc(NULL, options->auth_aad_sz,
+					16);
+			if (t_vec->aad.data == NULL) {
+				if (options->op_type !=	CPERF_AUTH_ONLY)
+					rte_free(t_vec->iv.data);
+				rte_free(t_vec);
+				return NULL;
+			}
+			memcpy(t_vec->aad.data, aad, options->auth_aad_sz);
+		} else if (options->auth_algo ==
 						RTE_CRYPTO_AUTH_SNOW3G_UIA2 ||
 				options->auth_algo ==
 						RTE_CRYPTO_AUTH_KASUMI_F9 ||
 				options->auth_algo ==
 						RTE_CRYPTO_AUTH_ZUC_EIA3) {
-			t_vec->auth_key.data = NULL;
+			/* auth key should be the same as cipher key */
+			t_vec->auth_key.data = cipher_key;
 			t_vec->aad.data = rte_malloc(NULL, options->auth_aad_sz,
 					16);
 			if (t_vec->aad.data == NULL) {
-- 
2.5.0



More information about the dev mailing list