DPDK patches and discussions
 help / color / mirror / Atom feed
From: Suanming Mou <suanmingm@nvidia.com>
To: Ciara Power <ciara.power@intel.com>
Cc: <dev@dpdk.org>
Subject: [PATCH 2/2] app/test-crypto-perf: fix encrypt operation verify
Date: Wed, 3 Jan 2024 11:56:05 +0800	[thread overview]
Message-ID: <20240103035605.720256-2-suanmingm@nvidia.com> (raw)
In-Reply-To: <20240103035605.720256-1-suanmingm@nvidia.com>

AEAD users RTE_CRYPTO_AEAD_OP_* with aead_op and CIPHER uses
RTE_CRYPTO_CIPHER_OP_* with cipher_op in current code.

This commit aligns aead_op and cipher_op operation to fix
incorrect AEAD verification.

Fixes: df52cb3b6e13 ("app/crypto-perf: move verify as single test type")

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
---
 app/test-crypto-perf/cperf_test_verify.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c
index 8aa714b969..525a2b1373 100644
--- a/app/test-crypto-perf/cperf_test_verify.c
+++ b/app/test-crypto-perf/cperf_test_verify.c
@@ -113,6 +113,7 @@ cperf_verify_op(struct rte_crypto_op *op,
 	uint8_t *data;
 	uint32_t cipher_offset, auth_offset;
 	uint8_t	cipher, auth;
+	bool is_encrypt = false;
 	int res = 0;
 
 	if (op->status != RTE_CRYPTO_OP_STATUS_SUCCESS)
@@ -154,12 +155,14 @@ cperf_verify_op(struct rte_crypto_op *op,
 		cipher_offset = 0;
 		auth = 0;
 		auth_offset = 0;
+		is_encrypt = options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT;
 		break;
 	case CPERF_CIPHER_THEN_AUTH:
 		cipher = 1;
 		cipher_offset = 0;
 		auth = 1;
 		auth_offset = options->test_buffer_size;
+		is_encrypt = options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT;
 		break;
 	case CPERF_AUTH_ONLY:
 		cipher = 0;
@@ -172,12 +175,14 @@ cperf_verify_op(struct rte_crypto_op *op,
 		cipher_offset = 0;
 		auth = 1;
 		auth_offset = options->test_buffer_size;
+		is_encrypt = options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT;
 		break;
 	case CPERF_AEAD:
 		cipher = 1;
 		cipher_offset = 0;
-		auth = 1;
+		auth = options->aead_op == RTE_CRYPTO_AEAD_OP_ENCRYPT;
 		auth_offset = options->test_buffer_size;
+		is_encrypt = !!auth;
 		break;
 	default:
 		res = 1;
@@ -185,7 +190,7 @@ cperf_verify_op(struct rte_crypto_op *op,
 	}
 
 	if (cipher == 1) {
-		if (options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT)
+		if (is_encrypt)
 			res += !!memcmp(data + cipher_offset,
 					vector->ciphertext.data,
 					options->test_buffer_size);
-- 
2.34.1


  reply	other threads:[~2024-01-03  3:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-03  3:56 [PATCH 1/2] app/test-crypto-perf: fix invalid memcmp results Suanming Mou
2024-01-03  3:56 ` Suanming Mou [this message]
2024-01-04  5:13   ` [EXT] [PATCH 2/2] app/test-crypto-perf: fix encrypt operation verify Anoob Joseph
2024-01-04  8:56     ` Suanming Mou
2024-01-03 11:33 ` [EXT] [PATCH 1/2] app/test-crypto-perf: fix invalid memcmp results Anoob Joseph
2024-01-05  0:03 ` [PATCH v2 " Suanming Mou
2024-01-05  0:03   ` [PATCH v2 2/2] app/test-crypto-perf: fix encrypt operation verify Suanming Mou
2024-01-05  4:44     ` [EXT] " Anoob Joseph
2024-01-12 16:21   ` [PATCH v2 1/2] app/test-crypto-perf: fix invalid memcmp results Power, Ciara
2024-02-01  8:47   ` [EXT] " 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=20240103035605.720256-2-suanmingm@nvidia.com \
    --to=suanmingm@nvidia.com \
    --cc=ciara.power@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).