From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BCAF6A00BE; Mon, 20 Dec 2021 11:28:04 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9FD9D41151; Mon, 20 Dec 2021 11:27:48 +0100 (CET) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00069.outbound.protection.outlook.com [40.107.0.69]) by mails.dpdk.org (Postfix) with ESMTP id A02D04114B for ; Mon, 20 Dec 2021 11:27:47 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TqfM1mKph8X5Q8b+1j25pQAi5zHn1rk8NsfyWfL4+giziNUfwgwL5KC5TapaoFKYWCCFjx6/0MV8LN0X/SXXNL5TuhQxJk3FMNTbIFXxzRND9YlPt3xTXk5w7zAp4XVLx1vq9OqNsDLoJmEtIWJYaaB0F7MkX418twhHFUN7meGDoaVgduDXWHHxTcHDwPZOD6StnAuN4xw7wIGiOHVY9AZ/W2mb8K13QIyKDZuMVACzPRw96ALxt77mnsOid5h3Gysp7K8g1aM5OFonRWoa8WlAL2g6Y9vKiW9rhFktLeK8iKgt0wnPV4W2qyHnDZliOd0fGMkJu2pZmdNRWnoehA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0828Tpt/JyXAhDuGq+i75abCF1R9y+CnGfp/wLqyxRE=; b=eI7uNaWnUVzmfku92Nxef8SnjUnSKh8jkTv8zI238pUXreTrS9IXhWYKn85nqWzmfBynXRSexZcLXEGJjZEk6epxqjeYqDBN0As0E2UQ37WVrgUxWvnoxHUCudH/ctUB32q0Bj+uPnsIkQqOcnN7KubTBqrew6jrzoXO6WdzVqi1vqfA10Pw2wMr4el6+Bp/RGtKedMRfuYu5Bw/qK4iukobghHZ/Ma6cziomHM+XXwM1cK/Le93Uk8LKrNoOjLEyJsmqnA65OIySP6SQNYn3mILXmNb/ZvRElJm463oOO1EFqOhSJAVTAugYRbezhwcSgRTtF03YeE0ZsKgB87Zmg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0828Tpt/JyXAhDuGq+i75abCF1R9y+CnGfp/wLqyxRE=; b=mjTiA2i/3V/bBe80V4lScvlXVDD0bW465t7mRoa1r6me0NSfLIqokDzes5rY7Sl//RIP7DeUUtWs2YPzQx76SCk8nh+dNyn976Ob4xvayjhaB80EerlzCQs6eU9LkjsvAGxyWk33bictTLawQoJcj/VBi3EdOAGCJRLOG+6+yFs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) by AM6PR0402MB3703.eurprd04.prod.outlook.com (2603:10a6:209:19::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.20; Mon, 20 Dec 2021 10:27:45 +0000 Received: from AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::71ab:27ce:856d:5aac]) by AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::71ab:27ce:856d:5aac%4]) with mapi id 15.20.4801.020; Mon, 20 Dec 2021 10:27:45 +0000 From: Gagandeep Singh To: gakhil@marvell.com, dev@dpdk.org Cc: Akhil Goyal , Gagandeep Singh Subject: [PATCH 4/8] crypto/dpaa2_sec: support AES-GMAC Date: Mon, 20 Dec 2021 15:57:06 +0530 Message-Id: <20211220102710.3083370-4-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211220102710.3083370-1-g.singh@nxp.com> References: <20211220102710.3083370-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR06CA0205.apcprd06.prod.outlook.com (2603:1096:4:68::13) To AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0f38294b-89fa-4774-7329-08d9c3a35cbc X-MS-TrafficTypeDiagnostic: AM6PR0402MB3703:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:213; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PPpIjQCRJ8Vo8+mkWBiC5fN6A41mrbf7vMSJb+jRsILEPCPKj+L9PhHixDvmlvvqt/jmJIt6rYalEVzsyuOZwQQPIxASfxNFn4pWtvaUDBslBYoN8gQZzf0KvOR/7mmxCrT5aiQvkLyJaOnPhrKbUJzDLhHy/erq+IddiwCsSy4BZ84fGHZhCd2dF9p1vS3CizT+VF6SzaekJ4KfR0wVqfTDL4zBtTLJXrNXvgut6sVLnNa/00up0CpOWDlUF9uOy91ql+7m56e9zsxoOs1vgu3JpLdoNoRGHlwhTO50Hmb0c+R0sitvHn8nK3lxW86n/afKIoUOsATIZVeKLesmBz0LED3TMJtNMBtP5ObK8J0BjOxTjye+VSBNtRcOfRuiVkTmMvpaa095pEUlWCphFze9ccGaUXoZU79fzL1lC+paUkVbrF/KruvFGfOt5dGVToV3pRe24/GIMYCEc6p8gGJDkco4T4jHmg8YF0GdPGWdl/euo5set2KBbmb2+EeLXRhBT1vQ2c7Rn25ILh1K/WbpXbuVvEzirz5FvmdA9WRrpiR1gQ3gZNkwjEMkhfGt93FmiQ/U8Ub2TQO1EigT+VtOizK36P4T7UNk0zM1xNlAx03O/XnvLgLNFmFeJBmVKI7DowX0OUmxYHmCzcsze1K1Xm+qI7yg9UvAgxDw/4PxTYmoXSpeBPsUL+EtunhsS9dA1gb0T8GJsFkiXpQ51w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8198.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(83380400001)(5660300002)(38350700002)(8676002)(6666004)(54906003)(38100700002)(316002)(55236004)(66556008)(186003)(66476007)(66946007)(2906002)(52116002)(26005)(6506007)(8936002)(86362001)(4326008)(6486002)(1076003)(2616005)(6512007)(508600001)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?l7eYkDW8jya5r8yU2njTJdE7tBn5cREp4/jRvMVJ1ZUSEC2n0/VfwaWqa/yY?= =?us-ascii?Q?78wqEj9OCdG7rce5ibm6EhOH/5iFzbMyMaY10CDH5AxPGL/Sdb6fuIFqKD+R?= =?us-ascii?Q?J8oWo7eFgvVux7npg54q0EzYm4a44IS2W3+9x9Bgoalyj8jJHriIKSojmSiG?= =?us-ascii?Q?/GZMVdP0NGbLEOLFYRE6WQVKAIbKPE7wRO/rHfhUu8HtQz5UkEiKqiRsgMRl?= =?us-ascii?Q?iX5ktX/EdYqFszqu/HI1tRYc9av2YKl/Rd/h1TNVRpxZcBSkIbQpOYWMHrS4?= =?us-ascii?Q?C8soS6RcUdsUv/ONkMvVRdVpY3vHxBlkh2nDq4TIDbcLAyg66wDtFhM81+nK?= =?us-ascii?Q?GOWG4O4SFjajbloxz9bGyvzOsmMUEXTFLRbrpFwwKCB/6XpdVWnJsggSrFSS?= =?us-ascii?Q?w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eUdGggB?= =?us-ascii?Q?zW/fJx7T3Q59UKTVkKZRMNT1lQTiMxJOC4epAgyU8Ywf4noVkVZe8SB7uXYJ?= =?us-ascii?Q?PVXjKE5RWcePep+qpzVibOViP7wt6I5cfY1nj5exxLldGfcNfVVJErvzxa78?= =?us-ascii?Q?4elePlyAEipUUz3KfwFj2k3C2OM/pAVZF1yticLFQuvz1H5fqOC0qHZy8vTb?= =?us-ascii?Q?x6FCaPqXLFQcn+B5YeI9jpabq3aehs+cCbMMlylbkbZDno6jjsiVDykvmKEO?= =?us-ascii?Q?K02v4o2wDFsWRrarY2Y=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0f38294b-89fa-4774-7329-08d9c3a35cbc X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8198.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2021 10:27:45.5848 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: dH4q5inshQ+2WdlVtgkGKz0m9Yg6xDuVkMlMvIzFMGJ6KChG+Ib/YRoTmMVsWFv/ X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0402MB3703 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: Akhil Goyal This patch supports AES_GMAC algorithm for DPAA2 driver. Signed-off-by: Akhil Goyal Signed-off-by: Gagandeep Singh --- doc/guides/cryptodevs/features/dpaa2_sec.ini | 1 + drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 14 ++++++++- drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h | 30 ++++++++++++++++++++ lib/cryptodev/rte_crypto_sym.h | 4 ++- 4 files changed, 47 insertions(+), 2 deletions(-) diff --git a/doc/guides/cryptodevs/features/dpaa2_sec.ini b/doc/guides/cryptodevs/features/dpaa2_sec.ini index 3d6e449ca1..dcaf64965d 100644 --- a/doc/guides/cryptodevs/features/dpaa2_sec.ini +++ b/doc/guides/cryptodevs/features/dpaa2_sec.ini @@ -48,6 +48,7 @@ SHA512 HMAC = Y SNOW3G UIA2 = Y AES XCBC MAC = Y ZUC EIA3 = Y +AES GMAC = Y AES CMAC (128) = Y ; diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c index a9fda67ac3..99f5157abe 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -2847,6 +2847,13 @@ dpaa2_sec_ipsec_aead_init(struct rte_crypto_aead_xform *aead_xform, aeaddata->algmode = OP_ALG_AAI_CCM; session->aead_alg = RTE_CRYPTO_AEAD_AES_CCM; break; + case RTE_CRYPTO_AEAD_AES_GMAC: + /** + * AES-GMAC is an AEAD algo with NULL encryption and GMAC + * authentication. + */ + aeaddata->algtype = OP_PCL_IPSEC_AES_NULL_WITH_GMAC; + break; default: DPAA2_SEC_ERR("Crypto: Undefined AEAD specified %u", aead_xform->algo); @@ -2945,6 +2952,10 @@ dpaa2_sec_ipsec_proto_init(struct rte_crypto_cipher_xform *cipher_xform, case RTE_CRYPTO_AUTH_NULL: authdata->algtype = OP_PCL_IPSEC_HMAC_NULL; break; + case RTE_CRYPTO_AUTH_AES_GMAC: + DPAA2_SEC_ERR( + "AES_GMAC is supported as AEAD algo for IPSEC proto only"); + return -ENOTSUP; case RTE_CRYPTO_AUTH_SHA224_HMAC: case RTE_CRYPTO_AUTH_SNOW3G_UIA2: case RTE_CRYPTO_AUTH_SHA1: @@ -2953,7 +2964,6 @@ dpaa2_sec_ipsec_proto_init(struct rte_crypto_cipher_xform *cipher_xform, case RTE_CRYPTO_AUTH_SHA224: case RTE_CRYPTO_AUTH_SHA384: case RTE_CRYPTO_AUTH_MD5: - case RTE_CRYPTO_AUTH_AES_GMAC: case RTE_CRYPTO_AUTH_KASUMI_F9: case RTE_CRYPTO_AUTH_AES_CBC_MAC: case RTE_CRYPTO_AUTH_ZUC_EIA3: @@ -3096,6 +3106,7 @@ dpaa2_sec_set_ipsec_session(struct rte_cryptodev *dev, case OP_PCL_IPSEC_AES_GCM8: case OP_PCL_IPSEC_AES_GCM12: case OP_PCL_IPSEC_AES_GCM16: + case OP_PCL_IPSEC_AES_NULL_WITH_GMAC: memcpy(encap_pdb.gcm.salt, (uint8_t *)&(ipsec_xform->salt), 4); break; @@ -3172,6 +3183,7 @@ dpaa2_sec_set_ipsec_session(struct rte_cryptodev *dev, case OP_PCL_IPSEC_AES_GCM8: case OP_PCL_IPSEC_AES_GCM12: case OP_PCL_IPSEC_AES_GCM16: + case OP_PCL_IPSEC_AES_NULL_WITH_GMAC: memcpy(decap_pdb.gcm.salt, (uint8_t *)&(ipsec_xform->salt), 4); break; diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h b/drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h index 1756d917dd..6aa1c01e95 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h @@ -514,6 +514,36 @@ static const struct rte_cryptodev_capabilities dpaa2_sec_capabilities[] = { }, } }, } }, + { /* AES GMAC (AEAD) */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type = RTE_CRYPTO_SYM_XFORM_AEAD, + {.aead = { + .algo = RTE_CRYPTO_AEAD_AES_GMAC, + .block_size = 16, + .key_size = { + .min = 16, + .max = 32, + .increment = 8 + }, + .digest_size = { + .min = 16, + .max = 16, + .increment = 0 + }, + .aad_size = { + .min = 0, + .max = 65535, + .increment = 1 + }, + .iv_size = { + .min = 12, + .max = 16, + .increment = 4 + } + }, } + }, } + }, { /* AES XCBC HMAC */ .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, {.sym = { diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h index daa090b978..4644fa3e25 100644 --- a/lib/cryptodev/rte_crypto_sym.h +++ b/lib/cryptodev/rte_crypto_sym.h @@ -467,8 +467,10 @@ enum rte_crypto_aead_algorithm { /**< AES algorithm in CCM mode. */ RTE_CRYPTO_AEAD_AES_GCM, /**< AES algorithm in GCM mode. */ - RTE_CRYPTO_AEAD_CHACHA20_POLY1305 + RTE_CRYPTO_AEAD_CHACHA20_POLY1305, /**< Chacha20 cipher with poly1305 authenticator */ + RTE_CRYPTO_AEAD_AES_GMAC + /**< AES algorithm in GMAC mode. */ }; /** AEAD algorithm name strings */ -- 2.25.1