From patchwork Wed Oct 19 14:15:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejasree Kondoj X-Patchwork-Id: 118579 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 44BD0A06C8; Wed, 19 Oct 2022 16:15:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CD8EC42BEE; Wed, 19 Oct 2022 16:15:36 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 5D96242BE2 for ; Wed, 19 Oct 2022 16:15: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 29J8Ao51010370 for ; Wed, 19 Oct 2022 07:15: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=qdVfDZus7xQMi09zZz2VrsVkOMdcNqxBKh5jFkYe12Q=; b=UdwIBBa3JFPFqHAMy7oTF18FhgDczH8PapB1T3bhgV89BQ9hE0oorDJDkcMHacaSGFkG lnYzPiM868gJC6DpLgZ8Z7ugJ1wI9yZ5P5BjqfdKblhMXpfUt0WBtWDd+AYilcjKtWDR 2ei+34XQrgg3P4sb/+GhHnc5cPokaGWIz++RYvIdNTA385FwTVHBJVSIDo2OOOlygzKg mq3G/KikLVQgnrJJUbegY1503wiHsHw1UIY7X4kXJO4oxD1DuJgY7weku+1TgGScbz7f JKKY9q50aPuFyjSdTyKtaaDtyZ9tQ9f+lDFFNfoIp0uhfrXXDx5EoBiR1NnamaDYvljX zg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3kadg59caf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 19 Oct 2022 07:15: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; Wed, 19 Oct 2022 07:15:30 -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; Wed, 19 Oct 2022 07:15:30 -0700 Received: from hyd1554.marvell.com (unknown [10.29.57.11]) by maili.marvell.com (Postfix) with ESMTP id 55C8E3F7041; Wed, 19 Oct 2022 07:15:29 -0700 (PDT) From: Tejasree Kondoj To: Akhil Goyal CC: Vidya Sagar Velumuri , Anoob Joseph , Subject: [PATCH 07/13] crypto/cnxk: add support for DES and MD5 Date: Wed, 19 Oct 2022 19:45:07 +0530 Message-ID: <20221019141513.1969052-8-ktejasree@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221019141513.1969052-1-ktejasree@marvell.com> References: <20221019141513.1969052-1-ktejasree@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: 6OnJ-1KMVUEzeLxG4DVnFGb6ct6oxtON X-Proofpoint-ORIG-GUID: 6OnJ-1KMVUEzeLxG4DVnFGb6ct6oxtON X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-19_08,2022-10-19_03,2022-06-22_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 From: Vidya Sagar Velumuri Add supoort for cipher DES and auth MD5 for IPsec offload Signed-off-by: Vidya Sagar Velumuri --- drivers/crypto/cnxk/cnxk_cryptodev.h | 2 +- .../crypto/cnxk/cnxk_cryptodev_capabilities.c | 42 ++++++++++++++++++- drivers/crypto/cnxk/cnxk_ipsec.h | 9 ++++ 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/cnxk/cnxk_cryptodev.h b/drivers/crypto/cnxk/cnxk_cryptodev.h index 588760cfb0..48bd6e144c 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 37 -#define CNXK_SEC_CRYPTO_MAX_CAPS 14 +#define CNXK_SEC_CRYPTO_MAX_CAPS 16 #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 6a15154607..6c28f8942e 100644 --- a/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c +++ b/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c @@ -946,6 +946,26 @@ static const struct rte_cryptodev_capabilities sec_caps_aes[] = { }; static const struct rte_cryptodev_capabilities sec_caps_des[] = { + { /* DES */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER, + {.cipher = { + .algo = RTE_CRYPTO_CIPHER_DES_CBC, + .block_size = 8, + .key_size = { + .min = 8, + .max = 8, + .increment = 0 + }, + .iv_size = { + .min = 8, + .max = 8, + .increment = 0 + } + }, }, + }, } + }, { /* 3DES CBC */ .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, {.sym = { @@ -965,7 +985,7 @@ static const struct rte_cryptodev_capabilities sec_caps_des[] = { } }, } }, } - } + }, }; static const struct rte_cryptodev_capabilities sec_caps_sha1_sha2[] = { @@ -1049,6 +1069,26 @@ static const struct rte_cryptodev_capabilities sec_caps_sha1_sha2[] = { }, } }, } }, + { /* MD5 HMAC */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH, + {.auth = { + .algo = RTE_CRYPTO_AUTH_MD5_HMAC, + .block_size = 64, + .key_size = { + .min = 16, + .max = 16, + .increment = 0 + }, + .digest_size = { + .min = 12, + .max = 12, + .increment = 0 + }, + }, } + }, } + }, }; static const struct rte_cryptodev_capabilities sec_caps_null[] = { diff --git a/drivers/crypto/cnxk/cnxk_ipsec.h b/drivers/crypto/cnxk/cnxk_ipsec.h index 00873ca6ac..0c471b2cfe 100644 --- a/drivers/crypto/cnxk/cnxk_ipsec.h +++ b/drivers/crypto/cnxk/cnxk_ipsec.h @@ -23,6 +23,10 @@ ipsec_xform_cipher_verify(struct rte_crypto_sym_xform *crypto_xform) if (crypto_xform->cipher.algo == RTE_CRYPTO_CIPHER_NULL) return 0; + if (crypto_xform->cipher.algo == RTE_CRYPTO_CIPHER_DES_CBC && + crypto_xform->cipher.key.length == 8) + return 0; + if (crypto_xform->cipher.algo == RTE_CRYPTO_CIPHER_AES_CBC || crypto_xform->cipher.algo == RTE_CRYPTO_CIPHER_AES_CTR) { switch (crypto_xform->cipher.key.length) { @@ -51,6 +55,11 @@ ipsec_xform_auth_verify(struct rte_crypto_sym_xform *crypto_xform) if (crypto_xform->auth.algo == RTE_CRYPTO_AUTH_NULL) return 0; + if (crypto_xform->auth.algo == RTE_CRYPTO_AUTH_MD5_HMAC) { + if (keylen == 16) + return 0; + } + if (crypto_xform->auth.algo == RTE_CRYPTO_AUTH_SHA1_HMAC) { if (keylen >= 20 && keylen <= 64) return 0;