DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/crypto-perf: fix uninitialized values for null operations
@ 2017-02-24 15:26 Tomasz Kulasek
  2017-03-06 14:08 ` De Lara Guarch, Pablo
  0 siblings, 1 reply; 3+ messages in thread
From: Tomasz Kulasek @ 2017-02-24 15:26 UTC (permalink / raw)
  To: dev; +Cc: pablo.de.lara.guarch

Some values are uninitialized for "cipher null" and "auth null"
operations. It may cause unpredictable results for some crypto pmd
drivers, or even segmentation fault.

This patch sets values for null operations to zero.

Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test application")
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
---
 app/test-crypto-perf/cperf_ops.c          | 16 ++++++++++++++++
 app/test-crypto-perf/cperf_test_vectors.c |  2 +-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c
index b8c0398..1795a37 100644
--- a/app/test-crypto-perf/cperf_ops.c
+++ b/app/test-crypto-perf/cperf_ops.c
@@ -333,6 +333,9 @@
 					test_vector->cipher_key.data;
 			cipher_xform.cipher.key.length =
 					test_vector->cipher_key.length;
+		} else {
+			cipher_xform.cipher.key.data = NULL;
+			cipher_xform.cipher.key.length = 0;
 		}
 		/* create crypto session */
 		sess = rte_cryptodev_sym_session_create(dev_id,	&cipher_xform);
@@ -354,6 +357,11 @@
 			auth_xform.auth.key.length =
 					test_vector->auth_key.length;
 			auth_xform.auth.key.data = test_vector->auth_key.data;
+		} else {
+			auth_xform.auth.digest_length = 0;
+			auth_xform.auth.add_auth_data_length = 0;
+			auth_xform.auth.key.length = 0;
+			auth_xform.auth.key.data = NULL;
 		}
 		/* create crypto session */
 		sess =  rte_cryptodev_sym_session_create(dev_id, &auth_xform);
@@ -378,6 +386,9 @@
 					test_vector->cipher_key.data;
 			cipher_xform.cipher.key.length =
 					test_vector->cipher_key.length;
+		} else {
+			cipher_xform.cipher.key.data = NULL;
+			cipher_xform.cipher.key.length = 0;
 		}
 
 		/*
@@ -404,6 +415,11 @@
 				auth_xform.auth.key.data =
 						test_vector->auth_key.data;
 			}
+		} else {
+			auth_xform.auth.digest_length = 0;
+			auth_xform.auth.add_auth_data_length = 0;
+			auth_xform.auth.key.length = 0;
+			auth_xform.auth.key.data = NULL;
 		}
 
 		/* create crypto session for aes gcm */
diff --git a/app/test-crypto-perf/cperf_test_vectors.c b/app/test-crypto-perf/cperf_test_vectors.c
index 6307f25..f7b3aa9 100644
--- a/app/test-crypto-perf/cperf_test_vectors.c
+++ b/app/test-crypto-perf/cperf_test_vectors.c
@@ -406,7 +406,7 @@ struct cperf_test_vector*
 			options->op_type == CPERF_AUTH_THEN_CIPHER ||
 			options->op_type == CPERF_AEAD) {
 		if (options->cipher_algo == RTE_CRYPTO_CIPHER_NULL) {
-			t_vec->cipher_key.length = -1;
+			t_vec->cipher_key.length = 0;
 			t_vec->ciphertext.data = plaintext;
 			t_vec->cipher_key.data = NULL;
 			t_vec->iv.data = NULL;
-- 
1.9.1

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

end of thread, other threads:[~2017-03-21 16:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-24 15:26 [dpdk-dev] [PATCH] app/crypto-perf: fix uninitialized values for null operations Tomasz Kulasek
2017-03-06 14:08 ` De Lara Guarch, Pablo
2017-03-21 16:19   ` 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).