DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/test-crypto-perf: fix segmentation fault when use qat pmd
@ 2017-02-09 13:52 Slawomir Mrozowicz
  2017-02-09 13:57 ` [dpdk-dev] [PATCH v2] " Slawomir Mrozowicz
  0 siblings, 1 reply; 4+ messages in thread
From: Slawomir Mrozowicz @ 2017-02-09 13:52 UTC (permalink / raw)
  To: declan.doherty; +Cc: dev, Slawomir Mrozowicz

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH v2] app/test-crypto-perf: fix segmentation fault when use qat pmd
  2017-02-09 13:52 [dpdk-dev] [PATCH] app/test-crypto-perf: fix segmentation fault when use qat pmd Slawomir Mrozowicz
@ 2017-02-09 13:57 ` Slawomir Mrozowicz
  2017-02-10 11:25   ` De Lara Guarch, Pablo
  0 siblings, 1 reply; 4+ messages in thread
From: Slawomir Mrozowicz @ 2017-02-09 13:57 UTC (permalink / raw)
  To: declan.doherty; +Cc: dev, Slawomir Mrozowicz

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.
This patch fix issue that gmac algorithm 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>
---
v2 changes:
- kasumi, snow3g or zug have differ auth and cipher key data
---
 app/test-crypto-perf/cperf_test_vectors.c | 44 +++++++++++++++++++++----------
 1 file changed, 30 insertions(+), 14 deletions(-)

diff --git a/app/test-crypto-perf/cperf_test_vectors.c b/app/test-crypto-perf/cperf_test_vectors.c
index e47a581..6307f25 100644
--- a/app/test-crypto-perf/cperf_test_vectors.c
+++ b/app/test-crypto-perf/cperf_test_vectors.c
@@ -433,22 +433,39 @@ cperf_test_vector_get_dummy(struct cperf_options *options)
 			options->op_type == CPERF_CIPHER_THEN_AUTH ||
 			options->op_type == CPERF_AUTH_THEN_CIPHER ||
 			options->op_type == CPERF_AEAD) {
+		uint8_t aad_alloc = 0;
+
 		t_vec->auth_key.length = options->auth_key_sz;
-		if (options->auth_algo == RTE_CRYPTO_AUTH_NULL) {
+
+		switch (options->auth_algo) {
+		case RTE_CRYPTO_AUTH_NULL:
 			t_vec->auth_key.data = NULL;
-			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_SNOW3G_UIA2 ||
-				options->auth_algo ==
-						RTE_CRYPTO_AUTH_KASUMI_F9 ||
-				options->auth_algo ==
-						RTE_CRYPTO_AUTH_ZUC_EIA3) {
+			aad_alloc = 0;
+			break;
+		case RTE_CRYPTO_AUTH_AES_GCM:
 			t_vec->auth_key.data = NULL;
-			t_vec->aad.data = rte_malloc(NULL, options->auth_aad_sz,
-					16);
+			aad_alloc = 1;
+			break;
+		case RTE_CRYPTO_AUTH_SNOW3G_UIA2:
+		case RTE_CRYPTO_AUTH_KASUMI_F9:
+		case RTE_CRYPTO_AUTH_ZUC_EIA3:
+			t_vec->auth_key.data = auth_key;
+			aad_alloc = 1;
+			break;
+		case RTE_CRYPTO_AUTH_AES_GMAC:
+			/* auth key should be the same as cipher key */
+			t_vec->auth_key.data = cipher_key;
+			aad_alloc = 1;
+			break;
+		default:
+			t_vec->auth_key.data = auth_key;
+			aad_alloc = 0;
+			break;
+		}
+
+		if (aad_alloc) {
+			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);
@@ -457,7 +474,6 @@ cperf_test_vector_get_dummy(struct cperf_options *options)
 			}
 			memcpy(t_vec->aad.data, aad, options->auth_aad_sz);
 		} else {
-			t_vec->auth_key.data = auth_key;
 			t_vec->aad.data = NULL;
 		}
 
-- 
2.5.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH v2] app/test-crypto-perf: fix segmentation fault when use qat pmd
  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
  0 siblings, 1 reply; 4+ messages in thread
From: De Lara Guarch, Pablo @ 2017-02-10 11:25 UTC (permalink / raw)
  To: Mrozowicz, SlawomirX, Doherty, Declan; +Cc: dev, Mrozowicz, SlawomirX

Hi Slawomir,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Slawomir
> Mrozowicz
> Sent: Thursday, February 09, 2017 1:57 PM
> To: Doherty, Declan
> Cc: dev@dpdk.org; Mrozowicz, SlawomirX
> Subject: [dpdk-dev] [PATCH v2] app/test-crypto-perf: fix segmentation fault
> when use qat pmd
> 
> 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.
> This patch fix issue that gmac algorithm 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>

This also happened for other SW PMDs and not just QAT, but an incorrect implementation in them was hiding this issue.
I will reword this commit. Also, make sure to run check-git-log.sh next time, as I am seeing:

Wrong headline lowercase:
        app/test-crypto-perf: fix segmentation fault when use qat pmd
Headline too long:
        app/test-crypto-perf: fix segmentation fault when use qat pmd

Apart from this,

Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH v2] app/test-crypto-perf: fix segmentation fault when use qat pmd
  2017-02-10 11:25   ` De Lara Guarch, Pablo
@ 2017-02-10 11:48     ` De Lara Guarch, Pablo
  0 siblings, 0 replies; 4+ messages in thread
From: De Lara Guarch, Pablo @ 2017-02-10 11:48 UTC (permalink / raw)
  To: De Lara Guarch, Pablo, Mrozowicz, SlawomirX, Doherty, Declan
  Cc: dev, Mrozowicz, SlawomirX



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of De Lara Guarch,
> Pablo
> Sent: Friday, February 10, 2017 11:26 AM
> To: Mrozowicz, SlawomirX; Doherty, Declan
> Cc: dev@dpdk.org; Mrozowicz, SlawomirX
> Subject: Re: [dpdk-dev] [PATCH v2] app/test-crypto-perf: fix segmentation
> fault when use qat pmd
> 
> Hi Slawomir,
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Slawomir
> > Mrozowicz
> > Sent: Thursday, February 09, 2017 1:57 PM
> > To: Doherty, Declan
> > Cc: dev@dpdk.org; Mrozowicz, SlawomirX
> > Subject: [dpdk-dev] [PATCH v2] app/test-crypto-perf: fix segmentation
> fault
> > when use qat pmd
> >
> > 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.
> > This patch fix issue that gmac algorithm 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>
> 
> This also happened for other SW PMDs and not just QAT, but an incorrect
> implementation in them was hiding this issue.
> I will reword this commit. Also, make sure to run check-git-log.sh next time,
> as I am seeing:
> 
> Wrong headline lowercase:
>         app/test-crypto-perf: fix segmentation fault when use qat pmd
> Headline too long:
>         app/test-crypto-perf: fix segmentation fault when use qat pmd
> 
> Apart from this,
> 
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> 

Applied to dpdk-next-crypto.
Thanks,

Pablo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-02-10 11:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-09 13:52 [dpdk-dev] [PATCH] app/test-crypto-perf: fix segmentation fault when use qat pmd Slawomir Mrozowicz
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

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).