From patchwork Mon May 2 08:20:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vamsi Attunuru X-Patchwork-Id: 110559 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BB69DA0093; Mon, 2 May 2022 10:21:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7409140F35; Mon, 2 May 2022 10:21:40 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 788B740E28 for ; Mon, 2 May 2022 10:21:38 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.5/8.16.1.2) with ESMTP id 2424iS3I006908 for ; Mon, 2 May 2022 01:21:37 -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=Jb7ZQv3n9ALZs2xBqlXEGXMQhaxjkiY/CPfAf71LXWY=; b=ghlHZgBqeU6UcoIyKTBTYYV091bg1x/erljDm8MVNiT1PIHrOsxldTtCB4Y2XPEN9ouB uuZakZqJCgUZvW1kdUzpKs1TNNYuILciAsn+Q4irWPK5+rK9HZ7PhsXHUaD1ADn3ifi8 7FbBG4Wtx/ShkNsWviiKVucU8IFjoUcRHikoiYfHCrIJYUmZLIOGDj5fmp47gbobkVn4 R7US/bilOIDwwoqn1fK73AkFlvktZcpuQtO/o6pLTl8EYEjL91VwfOcis9yHaWv2uujg iwLp1e1GChI8F/0yEnFj5vwU51X6oGgNWIhfCRXRgpZO5lcjVCkdBtlDjv8RfgtsIRoG 5w== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3fs2fmw4pb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 02 May 2022 01:21:37 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 2 May 2022 01:21:36 -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; Mon, 2 May 2022 01:21:35 -0700 Received: from localhost.localdomain (unknown [10.28.48.51]) by maili.marvell.com (Postfix) with ESMTP id 6F6253F707F; Mon, 2 May 2022 01:21:34 -0700 (PDT) From: Vamsi Attunuru To: CC: , , Subject: [PATCH v2 1/1] crypto/cnxk: enable 3des-cbc secure capability Date: Mon, 2 May 2022 13:50:58 +0530 Message-ID: <20220502082058.2100416-1-vattunuru@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220430053637.2065578-1-vattunuru@marvell.com> References: <20220430053637.2065578-1-vattunuru@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: wyx5T0SB8RJFP6IXmhUUNZBpMrBzBeKB X-Proofpoint-ORIG-GUID: wyx5T0SB8RJFP6IXmhUUNZBpMrBzBeKB X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-02_03,2022-04-28_01,2022-02-23_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Patch enables 3DES-CBC secure capability of crypto device. Signed-off-by: Vamsi Attunuru Acked-by: Akhil Goyal Acked-by: Anoob Joseph --- v2: add seperate key_len check for 3DES --- drivers/crypto/cnxk/cnxk_cryptodev.h | 2 +- .../crypto/cnxk/cnxk_cryptodev_capabilities.c | 24 +++++++++++++++++++ drivers/crypto/cnxk/cnxk_ipsec.h | 4 ++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/cnxk/cnxk_cryptodev.h b/drivers/crypto/cnxk/cnxk_cryptodev.h index b75d681185..8870021725 100644 --- a/drivers/crypto/cnxk/cnxk_cryptodev.h +++ b/drivers/crypto/cnxk/cnxk_cryptodev.h @@ -11,7 +11,7 @@ #include "roc_cpt.h" #define CNXK_CPT_MAX_CAPS 35 -#define CNXK_SEC_CRYPTO_MAX_CAPS 12 +#define CNXK_SEC_CRYPTO_MAX_CAPS 13 #define CNXK_SEC_MAX_CAPS 9 #define CNXK_AE_EC_ID_MAX 8 /** diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c b/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c index 98b002d93a..ba9eaf2325 100644 --- a/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c +++ b/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c @@ -862,6 +862,29 @@ static const struct rte_cryptodev_capabilities sec_caps_aes[] = { }, }; +static const struct rte_cryptodev_capabilities sec_caps_des[] = { + { /* 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 + } + }, } + }, } + } +}; + static const struct rte_cryptodev_capabilities sec_caps_sha1_sha2[] = { { /* SHA1 HMAC */ .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, @@ -1195,6 +1218,7 @@ sec_crypto_caps_populate(struct rte_cryptodev_capabilities cnxk_caps[], int cur_pos = 0; SEC_CAPS_ADD(cnxk_caps, &cur_pos, hw_caps, aes); + SEC_CAPS_ADD(cnxk_caps, &cur_pos, hw_caps, des); SEC_CAPS_ADD(cnxk_caps, &cur_pos, hw_caps, sha1_sha2); if (roc_model_is_cn10k()) diff --git a/drivers/crypto/cnxk/cnxk_ipsec.h b/drivers/crypto/cnxk/cnxk_ipsec.h index 171ea2774e..07ab2cf4ee 100644 --- a/drivers/crypto/cnxk/cnxk_ipsec.h +++ b/drivers/crypto/cnxk/cnxk_ipsec.h @@ -36,6 +36,10 @@ ipsec_xform_cipher_verify(struct rte_crypto_sym_xform *crypto_xform) return 0; } + if (crypto_xform->cipher.algo == RTE_CRYPTO_CIPHER_3DES_CBC && + crypto_xform->cipher.key.length == 24) + return 0; + return -ENOTSUP; }