From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 609D0A0558;
	Mon,  5 Sep 2022 15:34:15 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id EEAE642B8D;
	Mon,  5 Sep 2022 15:33:34 +0200 (CEST)
Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com
 [67.231.148.174])
 by mails.dpdk.org (Postfix) with ESMTP id 752B942B8C
 for <dev@dpdk.org>; Mon,  5 Sep 2022 15:33:33 +0200 (CEST)
Received: from pps.filterd (m0045849.ppops.net [127.0.0.1])
 by mx0a-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 285CWmie020367
 for <dev@dpdk.org>; Mon, 5 Sep 2022 06:33:32 -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-transfer-encoding : content-type; s=pfpt0220;
 bh=3Fh7V6H63g1rrHhtjqgrgw/bQ4hvkVVEgEEB5mJ39ec=;
 b=A7qo4DI1jtGaYEVojpyRxMCSVieI5whC/I0BwvkNUOJ9h2E6XzY2dhhBhhNwJBkaV1TY
 IXzoB0a5MThk38U4VyInUH4gPgjwK9D47ZbBgQCC2TqS1KdLp0S0G7srkfjMdAg0lyLi
 f/yJbunaUz0ryryn8jEax7FNdyu7+pqa2gS7mH/tINZEuO6JAbVfh4IYVohEfWRJy4rO
 1LbcS8zwXm7bebyGWrBeCQLOWwIn9Du2MjthNEs78EcagN1ArcLSGP6O0gQsLBYrNaxj
 R4BscZ2L0xjJWF46v3vmDPWhurzobejKG69QHwxNY6/e725u2paIbwAZIiaQtwbMYHnT 9Q== 
Received: from dc5-exch01.marvell.com ([199.233.59.181])
 by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3jc49qdv53-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)
 for <dev@dpdk.org>; Mon, 05 Sep 2022 06:33:32 -0700
Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com
 (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2;
 Mon, 5 Sep 2022 06:33:31 -0700
Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com
 (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend
 Transport; Mon, 5 Sep 2022 06:33:31 -0700
Received: from localhost.localdomain (unknown [10.29.52.204])
 by maili.marvell.com (Postfix) with ESMTP id 1DE635E6870;
 Mon,  5 Sep 2022 06:33:27 -0700 (PDT)
From: Nithin Dabilpuram <ndabilpuram@marvell.com>
To: Nithin Dabilpuram <ndabilpuram@marvell.com>, Kiran Kumar K
 <kirankumark@marvell.com>, Sunil Kumar Kori <skori@marvell.com>, Satha Rao
 <skoteshwar@marvell.com>, Ankur Dwivedi <adwivedi@marvell.com>,
 Anoob Joseph <anoobj@marvell.com>, Tejasree Kondoj <ktejasree@marvell.com>
CC: <jerinj@marvell.com>, <dev@dpdk.org>, Vidya Sagar Velumuri
 <vvelumuri@marvell.com>
Subject: [PATCH v2 20/31] net/cnxk: enable 3des-cbc cipher capability
Date: Mon, 5 Sep 2022 19:02:17 +0530
Message-ID: <20220905133228.818616-20-ndabilpuram@marvell.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20220905133228.818616-1-ndabilpuram@marvell.com>
References: <20220809184908.24030-1-ndabilpuram@marvell.com>
 <20220905133228.818616-1-ndabilpuram@marvell.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Proofpoint-GUID: M7T494r3JUnFk4aiwaZE5V0Ro2Ot-5Eq
X-Proofpoint-ORIG-GUID: M7T494r3JUnFk4aiwaZE5V0Ro2Ot-5Eq
X-Proofpoint-Virus-Version: vendor=baseguard
 engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1
 definitions=2022-09-05_09,2022-09-05_02,2022-06-22_01
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

From: Vidya Sagar Velumuri <vvelumuri@marvell.com>

Enable 3DES-CBC cipher capability for inline IPsec
processing.

Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>
---
 drivers/common/cnxk/cnxk_security.c |  3 +++
 drivers/crypto/cnxk/cn9k_ipsec.c    |  6 ++++++
 drivers/net/cnxk/cn9k_ethdev_sec.c  | 21 ++++++++++++++++++++-
 3 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/drivers/common/cnxk/cnxk_security.c b/drivers/common/cnxk/cnxk_security.c
index 89ac900d90..a44254931e 100644
--- a/drivers/common/cnxk/cnxk_security.c
+++ b/drivers/common/cnxk/cnxk_security.c
@@ -1033,6 +1033,9 @@ on_ipsec_sa_ctl_set(struct rte_security_ipsec_xform *ipsec,
 			case RTE_CRYPTO_CIPHER_NULL:
 				ctl->enc_type = ROC_IE_ON_SA_ENC_NULL;
 				break;
+			case RTE_CRYPTO_CIPHER_3DES_CBC:
+				ctl->enc_type = ROC_IE_ON_SA_ENC_3DES_CBC;
+				break;
 			case RTE_CRYPTO_CIPHER_AES_CBC:
 				ctl->enc_type = ROC_IE_ON_SA_ENC_AES_CBC;
 				aes_key_len = cipher_xform->cipher.key.length;
diff --git a/drivers/crypto/cnxk/cn9k_ipsec.c b/drivers/crypto/cnxk/cn9k_ipsec.c
index 84915581fc..3d37449907 100644
--- a/drivers/crypto/cnxk/cn9k_ipsec.c
+++ b/drivers/crypto/cnxk/cn9k_ipsec.c
@@ -248,6 +248,12 @@ cn9k_ipsec_xform_verify(struct rte_security_ipsec_xform *ipsec,
 				plt_err("Transport mode AES-CBC AES-XCBC is not supported");
 				return -ENOTSUP;
 			}
+
+			if ((cipher->algo == RTE_CRYPTO_CIPHER_3DES_CBC) &&
+			    (auth->algo == RTE_CRYPTO_AUTH_AES_XCBC_MAC)) {
+				plt_err("Transport mode 3DES-CBC AES-XCBC is not supported");
+				return -ENOTSUP;
+			}
 		}
 	}
 
diff --git a/drivers/net/cnxk/cn9k_ethdev_sec.c b/drivers/net/cnxk/cn9k_ethdev_sec.c
index 2dc9fe1580..9536a99c8e 100644
--- a/drivers/net/cnxk/cn9k_ethdev_sec.c
+++ b/drivers/net/cnxk/cn9k_ethdev_sec.c
@@ -30,7 +30,26 @@ static struct rte_cryptodev_capabilities cn9k_eth_sec_crypto_caps[] = {
 			}, },
 		}, }
 	},
-
+	{	/* 3DES CBC  */
+		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym = {
+			.xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+			{.cipher = {
+				.algo = RTE_CRYPTO_CIPHER_3DES_CBC,
+				.block_size = 8,
+				.key_size = {
+					.min = 24,
+					.max = 24,
+					.increment = 0
+				},
+				.iv_size = {
+					.min = 8,
+					.max = 16,
+					.increment = 8
+				}
+			}, },
+		}, }
+	},
 	{	/* AES GCM */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
 		{.sym = {
-- 
2.25.1