DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kai Ji <kai.ji@intel.com>
To: dev@dpdk.org
Cc: adamx.dybkowski@intel.com, roy.fan.zhang@intel.com,
	Kai Ji <kai.ji@intel.com>
Subject: [dpdk-dev] [dpdk-dev v2] test/crypto: copy offset data to oop dst buffer
Date: Wed,  5 May 2021 15:45:13 +0100	[thread overview]
Message-ID: <20210505144513.9851-1-kai.ji@intel.com> (raw)
In-Reply-To: <20210504232653.12741-1-kai.ji@intel.com>

Copy over the offset data required for auth in out-of-place op
when auth offset and cipher offset are not aligned.

Fixes: e847fc512817 ("test/crypto: add encrypted digest case for AES-CTR-CMAC")
Cc: adamx.dybkowski@intel.com

Signed-off-by: Kai Ji <kai.ji@intel.com>
---
v2:
   - rebase to head of for-main branch

app/test/test_cryptodev.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index a677a21e36..2bd4ff96cb 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -2629,6 +2629,21 @@ create_wireless_algo_auth_cipher_operation(
 	iv_ptr += cipher_iv_len;
 	rte_memcpy(iv_ptr, auth_iv, auth_iv_len);
 
+	/* Only copy over the offset data needed from src to dst in OOP,
+	 * if the auth and cipher offsets are not aligned
+	 */
+	if (op_mode == OUT_OF_PLACE) {
+		if (cipher_offset > auth_offset)
+			rte_memcpy(
+				rte_pktmbuf_mtod_offset(
+					sym_op->m_dst,
+					uint8_t *, auth_offset >> 3),
+				rte_pktmbuf_mtod_offset(
+					sym_op->m_src,
+					uint8_t *, auth_offset >> 3),
+				((cipher_offset >> 3) - (auth_offset >> 3)));
+	}
+
 	if (cipher_algo == RTE_CRYPTO_CIPHER_SNOW3G_UEA2 ||
 		cipher_algo == RTE_CRYPTO_CIPHER_KASUMI_F8 ||
 		cipher_algo == RTE_CRYPTO_CIPHER_ZUC_EEA3) {
-- 
2.17.1

--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.


  reply	other threads:[~2021-05-05 14:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-04 23:26 [dpdk-dev] " Kai Ji
2021-05-05 14:45 ` Kai Ji [this message]
2021-05-05 15:23   ` [dpdk-dev] [EXT] [dpdk-dev v2] " 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=20210505144513.9851-1-kai.ji@intel.com \
    --to=kai.ji@intel.com \
    --cc=adamx.dybkowski@intel.com \
    --cc=dev@dpdk.org \
    --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).