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 91263A034F; Tue, 28 Dec 2021 10:11:52 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8F8074115A; Tue, 28 Dec 2021 10:11:35 +0100 (CET) Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10067.outbound.protection.outlook.com [40.107.1.67]) by mails.dpdk.org (Postfix) with ESMTP id 6895E4113F for ; Tue, 28 Dec 2021 10:11:32 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hgoz/aGifdn3MlTQdK8k0mO857gFQtaZW4EAqrNTvcx1UIs72ycrow+Z71e6hSOmio5Z2ja3oSGMTPIta9Nx4VliOXGn0bO2qNKE9T1JNEyw2QXPKnDpUCgzkM5xgfMh1UyfuRFpdTrz4+pQLb/bbq78/wNt6Q1Ve2iqFVPQoAaFSYm4VtrYwjon8+yQI5DsHCPlxC6fbw1/QCZbK7o8KN1Qi/hojBsxOm+Lkkg3+2vT/7PH9Thu3CyAV5ocn+NzCFy4h+r03EyvCm0xS9dq/ZF5cUifElgMPbCogct9oXIh+lmslC+mX5p8oPkqq4Pr7WNmWrg55tdSvV7QqS5DsA== 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=oM1PM3i0UlgKLw/dw3kh2WwK+RxZ8BgkjBU41zwODCKLfijhBMWkPDx3xAWl130sLXR6Qjunoy8HawEm3J3RVU3pGz6aNzn2kcnnAdJzUuu+Yqsm/6MNmqhZ8KXLe/9L5T5VUX/ocFtp4DIOs1g0UWbNiUMdN66kRDXFtKZqAJaBfEXCUqQPvbemt0snEJV/BE9Toh125LwW6vBFbuUwpohDx1JM/fnLIHzJw1wYCoDVXfCSXGUHroCpY7ieUClRFQiKUuyiXURrZN8xNsvJYTWkTrzXRNwoUIbex1gdHwO6OG8MJYYKPeFdukenc7qIlHeySayS1JbZyWm1KJ+mlA== 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=kxkk5K5uHlUn96xwkQFpg2O8fBYBPENgiDeiLoi0eVo49El3ggCww0kKANBvuE5wu0RzhaenYOsFziM0PZQDsi1gwCSa4aGvy5/yS9T444S4jEF2UR5R1BRm/lgLYh/Vkv8Tyupl7Y09wdRTbbc2GK/7qEvx5R670uhgfCelPZM= 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 AM6PR04MB6135.eurprd04.prod.outlook.com (2603:10a6:20b:bf::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.21; Tue, 28 Dec 2021 09:11:31 +0000 Received: from AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::4c23:c171:682e:9085]) by AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::4c23:c171:682e:9085%4]) with mapi id 15.20.4823.023; Tue, 28 Dec 2021 09:11:31 +0000 From: Gagandeep Singh To: gakhil@marvell.com, dev@dpdk.org Cc: Akhil Goyal , Gagandeep Singh Subject: [PATCH v2 4/8] crypto/dpaa2_sec: support AES-GMAC Date: Tue, 28 Dec 2021 14:40:54 +0530 Message-Id: <20211228091058.3620177-5-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211228091058.3620177-1-g.singh@nxp.com> References: <20211220102710.3083370-1-g.singh@nxp.com> <20211228091058.3620177-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR06CA0118.apcprd06.prod.outlook.com (2603:1096:1:1d::20) 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: afa87ae7-be50-4848-18d3-08d9c9e20995 X-MS-TrafficTypeDiagnostic: AM6PR04MB6135: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: muFN9Z9uvraTl8p+0KZTuUkmUC+dKzfo70sHIsrcSPQF/38NLwfRrEZG7SNXZvd+aIrtPqvhyPqD0jjOre+xAZ7dUI1GyVPNa5mfLQb3cmtijQDC07XZeUedux6lNFHm21xtyndOtoadRs3KnVcPkYfAyuu6q8GqNsEMmZGcs/lYjK0wIBF5Q9s4Ick2W91kosQKs7Gs3W7jlmsCPOTcqHYR3dRG9CTwuvPQyF2zV/1P1U0fgHSklkF6ShhNL10UmXxzPR3mQmINYye3Z1YTAC9mr637IsmhkJICj7EyHyaKUVSoE2l7JxRtQgrCd1RLplfI60hK5PElDpZzkHdEJQURJyDaQunSLpTUEm1NFIHwxDZ7h72XDypMbKEzZH8DXlp1jrX0bMTat5RS88Ouv7nq/DicreoRW0o7UgfGCTK32nZviNQkye01g0HpmG2A6iIcGLasTuYPIfvT52of/w2qmshHZd/ANubXbawx1XKeZtMeiCqu1rbdXzIYrm3k0P+/F5Hlsv3aVUCTaBPywi4uxLsDVjGQULnMak+M6y94SKs/pBiLxucpx6/5k+Xz4CU8xR4sqgeWWb7LSXVtknCl7LxrCD1k4oEy8rzIqdP8fF37ujDg1HI4nOfvqn3mZW1Q14FK2CR5xZNeFHTN/qIflsDbwy8r7Wo9FAq1pZHJRlpcmsZIb1FqyVVutyQIQnqrhdoys/FmIaAAiWSuXw== 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)(316002)(8676002)(2616005)(6486002)(4326008)(6506007)(66556008)(66476007)(6512007)(6666004)(55236004)(38100700002)(38350700002)(36756003)(52116002)(83380400001)(2906002)(1076003)(66946007)(86362001)(26005)(54906003)(5660300002)(8936002)(186003)(508600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?eA1szJUfQ20LOgXCouOqGiqMYR4dEaVDKTeiXs4eDLyhkNvx1r+pNou6UtQ/?= =?us-ascii?Q?b9CRtESH48oz13l7ULkOu8inVgDvL70yqnnnavPTxN3W3yGpymtSzr+dPri+?= =?us-ascii?Q?BkvRrYOOND2hwEKbqqU0qlBmeMumq3vYirMFWu4my3mB7W19qHAt7onOPe1r?= =?us-ascii?Q?H8O2fp6GQG/G4x0+gTQmb23aEle6LRwDa7ea/BEnBD9PJnfmL7Xat2FCOHSq?= =?us-ascii?Q?oyKHs4cC+3NZFrOpDHL5H96HxrTzFdm/TLVXJp88HOVZUA9BayLDxG7Lhgfx?= =?us-ascii?Q?Z0q9DdrrXq1YR/3QZSBL8/Z3g+gs6NKDIVKmgYdzPOeWiXB6cbRgFs4YFRTf?= =?us-ascii?Q?QM09F+umvjnVpa/5SqLq5AlQTYZpsxG3wDu9BFl106tmLB1n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5CsTDhZpleoth67IyOdGp/9ZPH7egklw?= =?us-ascii?Q?LM01XtoRIStTLGiBahjIQqOSz2mcAHAayM364WkW9kx6+CKcU/vHSpWw7GIu?= =?us-ascii?Q?CmKIuhgSa4+tpwUGZi6i9/VijhMvLeS7h9yv8Ddd3N5lZiOHCEtpqF+nE/zi?= =?us-ascii?Q?15AjLsGDQXi4Q6YRqABZvtomE1QO3K/+LdvceptWISZwwYl0t5TRnCTLMkjH?= =?us-ascii?Q?1e8wo5ogLxoCoJQEyhxnebGitOxhMiDMCjunm6NGvdPr3Bj+WloCqJvH8lit?= =?us-ascii?Q?Cwt8ivVAd2oLsQzH6ho=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: afa87ae7-be50-4848-18d3-08d9c9e20995 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8198.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2021 09:11:31.2849 (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: F1pTXPmIR8Ork3k3PW+2Txxg7pIxVmSBX994LPO0uD+Fl6W9zek+ODeju1T15JQx X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB6135 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