DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tejasree Kondoj <ktejasree@marvell.com>
To: Akhil Goyal <gakhil@marvell.com>, Ciara Power <ciara.power@intel.com>
Cc: Tejasree Kondoj <ktejasree@marvell.com>,
	Anoob Joseph <anoobj@marvell.com>,
	Fan Zhang <roy.fan.zhang@intel.com>, <dev@dpdk.org>
Subject: [PATCH] test/crypto-perf: allow auth generate followed by encryption
Date: Tue, 10 May 2022 18:10:45 +0530	[thread overview]
Message-ID: <20220510124045.22552-1-ktejasree@marvell.com> (raw)

Allowing auth generation followed by encryption mode.
--optype auth-then-cipher can take cipher-op as encrypt
and auth-op as generate now.

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
---
 app/test-crypto-perf/cperf_ops.c             |  4 +++
 app/test-crypto-perf/cperf_options_parsing.c | 30 ++++++++++++++------
 2 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c
index cbefce8d6c..93d2744c68 100644
--- a/app/test-crypto-perf/cperf_ops.c
+++ b/app/test-crypto-perf/cperf_ops.c
@@ -458,6 +458,10 @@ cperf_set_ops_cipher_auth(struct rte_crypto_op **ops,
 		} else
 			sym_op->cipher.data.length = options->test_buffer_size;
 
+		if ((options->auth_op == RTE_CRYPTO_AUTH_OP_GENERATE) &&
+				(options->op_type == CPERF_AUTH_THEN_CIPHER))
+			sym_op->cipher.data.length += options->digest_sz;
+
 		if (options->cipher_algo == RTE_CRYPTO_CIPHER_SNOW3G_UEA2 ||
 				options->cipher_algo == RTE_CRYPTO_CIPHER_KASUMI_F8 ||
 				options->cipher_algo == RTE_CRYPTO_CIPHER_ZUC_EEA3)
diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c
index 09c98121c8..566255bf2d 100644
--- a/app/test-crypto-perf/cperf_options_parsing.c
+++ b/app/test-crypto-perf/cperf_options_parsing.c
@@ -1130,6 +1130,20 @@ check_docsis_buffer_length(struct cperf_options *options)
 }
 #endif
 
+static bool
+is_valid_chained_op(struct cperf_options *options)
+{
+	if (options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT &&
+			options->auth_op == RTE_CRYPTO_AUTH_OP_GENERATE)
+		return true;
+
+	if (options->cipher_op == RTE_CRYPTO_CIPHER_OP_DECRYPT &&
+			options->auth_op == RTE_CRYPTO_AUTH_OP_VERIFY)
+		return true;
+
+	return false;
+}
+
 int
 cperf_options_check(struct cperf_options *options)
 {
@@ -1236,6 +1250,14 @@ cperf_options_check(struct cperf_options *options)
 		return -EINVAL;
 	}
 
+	if (options->op_type == CPERF_CIPHER_THEN_AUTH ||
+			options->op_type == CPERF_AUTH_THEN_CIPHER) {
+		if (!is_valid_chained_op(options)) {
+			RTE_LOG(ERR, USER1, "Invalid chained operation.\n");
+			return -EINVAL;
+		}
+	}
+
 	if (options->op_type == CPERF_CIPHER_THEN_AUTH) {
 		if (options->cipher_op != RTE_CRYPTO_CIPHER_OP_ENCRYPT &&
 				options->auth_op !=
@@ -1244,14 +1266,6 @@ cperf_options_check(struct cperf_options *options)
 					" options: encrypt and generate.\n");
 			return -EINVAL;
 		}
-	} else if (options->op_type == CPERF_AUTH_THEN_CIPHER) {
-		if (options->cipher_op != RTE_CRYPTO_CIPHER_OP_DECRYPT &&
-				options->auth_op !=
-				RTE_CRYPTO_AUTH_OP_VERIFY) {
-			RTE_LOG(ERR, USER1, "Option auth then cipher must use"
-					" options: decrypt and verify.\n");
-			return -EINVAL;
-		}
 	}
 
 	if (options->op_type == CPERF_CIPHER_ONLY ||
-- 
2.27.0


             reply	other threads:[~2022-05-10 11:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10 12:40 Tejasree Kondoj [this message]
2022-05-25 12:22 ` Akhil Goyal
2022-05-31 18:34   ` 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=20220510124045.22552-1-ktejasree@marvell.com \
    --to=ktejasree@marvell.com \
    --cc=anoobj@marvell.com \
    --cc=ciara.power@intel.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=roy.fan.zhang@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 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).