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 224A542B9A; Thu, 25 May 2023 12:08:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0175740DF8; Thu, 25 May 2023 12:08:34 +0200 (CEST) Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2051.outbound.protection.outlook.com [40.107.117.51]) by mails.dpdk.org (Postfix) with ESMTP id 7B92940DDB for ; Thu, 25 May 2023 12:08:32 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PT7iK3ESMwjJXznJ2wamPNP96YOEet0PKNrBVVgOjZIttGl+6cfLNybfmREeAbaOR8ljea20ukYW38xryNOeqLoAmqStN2Dl6GCg4pPyFk5GZW+/3hyCqHDwhVbhq93hUeoC8w8vyTZAAB8Jwp//FPjDan6K5jKjVy3/xA0ud77DWNj56nEIsXuzCFIeu+rLcxcHyitN9cw0uWemHWRP8XxGIChy23H99woxyDwlKaBdenLlJO2RvTIfCdM/J/FmBthOQmvocPLP/FJkXxrcUSuy+cqygP71oY6AYqdkmFxQb8iG0U6miBSf2neMsQL5aztyejPSJq4nHUSESMAreg== 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=51Wl1aOvduD3LCakljkPSwIEk/2al5E5zjrCoLoGdYU=; b=Iy1Eyta+Dpc0irFG6Mmc95bjCW73VHsfhon0n/DuhwhuyVv4EoczkTD1jq8AA7pPdUhzXAbv/dfenQoSmpSSzSc1Xh4AOKwzrVproUuE8WIY1nsyzqVAwD5s4eOKmt87+qwjtlyDNkM8cs0AJMkRWMmFzOPqpbbPSIRm4i9msExiqPVl5ItCrN2He9zmLE67Zev4HvLCh35Rfyg2xxDleEMSdK8dOE28TxtXzqCEPeY00KDs+eFsmoJVwnMZuZcvo9uHQC6I4XfcmtkD/dQ6WVzqr58mqseJRySGz0xoscf2dm2KiwunlWbPFo+EYQln2tXsXPyI7vwmt6M8Om/rhQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=jaguarmicro.com; dmarc=pass action=none header.from=jaguarmicro.com; dkim=pass header.d=jaguarmicro.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jaguarmicro.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=51Wl1aOvduD3LCakljkPSwIEk/2al5E5zjrCoLoGdYU=; b=baTELQNhrNq2hW5+n4Kr5xkijexIZEM52hmbW58LdneGmgyjj0NFTo4kkYAdT3eoFvGrgBbzPiO4XcNyP79MvDm2fdfR2aLoHmSEUUs7Ag4/jQWxqQve3ICTYsftGSI1LzOygS0U183N7tu3CgzMOawlMxoXEO1eU2SqJEsMbaDg+LTTsqd9fRNk9mpeopgBC8o1PR62sgfYL/MWJtWu938hXe9sFESUg5lerQPgbpSP0TvB08uR/+n/IYWHi3RjBgSOSxkqDMSxvPPOWrv+ZnN3WQdg+jpF26FDDe6tr4FJkiMbCDj8jcPcg2MlDI3j2Q8zJjniBaYNQ3LEUiQUqA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=jaguarmicro.com; Received: from KL1PR0601MB5567.apcprd06.prod.outlook.com (2603:1096:820:c5::14) by TYZPR06MB5025.apcprd06.prod.outlook.com (2603:1096:400:1cb::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15; Thu, 25 May 2023 10:08:29 +0000 Received: from KL1PR0601MB5567.apcprd06.prod.outlook.com ([fe80::fc7c:ec5e:aa02:44e9]) by KL1PR0601MB5567.apcprd06.prod.outlook.com ([fe80::fc7c:ec5e:aa02:44e9%7]) with mapi id 15.20.6411.029; Thu, 25 May 2023 10:08:28 +0000 From: Sunyang Wu To: dev@dpdk.org Cc: kai.ji@intel.com, gakhil@marvell.com Subject: [PATCH v2 1/2] cryptodev: support SM3_HMAC,SM4_CFB and SM4_OFB Date: Thu, 25 May 2023 18:08:05 +0800 Message-Id: <20230525100806.36992-1-sunyang.wu@jaguarmicro.com> X-Mailer: git-send-email 2.19.0.rc0.windows.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: TY2PR02CA0032.apcprd02.prod.outlook.com (2603:1096:404:a6::20) To KL1PR0601MB5567.apcprd06.prod.outlook.com (2603:1096:820:c5::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: KL1PR0601MB5567:EE_|TYZPR06MB5025:EE_ X-MS-Office365-Filtering-Correlation-Id: b56430b0-139d-49c2-fc63-08db5d07fc7a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3Fe1aOmbIq8r/TK2He+EIGfguw16nIg4f7+3RG4CxK6KZ0JOeLgsw498oc7anRMyDSspHXpJ+EU+Z9qinC/GGMoFXFjITTzCXxjeqhw76fXj6d6/Yy2Xve57yWBIMheHRSC9Tp4fzTB36BMlUPLXCKexUPEphqqoBTk11A2TcQLhRyAil9tq3ci9whS5Scc9S1VFH28Yct7AwujG0HizDpHG3nJU5HD8442e7aw/oAbUNZOfawU6Egpcpx9Bz8gO2Ji43bcmrFXHbvQOgE/t3VAoQUM46fPoFb7vqzhxKs7ud7PshYMBC2LZn07K/f1YymgqPvXQeuNRKpJNEHYekPp6pukuvYUwxCcRvisG4yXR4HdWb9fbp0m587omUS0xgxQlHxJRHY8ooatHqEGniTbx9KH3rTx4FgIxJ3U/QoXa5EA6WpdPeBJ6wOmo4SiQHKiSCpz73nMvT4WhG01wpHb8eXAk7M0VXyq8Y/T/n3AEgnfke9+wAzZL+DcpsP/GyaKcDRWSrS/PEIs90AxaoMPzVX9vPbV3JFmElGTrWSOoTuQ/ZTRAV3HtKyn6KmpeNTZi0klv+k5LS9WbDNRGrvFzgtRroWJ/3cm2y8MxHmxBcmtgAecNlZIjxlf2KSXy X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:KL1PR0601MB5567.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(39830400003)(366004)(376002)(136003)(346002)(396003)(451199021)(86362001)(44832011)(8676002)(8936002)(66556008)(66476007)(66946007)(6916009)(2906002)(4326008)(316002)(478600001)(5660300002)(41300700001)(38350700002)(38100700002)(6486002)(6666004)(52116002)(2616005)(26005)(1076003)(6512007)(6506007)(186003)(36756003)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?/sPz3TUYnu8gqq6wmLS8MZit+NHT//UI/ThF5+MEnfyCob5r4HVGdFfkNW0t?= =?us-ascii?Q?s4vEjVbpt6QDo7sb6xfFv7yh+lBrh3wqzp7o/B7RMl/ml0/zQCjoDSk3GlKT?= =?us-ascii?Q?kwsA4NKdeL7QLFmKFemXDxWfrTmBs9HVD4UuZCSFokyIs8XPA840du2WNLN8?= =?us-ascii?Q?mvwGcrK6sIP/h5jCOIt/gilbmxVBiZV0apsFt0tQzg6JbtoSq0QaC3VjBKg0?= =?us-ascii?Q?efOHtY94Fp6Mb4LLo6GarUvNSmUzfE+wYexYO+zunlrLi3fognY1R8BB0SoO?= =?us-ascii?Q?nAcq7TIjfZwBwG2uCgwROyv5eK2QyR/gYp50Q09y6+hyyLR/1spDCZuVly7a?= =?us-ascii?Q?0FIfOuMxBAAF0qmw0F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SFjCcG54GjTLEumJ/SE0V6zCUZVDT1TuXjFXkIgt6cQmLZwJvHiBwlOap3gd?= =?us-ascii?Q?/ysXXiW/EuJoypHw/9Wkc9hdOpHufD879tPhxhUY7wZTE6YM/WB+MbU6bz5Y?= =?us-ascii?Q?qL+ft0yr5l5gv922eysThAt5lk6yXo/naIgt0phpdDzHCLn/n9VoYK7UJ9+3?= =?us-ascii?Q?9upDbvJizPdkq33F/4nfg/+RGh7bSusP/z1tZVr8v1vgM0OMhejmcs92bcJ1?= =?us-ascii?Q?KbW0s29c+IskAwBzNmF9isaKWHYf0MFhfmiMxrWCRTV1MYdvmIxtqS3nvF3D?= =?us-ascii?Q?yz9tuDo/Je2U2ke7+sQBOylOH6Lk0sTpy+pJj5BunjgKzwErsuX8A8wNo9UH?= =?us-ascii?Q?UQ=3D=3D?= X-OriginatorOrg: jaguarmicro.com X-MS-Exchange-CrossTenant-Network-Message-Id: b56430b0-139d-49c2-fc63-08db5d07fc7a X-MS-Exchange-CrossTenant-AuthSource: KL1PR0601MB5567.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2023 10:08:28.8590 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 1e45a5c2-d3e1-46b3-a0e6-c5ebf6d8ba7b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eDN4QBHz0cWimLgtrMVwpMS6YtogFOb9MElZaPCetD9FMQiRQlGWYFKUyW2L58LsxM1iglGX+0VcJh8w171/MPsasO9eZpdCvu0lgZGl2z4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB5025 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 Add SM3_HMAC/SM4_CFB/SM4_OFB support in DPDK. Signed-off-by: Sunyang Wu --- doc/guides/cryptodevs/features/default.ini | 3 +++ doc/guides/rel_notes/release_23_07.rst | 5 +++++ lib/cryptodev/rte_crypto_sym.h | 8 +++++++- lib/cryptodev/rte_cryptodev.c | 12 +++++++++--- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/doc/guides/cryptodevs/features/default.ini b/doc/guides/cryptodevs/features/default.ini index 523da0cfa8..8f54d4a2a5 100644 --- a/doc/guides/cryptodevs/features/default.ini +++ b/doc/guides/cryptodevs/features/default.ini @@ -64,6 +64,8 @@ ZUC EEA3 = SM4 ECB = SM4 CBC = SM4 CTR = +SM4 CFB = +SM4 OFB = ; ; Supported authentication algorithms of a default crypto driver. @@ -99,6 +101,7 @@ SHA3_384 HMAC = SHA3_512 = SHA3_512 HMAC = SM3 = +SM3 HMAC = SHAKE_128 = SHAKE_256 = diff --git a/doc/guides/rel_notes/release_23_07.rst b/doc/guides/rel_notes/release_23_07.rst index a9b1293689..405b34c6d2 100644 --- a/doc/guides/rel_notes/release_23_07.rst +++ b/doc/guides/rel_notes/release_23_07.rst @@ -55,6 +55,11 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Added new algorithms to cryptodev.** + + * Added symmetric hash algorithm SM3-HMAC. + * Added symmetric cipher algorithm ShangMi 4 (SM4) in CFB and OFB modes. + Removed Items ------------- diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h index b43174dbec..428603d06e 100644 --- a/lib/cryptodev/rte_crypto_sym.h +++ b/lib/cryptodev/rte_crypto_sym.h @@ -172,8 +172,12 @@ enum rte_crypto_cipher_algorithm { /**< ShangMi 4 (SM4) algorithm in ECB mode */ RTE_CRYPTO_CIPHER_SM4_CBC, /**< ShangMi 4 (SM4) algorithm in CBC mode */ - RTE_CRYPTO_CIPHER_SM4_CTR + RTE_CRYPTO_CIPHER_SM4_CTR, /**< ShangMi 4 (SM4) algorithm in CTR mode */ + RTE_CRYPTO_CIPHER_SM4_OFB, + /**< ShangMi 4 (SM4) algorithm in OFB mode */ + RTE_CRYPTO_CIPHER_SM4_CFB + /**< ShangMi 4 (SM4) algorithm in CFB mode */ }; /** Cipher algorithm name strings */ @@ -376,6 +380,8 @@ enum rte_crypto_auth_algorithm { /**< HMAC using 512 bit SHA3 algorithm. */ RTE_CRYPTO_AUTH_SM3, /**< ShangMi 3 (SM3) algorithm */ + RTE_CRYPTO_AUTH_SM3_HMAC, + /** < HMAC using ShangMi 3 (SM3) algorithm */ RTE_CRYPTO_AUTH_SHAKE_128, /**< 128 bit SHAKE algorithm. */ diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c index a96114b2da..3e5e65dc58 100644 --- a/lib/cryptodev/rte_cryptodev.c +++ b/lib/cryptodev/rte_cryptodev.c @@ -94,7 +94,9 @@ rte_crypto_cipher_algorithm_strings[] = { [RTE_CRYPTO_CIPHER_ZUC_EEA3] = "zuc-eea3", [RTE_CRYPTO_CIPHER_SM4_ECB] = "sm4-ecb", [RTE_CRYPTO_CIPHER_SM4_CBC] = "sm4-cbc", - [RTE_CRYPTO_CIPHER_SM4_CTR] = "sm4-ctr" + [RTE_CRYPTO_CIPHER_SM4_CTR] = "sm4-ctr", + [RTE_CRYPTO_CIPHER_SM4_CFB] = "sm4-cfb", + [RTE_CRYPTO_CIPHER_SM4_OFB] = "sm4-ofb" }; /** @@ -127,7 +129,9 @@ crypto_cipher_algorithm_strings[] = { [RTE_CRYPTO_CIPHER_ZUC_EEA3] = "zuc-eea3", [RTE_CRYPTO_CIPHER_SM4_ECB] = "sm4-ecb", [RTE_CRYPTO_CIPHER_SM4_CBC] = "sm4-cbc", - [RTE_CRYPTO_CIPHER_SM4_CTR] = "sm4-ctr" + [RTE_CRYPTO_CIPHER_SM4_CTR] = "sm4-ctr", + [RTE_CRYPTO_CIPHER_SM4_CFB] = "sm4-cfb", + [RTE_CRYPTO_CIPHER_SM4_OFB] = "sm4-ofb" }; /** @@ -182,7 +186,8 @@ rte_crypto_auth_algorithm_strings[] = { [RTE_CRYPTO_AUTH_KASUMI_F9] = "kasumi-f9", [RTE_CRYPTO_AUTH_SNOW3G_UIA2] = "snow3g-uia2", [RTE_CRYPTO_AUTH_ZUC_EIA3] = "zuc-eia3", - [RTE_CRYPTO_AUTH_SM3] = "sm3" + [RTE_CRYPTO_AUTH_SM3] = "sm3", + [RTE_CRYPTO_AUTH_SM3_HMAC] = "sm3-hmac" }; /** @@ -227,6 +232,7 @@ crypto_auth_algorithm_strings[] = { [RTE_CRYPTO_AUTH_SNOW3G_UIA2] = "snow3g-uia2", [RTE_CRYPTO_AUTH_ZUC_EIA3] = "zuc-eia3", [RTE_CRYPTO_AUTH_SM3] = "sm3", + [RTE_CRYPTO_AUTH_SM3_HMAC] = "sm3", [RTE_CRYPTO_AUTH_SHAKE_128] = "shake-128", [RTE_CRYPTO_AUTH_SHAKE_256] = "shake-256", -- 2.19.0.rc0.windows.1