All of lore.kernel.org
 help / color / mirror / Atom feed
* [dpdk-dev] test/crypto: copy offset data to oop dst buffer
@ 2021-05-04 23:26 Kai Ji
  2021-05-05 14:45 ` [dpdk-dev] [dpdk-dev v2] " Kai Ji
  0 siblings, 1 reply; 3+ messages in thread
From: Kai Ji @ 2021-05-04 23:26 UTC (permalink / raw)
  To: dev; +Cc: adamx.dybkowski, roy.fan.zhang, Kai Ji

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>
---
 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 d6956f9c2e..366d06becc 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -2386,6 +2386,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.


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

* [dpdk-dev] [dpdk-dev v2] test/crypto: copy offset data to oop dst buffer
  2021-05-04 23:26 [dpdk-dev] test/crypto: copy offset data to oop dst buffer Kai Ji
@ 2021-05-05 14:45 ` Kai Ji
  2021-05-05 15:23   ` [dpdk-dev] [EXT] " Akhil Goyal
  0 siblings, 1 reply; 3+ messages in thread
From: Kai Ji @ 2021-05-05 14:45 UTC (permalink / raw)
  To: dev; +Cc: adamx.dybkowski, roy.fan.zhang, Kai Ji

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.


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

* Re: [dpdk-dev] [EXT] [dpdk-dev v2] test/crypto: copy offset data to oop dst buffer
  2021-05-05 14:45 ` [dpdk-dev] [dpdk-dev v2] " Kai Ji
@ 2021-05-05 15:23   ` Akhil Goyal
  0 siblings, 0 replies; 3+ messages in thread
From: Akhil Goyal @ 2021-05-05 15:23 UTC (permalink / raw)
  To: Kai Ji, dev; +Cc: adamx.dybkowski, roy.fan.zhang

> 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
> 
Applied to dpdk-next-crypto

Thanks.

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

end of thread, other threads:[~2021-05-05 15:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-04 23:26 [dpdk-dev] test/crypto: copy offset data to oop dst buffer Kai Ji
2021-05-05 14:45 ` [dpdk-dev] [dpdk-dev v2] " Kai Ji
2021-05-05 15:23   ` [dpdk-dev] [EXT] " Akhil Goyal

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.