DPDK patches and discussions
 help / color / mirror / Atom feed
From: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
To: declan.doherty@intel.com
Cc: dev@dpdk.org, Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
Subject: [dpdk-dev] [PATCH] app/test-crypto-perf: fix segmentation fault when use qat pmd
Date: Thu,  9 Feb 2017 14:52:23 +0100	[thread overview]
Message-ID: <1486648343-28944-1-git-send-email-slawomirx.mrozowicz@intel.com> (raw)

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@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

             reply	other threads:[~2017-02-09 11:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-09 13:52 Slawomir Mrozowicz [this message]
2017-02-09 13:57 ` [dpdk-dev] [PATCH v2] " Slawomir Mrozowicz
2017-02-10 11:25   ` De Lara Guarch, Pablo
2017-02-10 11:48     ` De Lara Guarch, Pablo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1486648343-28944-1-git-send-email-slawomirx.mrozowicz@intel.com \
    --to=slawomirx.mrozowicz@intel.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).