From patchwork Wed Aug 25 08:18:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 502253 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp382449jab; Wed, 25 Aug 2021 01:22:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRmGNcUe4XeU4n9eYjYFbG957i2Betzlo2N93nsLxM8cQ24vEoRKPZQ41UIXXw3iqgSVaB X-Received: by 2002:aa7:d95a:: with SMTP id l26mr11574962eds.305.1629879763186; Wed, 25 Aug 2021 01:22:43 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id x11si21000107edd.110.2021.08.25.01.22.42; Wed, 25 Aug 2021 01:22:43 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) client-ip=217.70.189.124; Authentication-Results: mx.google.com; dkim=fail header.i=@nxp.com header.s=selector2 header.b=J7IcVbN9; arc=fail (signature failed); spf=pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3BC5F411EC; Wed, 25 Aug 2021 10:22:21 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20078.outbound.protection.outlook.com [40.107.2.78]) by mails.dpdk.org (Postfix) with ESMTP id 25ABE411D9 for ; Wed, 25 Aug 2021 10:22:20 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aR0D3hdZxNYtz2a5igNF5pyxyjOjICJmxx6xYW6Jo2GrP5Za6fBLyX7OB2uMObBLUyFBzyakijj+aAhyNfPn2FjADDCZ6T5juvTeBkI0uVCt7WnxzvXxCNWRPFOWpp29UgNpFczv2dJT2Rokd9OTlqkXovr/aYLJDncLWwr9+I/Ie8QLlh85bKXYLkM8h3iLd+frPPtyziOfBUlU9ZXgyS3zxPT3/UoTZOFIeia23DV+ekvA2yHHhuLZaXZRqwNoLHuAszBqwn9lZB0f2T34IF/kcMBJ0VrQm3g23lCW/lEAEtanLKfKIcyaduGT8DKrrVuCB46pZxf7vyv0IgNEew== 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-SenderADCheck; bh=R3hhrmb8XAycYjYnTb/EmXNnWitJw/w/ehUspTmH68A=; b=QhZxs0dHY7VxH0dXOLPnCGz4/BVifJy4hs7nFbYU61gO1JfMTn6a71CxXj10XZvYHqnQuAmRyNEG0+tbWWDHQDuUcRCyGHF5ylUDIUaXJdKuRPSUDZR9BIRGpUHh0Vm1skRpnmyTiB7bX8sJE5czZMSII+8Y/JGIs+RW6JKV5KtzZvtjQySqJ/eYiLLu8O/SzWgp90IXJVH+8Ez8kwTtnYj2sLnKPcQBiRlvAbbm8mjazOfSL1mVtIossALpspKBjMU3RugznJJ8reNvty85cLydW0yevjWlId3I01OUQvUS4Za/sVTNJgeIPjULyCNud1auk0CYYqY3Yv1CxLXUhA== 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=R3hhrmb8XAycYjYnTb/EmXNnWitJw/w/ehUspTmH68A=; b=J7IcVbN9GkKgAhts11S89O4ovCQYsRHh/v41GVY7e4fRrQsY43r+zORHBrybHbBvhFygOvCRUgfx3Pmf5QGD8llq2NwPtbM3XQivIOcVmislyT0cB5FaO68oN0hItRE6iDZz3T4WBk5Ognd3BuneeG6nfd6VVJaNLO9eIbdgnw8= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) by DU2PR04MB8584.eurprd04.prod.outlook.com (2603:10a6:10:2db::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.17; Wed, 25 Aug 2021 08:22:19 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::2590:514a:df1f:a793%8]) with mapi id 15.20.4436.025; Wed, 25 Aug 2021 08:22:19 +0000 From: Hemant Agrawal To: dev@dpdk.org, gakhil@marvell.com Cc: Gagandeep Singh Date: Wed, 25 Aug 2021 13:48:31 +0530 Message-Id: <20210825081837.23830-5-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210825081837.23830-1-hemant.agrawal@nxp.com> References: <20210721073920.21893-1-hemant.agrawal@nxp.com> <20210825081837.23830-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2PR02CA0106.apcprd02.prod.outlook.com (2603:1096:4:92::22) To DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dpdk-xeon.ap.freescale.net (92.120.0.67) by SG2PR02CA0106.apcprd02.prod.outlook.com (2603:1096:4:92::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.17 via Frontend Transport; Wed, 25 Aug 2021 08:22:18 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 76372725-850a-4f4f-9467-08d967a17484 X-MS-TrafficTypeDiagnostic: DU2PR04MB8584: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:569; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LI+bTy19cZExBnRBPnKa49qoRPNmmYmO0va2AcD0rXMwO3xstCQhqJHOjW5uZqmKzdbOfTk79iKWZLCV85lTFNFh0CX0VCiQ0YgcQvSE0pzyvPZ0U06/N7HFNc1H2j+UCLnRheBRWn2PziUZaO7tbGOg0U3jhXMo4WsCf8SLCDWTsK9RDRhghYMK13wZUl1wVEpaBElugkdLelVCEthplX3Q5P3L+py1J65+h8A56lswZh8oWBJaHOvDs9uysLkU01qJCzMp2QIUrJ3DFA3ZmmhJ/b3fG42pEPhERzZwtXN3dvhkvjVV2sevnsRTo1ehOv4HqxXEW4PsIZZ6ByOA/roU7/YuAd8FNk2Z/uOGy4Hz05bIie3AhpemyS6QArWqimuGhG7C8fGgAE6kZ1I2ZSlh2z6L2AZxfjIUuahm6tqMx2QU+FDf+n84qzgEVrRVtJxFIwiHw0kXKSHfGhoIEh/BTYa3S7nMCk3eJaiO6famXg/N5AGOn/dtzMQojKl5K8hCo/VqukA1Gr8cOX7l0jIkXDLk4heDR0I/HC2/jVK+edPP96PXiN/YdDjPEYDiFObuPCITqv3pbc6FF6LL7i+I+P8uiw9jTGj8erppgBrmCIJ071gVMuwwQxkBHcU/K5rIcVl03GfjshmoK4jJqNcKBnlgR2Q6sGo2iAiMvPi9zSu61ggvVU393i7x3yKzquKuF1kSTEmgOyCCmEe9Pg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU2PR04MB8630.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(396003)(346002)(366004)(39860400002)(136003)(956004)(8676002)(44832011)(4326008)(36756003)(2616005)(38350700002)(86362001)(83380400001)(478600001)(38100700002)(6512007)(26005)(8936002)(6666004)(66556008)(66476007)(1076003)(316002)(5660300002)(2906002)(6486002)(186003)(52116002)(66946007)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8K6vldAkrvST/qkQSfQ6bNzQN9GzeguFeOed8i/BSCEmH+wgtzqhOrVE0TUwDHga4gfOeIUrxDK23hBkB/cl1Ovnw0GnMXeR+XkqLnOKwf2d0hS3AiKLCs93P8utRB6Anz9HdaCasg1LHCi/6GH2Jdc2DrKuF1n5rWJ3HAOJZyMtVEu+sgAYYKBpbt4D35hrKxcLW6Pbk3PAyLA4wAtkEKiBN+37eqZXIMsQTdHd20DeB4KK8+9dbh980a8PSI0FRo/xh6hcaGYV5doNU5csiuUoTS3N8yRYuJrSr1Uc+cMIZ683BP3gHHK62hd+UDNZukayortIePdjjD/Di/4o0ZdIxmQ5oqKWg2JKlGt8YngnILAfnL4gktjxWPc7VHgs9sE4KonyAj0OPfsVrWwQU1iCiBpOeH4huinEVK4LHUONRBpprxS+DnHnXjJE1d9E2k8L/DILLH2NZSZ++UHAjkkT4pAZ7U6dAbZRril+gEAa+OOuqrhkRD5ox4dpbSbFu5KiP7BnGSXrcEu6KEmrNcc/g+SaPTQ4o/D8pjvFwLG4fP4PidxroH8roUV/9k8D+jr/g5bSjxqmX6+F7vzQm91eaw1+c0hAu4YJspom3oQBKvPcuDaq9SK5JLwHdHFkbUUU0T+Xm0+Nk2ObkFZSqM8bIMUHuPvlV3bzjr5QaE4b9valkP6v8FXnBOx9HwGz/khHsn0qrpBnTsvKIFHpvsMZgJXcdrRZfZMMDo1pQMqzO6oOIPFZQ2Kr/JDXsTEhssg3IHPtg59gxumSFMqnhTtUHLR1OVfqR8lpZSWTbJRamTbonWhx3qdkbBJ+sBJnr+Te3f5VIgdt1nJmq577ECDqp0RNysHakuUx/E59x2dmlu7WxEHzwKfiiyQax3EaWNUkv2WKVTlf2Ps3rWe/l360SiuJVq2EvUsy/cP7Gi4IxTesN+vNKUIUqlZQT2eRuuEP5/T56bHXZ3rPpMbbnau6oK6dknOl9eZP+NPqHnsHwvLuENw5AbmL3aWXHfk5qTBDwn4DQcZg8aCciQXv1Ced4jKHFlelWO9BZM3cb55dWrvQ79X4SOQycPW0AcadGcPEXdzUDr1a1hpKpHxu74SwqlnWFZ/nGs4gPNrCg9PNsx++dJxQx4MzsQDBdXeWcy4AxF04Mt5vEmVWeb1B0DCCN34fWSEnB7Q5MpLVJkjLKKrbPaPc3FV6OOw7bZnLBZ6kRpo8rNMn/iILZEEWswoVhJ1JTqhmQvWzNo6Wly9HzyvI6Aaa6q7DdJ3i6M8ZodL4MnQwYqrbDESa3Wmnyu7QV6Rv4owOfTc+iFT3iM2Goh7U21efIePpsVmhEjPQ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 76372725-850a-4f4f-9467-08d967a17484 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2021 08:22:19.4421 (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: O0oUb4y6dvtbIQegnPSIrJXS1bQfhbgogz7tIrw5NVTyUHJNX+b1+hMeFdUtIKIEPPobBYrJ2Mte+gz+ku0meA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8584 Subject: [dpdk-dev] [PATCH v2 05/11] crypto/dpaa_sec: add support for AES CMAC integrity check 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 Sender: "dev" From: Gagandeep Singh This patch adds support for AES_CMAC integrity in non-security mode. This patch modifies the camm flib to handles the AES CMAC without conflicting the proto ALG operations. i.e. by creating another ALG operation routine. Signed-off-by: Gagandeep Singh --- doc/guides/cryptodevs/features/dpaa_sec.ini | 1 + drivers/crypto/dpaa_sec/dpaa_sec.c | 10 +++++ drivers/crypto/dpaa_sec/dpaa_sec.h | 43 +++++++++++++++++++++ 3 files changed, 54 insertions(+) -- 2.17.1 diff --git a/doc/guides/cryptodevs/features/dpaa_sec.ini b/doc/guides/cryptodevs/features/dpaa_sec.ini index d7bc319373..6a8f77fb1d 100644 --- a/doc/guides/cryptodevs/features/dpaa_sec.ini +++ b/doc/guides/cryptodevs/features/dpaa_sec.ini @@ -48,6 +48,7 @@ SHA512 HMAC = Y SNOW3G UIA2 = Y ZUC EIA3 = Y AES XCBC MAC = Y +AES CMAC (128) = Y ; ; Supported AEAD algorithms of the 'dpaa_sec' crypto driver. diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c index dab0ad28c0..7d3f971f3c 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c @@ -525,6 +525,7 @@ dpaa_sec_prep_cdb(dpaa_sec_session *ses) ses->digest_length); break; case RTE_CRYPTO_AUTH_AES_XCBC_MAC: + case RTE_CRYPTO_AUTH_AES_CMAC: shared_desc_len = cnstr_shdsc_aes_mac( cdb->sh_desc, true, swap, SHR_NEVER, @@ -2177,6 +2178,10 @@ dpaa_sec_auth_init(struct rte_cryptodev *dev __rte_unused, session->auth_key.alg = OP_ALG_ALGSEL_AES; session->auth_key.algmode = OP_ALG_AAI_XCBC_MAC; break; + case RTE_CRYPTO_AUTH_AES_CMAC: + session->auth_key.alg = OP_ALG_ALGSEL_AES; + session->auth_key.algmode = OP_ALG_AAI_CMAC; + break; default: DPAA_SEC_ERR("Crypto: Unsupported Auth specified %u", xform->auth.algo); @@ -2262,6 +2267,10 @@ dpaa_sec_chain_init(struct rte_cryptodev *dev __rte_unused, session->auth_key.alg = OP_ALG_ALGSEL_AES; session->auth_key.algmode = OP_ALG_AAI_XCBC_MAC; break; + case RTE_CRYPTO_AUTH_AES_CMAC: + session->auth_key.alg = OP_ALG_ALGSEL_AES; + session->auth_key.algmode = OP_ALG_AAI_CMAC; + break; default: DPAA_SEC_ERR("Crypto: Unsupported Auth specified %u", auth_xform->algo); @@ -2697,6 +2706,7 @@ dpaa_sec_ipsec_proto_init(struct rte_crypto_cipher_xform *cipher_xform, break; case RTE_CRYPTO_AUTH_AES_CMAC: session->auth_key.alg = OP_PCL_IPSEC_AES_CMAC_96; + session->auth_key.algmode = OP_ALG_AAI_CMAC; break; case RTE_CRYPTO_AUTH_NULL: session->auth_key.alg = OP_PCL_IPSEC_HMAC_NULL; diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.h b/drivers/crypto/dpaa_sec/dpaa_sec.h index 153747c87c..faa740618f 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.h +++ b/drivers/crypto/dpaa_sec/dpaa_sec.h @@ -738,6 +738,49 @@ static const struct rte_cryptodev_capabilities dpaa_sec_capabilities[] = { }, } }, } }, + { /* AES CMAC */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH, + {.auth = { + .algo = RTE_CRYPTO_AUTH_AES_CMAC, + .block_size = 16, + .key_size = { + .min = 1, + .max = 16, + .increment = 1 + }, + .digest_size = { + .min = 12, + .max = 16, + .increment = 4 + }, + .iv_size = { 0 } + }, } + }, } + }, + { /* AES XCBC HMAC */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH, + {.auth = { + .algo = RTE_CRYPTO_AUTH_AES_XCBC_MAC, + .block_size = 16, + .key_size = { + .min = 1, + .max = 16, + .increment = 1 + }, + .digest_size = { + .min = 12, + .max = 16, + .increment = 4 + }, + .aad_size = { 0 }, + .iv_size = { 0 } + }, } + }, } + }, RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() };