DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ankur Dwivedi <adwivedi@marvell.com>
To: <dev@dpdk.org>
Cc: <declan.doherty@intel.com>, <akhil.goyal@nxp.com>,
	<anoobj@marvell.com>, Ankur Dwivedi <adwivedi@marvell.com>,
	<stable@dpdk.org>
Subject: [dpdk-dev] [PATCH v2 1/8] common/cpt: fix encryption offset
Date: Fri, 3 Jul 2020 11:11:37 +0530	[thread overview]
Message-ID: <1593754904-1264-1-git-send-email-adwivedi@marvell.com> (raw)
In-Reply-To: <1591853907-2501-1-git-send-email-adwivedi@marvell.com>

In case of gmac auth the encryption offset should be set to zero.

Fixes: b74652f3a91f ("common/cpt: add microcode interface for encryption")
Fixes: 177b41ceee61 ("common/cpt: add microcode interface for decryption")
Cc: stable@dpdk.org

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
---
 drivers/common/cpt/cpt_ucode.h | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/drivers/common/cpt/cpt_ucode.h b/drivers/common/cpt/cpt_ucode.h
index 34ccd08..ab595eb 100644
--- a/drivers/common/cpt/cpt_ucode.h
+++ b/drivers/common/cpt/cpt_ucode.h
@@ -682,9 +682,6 @@
 	m_vaddr = (uint8_t *)m_vaddr + size;
 	m_dma += size;
 
-	if (hash_type == GMAC_TYPE)
-		encr_data_len = 0;
-
 	if (unlikely(!(flags & VALID_IV_BUF))) {
 		iv_len = 0;
 		iv_offset = ENCR_IV_OFFSET(d_offs);
@@ -716,6 +713,11 @@
 	opcode.s.major = CPT_MAJOR_OP_FC;
 	opcode.s.minor = 0;
 
+	if (hash_type == GMAC_TYPE) {
+		encr_offset = 0;
+		encr_data_len = 0;
+	}
+
 	auth_dlen = auth_offset + auth_data_len;
 	enc_dlen = encr_data_len + encr_offset;
 	if (unlikely(encr_data_len & 0xf)) {
@@ -726,11 +728,6 @@
 			enc_dlen = ROUNDUP16(encr_data_len) + encr_offset;
 	}
 
-	if (unlikely(hash_type == GMAC_TYPE)) {
-		encr_offset = auth_dlen;
-		enc_dlen = 0;
-	}
-
 	if (unlikely(auth_dlen > enc_dlen)) {
 		inputlen = auth_dlen;
 		outputlen = auth_dlen + mac_len;
@@ -1033,9 +1030,6 @@
 	hash_type = cpt_ctx->hash_type;
 	mac_len = cpt_ctx->mac_len;
 
-	if (hash_type == GMAC_TYPE)
-		encr_data_len = 0;
-
 	if (unlikely(!(flags & VALID_IV_BUF))) {
 		iv_len = 0;
 		iv_offset = ENCR_IV_OFFSET(d_offs);
@@ -1092,6 +1086,11 @@
 	opcode.s.major = CPT_MAJOR_OP_FC;
 	opcode.s.minor = 1;
 
+	if (hash_type == GMAC_TYPE) {
+		encr_offset = 0;
+		encr_data_len = 0;
+	}
+
 	enc_dlen = encr_offset + encr_data_len;
 	auth_dlen = auth_offset + auth_data_len;
 
@@ -1103,9 +1102,6 @@
 		outputlen = enc_dlen;
 	}
 
-	if (hash_type == GMAC_TYPE)
-		encr_offset = inputlen;
-
 	vq_cmd_w0.u64 = 0;
 	vq_cmd_w0.s.param1 = encr_data_len;
 	vq_cmd_w0.s.param2 = auth_data_len;
-- 
1.9.3


  parent reply	other threads:[~2020-07-03  5:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-11  5:38 [dpdk-dev] [PATCH 0/7] test/crypto: use generic crypto auto test framework Ankur Dwivedi
2020-06-11  5:38 ` [dpdk-dev] [PATCH 1/7] common/cpt: fix encryption offset Ankur Dwivedi
2020-07-01 20:24   ` Akhil Goyal
2020-07-02 13:18     ` Ankur Dwivedi
2020-06-11  5:38 ` [dpdk-dev] [PATCH 2/7] crypto/octeontx: remove stats callback Ankur Dwivedi
2020-06-11  5:38 ` [dpdk-dev] [PATCH 3/7] crypto/octeontx: set session private data Ankur Dwivedi
2020-06-11  5:38 ` [dpdk-dev] [PATCH 4/7] crypto/octeontx2: " Ankur Dwivedi
2020-06-11  5:38 ` [dpdk-dev] [PATCH 5/7] crypto/octeontx: remove unsupported feature Ankur Dwivedi
2020-07-01 20:27   ` Akhil Goyal
2020-07-02 13:20     ` Ankur Dwivedi
2020-06-11  5:38 ` [dpdk-dev] [PATCH 6/7] crypto/octeontx2: " Ankur Dwivedi
2020-06-11  5:38 ` [dpdk-dev] [PATCH 7/7] test/crypto: use generic cryptotests for OCTEON TX PMDs Ankur Dwivedi
2020-07-01 20:23   ` Akhil Goyal
2020-07-02 13:15     ` Ankur Dwivedi
2020-07-03  5:41 ` Ankur Dwivedi [this message]
2020-07-03  5:41   ` [dpdk-dev] [PATCH v2 2/8] crypto/octeontx: remove stats callback Ankur Dwivedi
2020-07-03  5:41   ` [dpdk-dev] [PATCH v2 3/8] crypto/octeontx: set session private data Ankur Dwivedi
2020-07-03  5:41   ` [dpdk-dev] [PATCH v2 4/8] crypto/octeontx2: " Ankur Dwivedi
2020-07-03  5:41   ` [dpdk-dev] [PATCH v2 5/8] crypto/octeontx: revert non-byte aligned data feature Ankur Dwivedi
2020-07-03  5:41   ` [dpdk-dev] [PATCH v2 6/8] crypto/octeontx2: " Ankur Dwivedi
2020-07-03  5:41   ` [dpdk-dev] [PATCH v2 7/8] test/crypto: remove PMD specific tests Ankur Dwivedi
2020-07-03  5:41   ` [dpdk-dev] [PATCH v2 8/8] test/crypto: use generic testsuite for OCTEON TX/TX2 Ankur Dwivedi
2020-07-04 19:57   ` [dpdk-dev] [PATCH v2 1/8] common/cpt: fix encryption offset 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=1593754904-1264-1-git-send-email-adwivedi@marvell.com \
    --to=adwivedi@marvell.com \
    --cc=akhil.goyal@nxp.com \
    --cc=anoobj@marvell.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=stable@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).