From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D2F4BA0519; Fri, 3 Jul 2020 07:42:28 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 07BC61D916; Fri, 3 Jul 2020 07:42:28 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 8C3991D913; Fri, 3 Jul 2020 07:42:26 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0635ds1m011402; Thu, 2 Jul 2020 22:42:25 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0818; bh=UBUsj/u4ncmqPcJbxu/YZE2ki89IUoO9BiYSgGauUtk=; b=dMz49ls2+NsSJTvjbs6rfrZCy1jSDDhiw8OLMfli9GutC/xG9TuOuprHyiiJTTm65tlY upwre+0vNLkCWwO7d7TofLLK9x8qrTmcx545/Yuj8awAVT7snsPhc2emQQoTBYV4RUsM ujO7A9k9Ozsmrg7C8KVTeW2LGJTnz8ntKRP0M0Ln5WcA2pfhEapsCigeI6U9Yhr1WkzR oLC1BOQzonYgg/Cfm1Drc4dXAxT8b28pk+4yvGNCJtZM0IasJhFdyyTimVbF01jFV8a4 HnUZtLyQSvj9AOmcBscMcTnXgTC9gMHxP+SzqRUBFmEA6NAjCpcjI+45cKWgIUcVHg+C nw== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 321m92tc6v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 02 Jul 2020 22:42:25 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 2 Jul 2020 22:42:24 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 2 Jul 2020 22:42:24 -0700 Received: from hyd1349.t110.caveonetworks.com (unknown [10.29.45.13]) by maili.marvell.com (Postfix) with ESMTP id AF5833F703F; Thu, 2 Jul 2020 22:42:22 -0700 (PDT) From: Ankur Dwivedi To: CC: , , , Ankur Dwivedi , Date: Fri, 3 Jul 2020 11:11:37 +0530 Message-ID: <1593754904-1264-1-git-send-email-adwivedi@marvell.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1591853907-2501-1-git-send-email-adwivedi@marvell.com> References: <1591853907-2501-1-git-send-email-adwivedi@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-03_01:2020-07-02, 2020-07-03 signatures=0 Subject: [dpdk-dev] [PATCH v2 1/8] common/cpt: fix encryption offset X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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