All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bernard Iremonger <bernard.iremonger@intel.com>
To: dev@dpdk.org, konstantin.ananyev@intel.com, akhil.goyal@nxp.com
Cc: Bernard Iremonger <bernard.iremonger@intel.com>
Subject: [PATCH v3] app/test/ipsec: fix test initialisation
Date: Thu,  4 Apr 2019 15:51:51 +0100	[thread overview]
Message-ID: <1554389511-6355-1-git-send-email-bernard.iremonger@intel.com> (raw)
In-Reply-To: <1553262462-28370-1-git-send-email-bernard.iremonger@intel.com>

Fix xform initialisation.
Fix testsuite_setup.
Remove unused variables.

Fixes: 05fe65eb66b2 ("test/ipsec: introduce functional test")
Fixes: 59d7353b0df0 ("test/ipsec: fix test suite setup")

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
Changes in v3:
drop changes to logic around rte_cryptodev_dequeue_burst()

 app/test/test_ipsec.c | 34 +++++++++++++++-------------------
 1 file changed, 15 insertions(+), 19 deletions(-)

diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c
index 80a2d25..29fab92 100644
--- a/app/test/test_ipsec.c
+++ b/app/test/test_ipsec.c
@@ -79,7 +79,6 @@ struct ipsec_unitest_params {
 	struct rte_mbuf *obuf[BURST_SIZE], *ibuf[BURST_SIZE],
 		*testbuf[BURST_SIZE];
 
-	uint8_t *digest;
 	uint16_t pkt_index;
 };
 
@@ -111,8 +110,6 @@ static struct ipsec_testsuite_params testsuite_params = { NULL };
 static struct ipsec_unitest_params unittest_params;
 static struct user_params uparams;
 
-static uint8_t global_key[128] = { 0 };
-
 struct supported_cipher_algo {
 	const char *keyword;
 	enum rte_crypto_cipher_algorithm algo;
@@ -215,30 +212,26 @@ fill_crypto_xform(struct ipsec_unitest_params *ut_params,
 	const struct supported_auth_algo *auth_algo,
 	const struct supported_cipher_algo *cipher_algo)
 {
-	ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
-	ut_params->auth_xform.auth.algo = auth_algo->algo;
-	ut_params->auth_xform.auth.key.data = global_key;
-	ut_params->auth_xform.auth.key.length = auth_algo->key_len;
-	ut_params->auth_xform.auth.digest_length = auth_algo->digest_len;
-	ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_VERIFY;
-
 	ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
 	ut_params->cipher_xform.cipher.algo = cipher_algo->algo;
-	ut_params->cipher_xform.cipher.key.data = global_key;
-	ut_params->cipher_xform.cipher.key.length = cipher_algo->key_len;
-	ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_DECRYPT;
-	ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
-	ut_params->cipher_xform.cipher.iv.length = cipher_algo->iv_len;
+	ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+	ut_params->auth_xform.auth.algo = auth_algo->algo;
 
 	if (ut_params->ipsec_xform.direction ==
 			RTE_SECURITY_IPSEC_SA_DIR_INGRESS) {
-		ut_params->crypto_xforms = &ut_params->auth_xform;
-		ut_params->auth_xform.next = &ut_params->cipher_xform;
+		ut_params->cipher_xform.cipher.op =
+			RTE_CRYPTO_CIPHER_OP_DECRYPT;
+		ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_VERIFY;
 		ut_params->cipher_xform.next = NULL;
+		ut_params->auth_xform.next = &ut_params->cipher_xform;
+		ut_params->crypto_xforms = &ut_params->auth_xform;
 	} else {
-		ut_params->crypto_xforms = &ut_params->cipher_xform;
-		ut_params->cipher_xform.next = &ut_params->auth_xform;
+		ut_params->cipher_xform.cipher.op =
+			RTE_CRYPTO_CIPHER_OP_ENCRYPT;
+		ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
 		ut_params->auth_xform.next = NULL;
+		ut_params->cipher_xform.next = &ut_params->auth_xform;
+		ut_params->crypto_xforms = &ut_params->cipher_xform;
 	}
 }
 
@@ -287,9 +280,12 @@ testsuite_setup(void)
 	int rc;
 
 	memset(ts_params, 0, sizeof(*ts_params));
+	memset(ut_params, 0, sizeof(*ut_params));
+	memset(&uparams, 0, sizeof(struct user_params));
 
 	uparams.auth = RTE_CRYPTO_SYM_XFORM_AUTH;
 	uparams.cipher = RTE_CRYPTO_SYM_XFORM_CIPHER;
+	uparams.aead = RTE_CRYPTO_SYM_XFORM_NOT_SPECIFIED;
 	strcpy(uparams.auth_algo, "null");
 	strcpy(uparams.cipher_algo, "null");
 
-- 
2.7.4

  parent reply	other threads:[~2019-04-04 14:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-20 12:14 [PATCH] test/ipsec: fix test initialisation Bernard Iremonger
2019-03-22 13:47 ` [PATCH v2] " Bernard Iremonger
2019-03-22 14:20   ` Akhil Goyal
2019-04-04 13:54     ` Iremonger, Bernard
2019-04-04 14:51   ` Bernard Iremonger [this message]
2019-04-05 11:12     ` [dpdk-dev] [PATCH v3] app/test/ipsec: " Ananyev, Konstantin
2019-04-16 14:58       ` Akhil Goyal

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=1554389511-6355-1-git-send-email-bernard.iremonger@intel.com \
    --to=bernard.iremonger@intel.com \
    --cc=akhil.goyal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.