From patchwork Thu Jan 12 10:47:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Fialko X-Patchwork-Id: 121891 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 9010A423B5; Thu, 12 Jan 2023 11:47:48 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EB0B142D25; Thu, 12 Jan 2023 11:47:46 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id A374E42D25 for ; Thu, 12 Jan 2023 11:47:45 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30C9dq6W021081; Thu, 12 Jan 2023 02:47:45 -0800 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=RzozakU4JQ2FXvhXAOh0wW6Z3b0bgHzyDnLVggcZjJI=; b=FBB/8h+QdxB9v560+EZxS8ZQOVExRmIc79bW+gIw/dtWHSJtyns1XKX1CNd2N1KT173f OTuuMReHlPIRtDPeTaCvS4IrRblDki1oqpddcI2hTykbe/1mPBAhBhLLFavdJ0bNhR/T i610CD2Y9EqOfeDeF9cUZAQvVh3HNaqtVQhXhzVXDwn9NOM0qZcjYKBZTEG1L8OmYk1C Dw6+Ynm2qmvUNDTppsoI9RI3ynA2Zd4ATcgHkxP8z9NBrMw9C5HgrpgbsnU+febs2qAp TuAES1EnynxGmmt8M1IbnTBqD/Ii+AsUXg4JrPMqDkBN3EQLPS89PK68CeJWxqQ2oY6V FA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3n1k56yka6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 12 Jan 2023 02:47:45 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 12 Jan 2023 02:47:43 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.42 via Frontend Transport; Thu, 12 Jan 2023 02:47:42 -0800 Received: from cavium-DT10.. (unknown [10.28.34.39]) by maili.marvell.com (Postfix) with ESMTP id 612203F705D; Thu, 12 Jan 2023 02:47:40 -0800 (PST) From: Volodymyr Fialko To: , Akhil Goyal , Fan Zhang CC: , , Volodymyr Fialko Subject: [PATCH v2 1/3] cryptodev: add SHAKE algorithm Date: Thu, 12 Jan 2023 11:47:31 +0100 Message-ID: <20230112104733.1835722-2-vfialko@marvell.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230112104733.1835722-1-vfialko@marvell.com> References: <20230104143815.603524-1-vfialko@marvell.com> <20230112104733.1835722-1-vfialko@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: RrKioTE-iWBW92mIYvIY5ILy_GhC-XhA X-Proofpoint-GUID: RrKioTE-iWBW92mIYvIY5ILy_GhC-XhA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-12_06,2023-01-12_01,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 Add SHAKE to enum of auth algorithms. Signed-off-by: Volodymyr Fialko Acked-by: Akhil Goyal --- doc/guides/cryptodevs/features/default.ini | 2 ++ lib/cryptodev/rte_crypto_sym.h | 7 ++++++- lib/cryptodev/rte_cryptodev.c | 5 ++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/guides/cryptodevs/features/default.ini b/doc/guides/cryptodevs/features/default.ini index d51d80ff80..523da0cfa8 100644 --- a/doc/guides/cryptodevs/features/default.ini +++ b/doc/guides/cryptodevs/features/default.ini @@ -99,6 +99,8 @@ SHA3_384 HMAC = SHA3_512 = SHA3_512 HMAC = SM3 = +SHAKE_128 = +SHAKE_256 = ; ; Supported AEAD algorithms of a default crypto driver. diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h index dc847da7b8..2cfe66530c 100644 --- a/lib/cryptodev/rte_crypto_sym.h +++ b/lib/cryptodev/rte_crypto_sym.h @@ -374,8 +374,13 @@ enum rte_crypto_auth_algorithm { /**< 512 bit SHA3 algorithm. */ RTE_CRYPTO_AUTH_SHA3_512_HMAC, /**< HMAC using 512 bit SHA3 algorithm. */ - RTE_CRYPTO_AUTH_SM3 + RTE_CRYPTO_AUTH_SM3, /**< ShangMi 3 (SM3) algorithm */ + + RTE_CRYPTO_AUTH_SHAKE_128, + /**< 128 bit SHAKE algorithm. */ + RTE_CRYPTO_AUTH_SHAKE_256, + /**< 256 bit SHAKE algorithm. */ }; /** Authentication algorithm name strings */ diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c index 742a4c512e..17c70023ef 100644 --- a/lib/cryptodev/rte_cryptodev.c +++ b/lib/cryptodev/rte_cryptodev.c @@ -226,7 +226,10 @@ 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_SHAKE_128] = "shake-128", + [RTE_CRYPTO_AUTH_SHAKE_256] = "shake-256", }; /** From patchwork Thu Jan 12 10:47:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Fialko X-Patchwork-Id: 121892 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 C6B0B423B5; Thu, 12 Jan 2023 11:47:53 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BDBCF42D2D; Thu, 12 Jan 2023 11:47:53 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 7529040156 for ; Thu, 12 Jan 2023 11:47:51 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30C9dqq4021107; Thu, 12 Jan 2023 02:47:50 -0800 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=Y0gMLznTIOdp5V+TqKzry9jwRw3+iNzZEz5g0YbaflA=; b=eRcuTrlayEUR7oUaizpHpOjC6ue7pfkIxOceC2IK2JOvfSzbOaEFeNm5Bo3KJUzoMinD 8O15TSJWxj6z5TV7nzSIGkDScEuwC2Mi19+1Ec0p6FsQ1sY0rJpBcJIVjz4ZIgcq/RRx 4jS2rFnPNsJzRQkd4I7lUBqJ3SrF0Oavf5hLzeKmCWsC7kU8LTDgzgeBo1gwxNXVsQWN bkiCnfFCW8J+PNG96K2OcRldotUSL8v85ltgacH7iuDIsGBrizkQCb5l9OEO0o/A8n9n 48S3WKcU+houuHwNj+zT6sCixvkW+6YnvsbxCMHr4AbsOAcaDvu+7VzhvOhYHsqPLD6w TQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3n1k56ykam-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 12 Jan 2023 02:47:50 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 12 Jan 2023 02:47:48 -0800 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.42 via Frontend Transport; Thu, 12 Jan 2023 02:47:48 -0800 Received: from cavium-DT10.. (unknown [10.28.34.39]) by maili.marvell.com (Postfix) with ESMTP id CAA0C3F706D; Thu, 12 Jan 2023 02:47:44 -0800 (PST) From: Volodymyr Fialko To: , Yipeng Wang , Sameh Gobriel , Bruce Richardson , Vladimir Medvedkin , Akhil Goyal , Fan Zhang CC: , , Volodymyr Fialko Subject: [PATCH v2 2/3] app/test: add SHAKE test cases Date: Thu, 12 Jan 2023 11:47:32 +0100 Message-ID: <20230112104733.1835722-3-vfialko@marvell.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230112104733.1835722-1-vfialko@marvell.com> References: <20230104143815.603524-1-vfialko@marvell.com> <20230112104733.1835722-1-vfialko@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: gf4DbG7BpJTdTqwfjrmkXeLUQ9tbYiqa X-Proofpoint-GUID: gf4DbG7BpJTdTqwfjrmkXeLUQ9tbYiqa X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-12_06,2023-01-12_01,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 Add test cases for SHAKE hash algorithm for Digest and Digest-Verify. Signed-off-by: Volodymyr Fialko Acked-by: Akhil Goyal --- app/test/test_cryptodev_hash_test_vectors.h | 66 +++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/app/test/test_cryptodev_hash_test_vectors.h b/app/test/test_cryptodev_hash_test_vectors.h index 4b57286fa5..fa9986a4da 100644 --- a/app/test/test_cryptodev_hash_test_vectors.h +++ b/app/test/test_cryptodev_hash_test_vectors.h @@ -538,6 +538,52 @@ hmac_sha3_512_test_vector = { } }; +static const struct blockcipher_test_data +shake_128_test_vector = { + .auth_algo = RTE_CRYPTO_AUTH_SHAKE_128, + .ciphertext = { + .data = plaintext_hash, + .len = 512 + }, + .digest = { + .data = { + 0x69, 0xBD, 0xD5, 0x14, 0x85, 0xE0, 0x44, 0xA4, + 0x25, 0xE6, 0x9F, 0x81, 0xC8, 0x18, 0x58, 0x3E, + 0xFE, 0xC9, 0x0B, 0xAD, 0x27, 0x98, 0x14, 0x3F, + 0xB9, 0x7D, 0x68, 0x4D, 0x60, 0x77, 0x82, 0x64, + 0x6D, 0x64, 0x66, 0x67, 0xFA, 0xBC, 0x4F, 0xAC, + 0x9C, 0x75, 0x8D, 0x63, 0xBA, 0xBD, 0x2B, 0x03, + 0x0F, 0x2F, 0x46, 0x15, 0x88, 0xF0, 0x8C, 0x09, + 0xAC, 0x87, 0x84, 0x5B, 0xCA, 0x65, 0xA1, 0x14 + }, + .len = 64, + .truncated_len = 64 + } +}; + +static const struct blockcipher_test_data +shake_256_test_vector = { + .auth_algo = RTE_CRYPTO_AUTH_SHAKE_256, + .ciphertext = { + .data = plaintext_hash, + .len = 512 + }, + .digest = { + .data = { + 0x9E, 0xA2, 0x1B, 0x84, 0x15, 0x0E, 0xF0, 0x46, + 0xD9, 0xA9, 0x11, 0x02, 0x11, 0x67, 0x9A, 0xDC, + 0x62, 0x95, 0x8C, 0xD6, 0xEF, 0x89, 0x35, 0x8C, + 0xBF, 0x41, 0x5F, 0x23, 0x16, 0xBD, 0x0C, 0xDE, + 0xEC, 0x1D, 0x47, 0x90, 0xA4, 0xD9, 0x18, 0x63, + 0xE1, 0x60, 0xF8, 0xAF, 0x0F, 0x57, 0xBA, 0xCA, + 0x5D, 0x97, 0x58, 0xF5, 0xFF, 0xE4, 0x85, 0x40, + 0xCA, 0x7D, 0xB8, 0x35, 0x3B, 0x89, 0xCA, 0x34 + }, + .len = 64, + .truncated_len = 64 + } +}; + static const struct blockcipher_test_data cmac_test_vector = { .auth_algo = RTE_CRYPTO_AUTH_AES_CMAC, @@ -853,6 +899,26 @@ static const struct blockcipher_test_case hash_test_cases[] = { .test_data = &hmac_sha3_512_test_vector, .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, }, + { + .test_descr = "SHAKE_128 Digest", + .test_data = &shake_128_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, + }, + { + .test_descr = "SHAKE_128 Digest Verify", + .test_data = &shake_128_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, + }, + { + .test_descr = "SHAKE_256 Digest", + .test_data = &shake_256_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN, + }, + { + .test_descr = "SHAKE_256 Digest Verify", + .test_data = &shake_256_test_vector, + .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY, + }, { .test_descr = "CMAC Digest 12B", .test_data = &cmac_test_vector_12, From patchwork Thu Jan 12 10:47:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Fialko X-Patchwork-Id: 121893 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 BC312423B5; Thu, 12 Jan 2023 11:47:59 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B26E542D36; Thu, 12 Jan 2023 11:47:59 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 9C4F640156 for ; Thu, 12 Jan 2023 11:47:57 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30C9dqJC021100 for ; Thu, 12 Jan 2023 02:47:57 -0800 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=qeMTviC6vX39DIpPpyQYAYo9uLlSn0y90heLobGBbLs=; b=ZBLjpQ/3h/4a9RslZWIm8D8tuOpkHWz4bJy6nlGTurU73gmBXny4qtw/EmdSFPwW//7P KaFs3BiiRnru9Qd9ljOzJ3XHEOgl5g48jsDtOnEJEmI/zY+1sKKzL7IwXgTqwlzRoQe+ KlwqmnVS1wZZI6+0K5z7uUIc1j5aNGHcGJRxwfLEWeIW8Qotaf+DqwqyjMjROdDb/qzH H8QNAQEks8e0Kf13deeH+ySadPLBJshkuq9DEkWPY/sEEURnhFaFBv2RKj9H9hXeqta8 uhzsKVrIHuRbM9n3KlsVlg54vuveS/rSJE1wl0dvJha3soacw9kz0pMMT7cc1n5bMw3B Vg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3n1k56ykbb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 12 Jan 2023 02:47:56 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 12 Jan 2023 02:47:54 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.42 via Frontend Transport; Thu, 12 Jan 2023 02:47:54 -0800 Received: from cavium-DT10.. (unknown [10.28.34.39]) by maili.marvell.com (Postfix) with ESMTP id AD4EF3F7073; Thu, 12 Jan 2023 02:47:50 -0800 (PST) From: Volodymyr Fialko To: , Ankur Dwivedi , Anoob Joseph , Tejasree Kondoj , "Nithin Dabilpuram" , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Volodymyr Fialko Subject: [PATCH v2 3/3] crypto/cnxk: add support for SHAKE hash Date: Thu, 12 Jan 2023 11:47:33 +0100 Message-ID: <20230112104733.1835722-4-vfialko@marvell.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230112104733.1835722-1-vfialko@marvell.com> References: <20230104143815.603524-1-vfialko@marvell.com> <20230112104733.1835722-1-vfialko@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: ips98lMpP4LiKu4rt3eonoUIFSz-N6Bh X-Proofpoint-GUID: ips98lMpP4LiKu4rt3eonoUIFSz-N6Bh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-12_06,2023-01-12_01,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 Add support for SHAKE hash and hmac operations Signed-off-by: Volodymyr Fialko --- doc/guides/cryptodevs/cnxk.rst | 2 + doc/guides/cryptodevs/features/cn10k.ini | 2 + doc/guides/cryptodevs/features/cn9k.ini | 2 + drivers/common/cnxk/roc_se.h | 4 +- drivers/crypto/cnxk/cnxk_cryptodev.h | 2 +- .../crypto/cnxk/cnxk_cryptodev_capabilities.c | 40 +++++++++++++++++++ drivers/crypto/cnxk/cnxk_se.h | 15 +++++++ 7 files changed, 64 insertions(+), 3 deletions(-) diff --git a/doc/guides/cryptodevs/cnxk.rst b/doc/guides/cryptodevs/cnxk.rst index 9b01e04e5f..3c2e38fefd 100644 --- a/doc/guides/cryptodevs/cnxk.rst +++ b/doc/guides/cryptodevs/cnxk.rst @@ -67,6 +67,8 @@ Hash algorithms: * ``RTE_CRYPTO_AUTH_SHA3_384_HMAC`` * ``RTE_CRYPTO_AUTH_SHA3_512`` * ``RTE_CRYPTO_AUTH_SHA3_512_HMAC`` +* ``RTE_CRYPTO_AUTH_SHAKE_128`` +* ``RTE_CRYPTO_AUTH_SHAKE_256`` * ``RTE_CRYPTO_AUTH_SNOW3G_UIA2`` * ``RTE_CRYPTO_AUTH_ZUC_EIA3`` * ``RTE_CRYPTO_AUTH_AES_CMAC`` diff --git a/doc/guides/cryptodevs/features/cn10k.ini b/doc/guides/cryptodevs/features/cn10k.ini index 44b61663fc..162d1a25ca 100644 --- a/doc/guides/cryptodevs/features/cn10k.ini +++ b/doc/guides/cryptodevs/features/cn10k.ini @@ -71,6 +71,8 @@ SHA3_384 = Y SHA3_384 HMAC = Y SHA3_512 = Y SHA3_512 HMAC = Y +SHAKE_128 = Y +SHAKE_256 = Y ; ; Supported AEAD algorithms of 'cn10k' crypto driver. diff --git a/doc/guides/cryptodevs/features/cn9k.ini b/doc/guides/cryptodevs/features/cn9k.ini index e7b287db26..bbed4b2e23 100644 --- a/doc/guides/cryptodevs/features/cn9k.ini +++ b/doc/guides/cryptodevs/features/cn9k.ini @@ -72,6 +72,8 @@ SHA3_384 = Y SHA3_384 HMAC = Y SHA3_512 = Y SHA3_512 HMAC = Y +SHAKE_128 = Y +SHAKE_256 = Y ; ; Supported AEAD algorithms of 'cn9k' crypto driver. diff --git a/drivers/common/cnxk/roc_se.h b/drivers/common/cnxk/roc_se.h index e9415f21a5..6758142214 100644 --- a/drivers/common/cnxk/roc_se.h +++ b/drivers/common/cnxk/roc_se.h @@ -85,8 +85,8 @@ typedef enum { ROC_SE_SHA3_SHA256 = 11, ROC_SE_SHA3_SHA384 = 12, ROC_SE_SHA3_SHA512 = 13, - ROC_SE_SHA3_SHAKE256 = 14, - ROC_SE_SHA3_SHAKE512 = 15, + ROC_SE_SHA3_SHAKE128 = 14, + ROC_SE_SHA3_SHAKE256 = 15, /* These are only for software use */ ROC_SE_ZUC_EIA3 = 0x90, diff --git a/drivers/crypto/cnxk/cnxk_cryptodev.h b/drivers/crypto/cnxk/cnxk_cryptodev.h index 8241ee67d0..dd7dd3bc3a 100644 --- a/drivers/crypto/cnxk/cnxk_cryptodev.h +++ b/drivers/crypto/cnxk/cnxk_cryptodev.h @@ -10,7 +10,7 @@ #include "roc_cpt.h" -#define CNXK_CPT_MAX_CAPS 45 +#define CNXK_CPT_MAX_CAPS 47 #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 b2197a12be..d2ae4b5bff 100644 --- a/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c +++ b/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c @@ -498,6 +498,46 @@ static const struct rte_cryptodev_capabilities caps_sha3[] = { }, } }, } }, + { /* SHAKE_128 */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH, + {.auth = { + .algo = RTE_CRYPTO_AUTH_SHAKE_128, + .block_size = 168, + .key_size = { + .min = 0, + .max = 0, + .increment = 0 + }, + .digest_size = { + .min = 1, + .max = 255, + .increment = 1 + }, + }, } + }, } + }, + { /* SHAKE_256 */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH, + {.auth = { + .algo = RTE_CRYPTO_AUTH_SHAKE_256, + .block_size = 136, + .key_size = { + .min = 0, + .max = 0, + .increment = 0 + }, + .digest_size = { + .min = 1, + .max = 255, + .increment = 1 + }, + }, } + }, } + }, }; static const struct rte_cryptodev_capabilities caps_chacha20[] = { diff --git a/drivers/crypto/cnxk/cnxk_se.h b/drivers/crypto/cnxk/cnxk_se.h index 0e5d2dde39..c16027ec75 100644 --- a/drivers/crypto/cnxk/cnxk_se.h +++ b/drivers/crypto/cnxk/cnxk_se.h @@ -192,6 +192,13 @@ cpt_mac_len_verify(struct rte_crypto_auth_xform *auth) case RTE_CRYPTO_AUTH_SHA3_512_HMAC: ret = (mac_len <= 64) ? 0 : -1; break; + /* SHAKE itself doesn't have limitation of digest length, + * but in microcode size of length field is limited to 8 bits + */ + case RTE_CRYPTO_AUTH_SHAKE_128: + case RTE_CRYPTO_AUTH_SHAKE_256: + ret = (mac_len <= UINT8_MAX) ? 0 : -1; + break; case RTE_CRYPTO_AUTH_NULL: ret = 0; break; @@ -1949,6 +1956,14 @@ fill_sess_auth(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess) is_sha3 = 1; auth_type = ROC_SE_SHA3_SHA512; break; + case RTE_CRYPTO_AUTH_SHAKE_128: + is_sha3 = 1; + auth_type = ROC_SE_SHA3_SHAKE128; + break; + case RTE_CRYPTO_AUTH_SHAKE_256: + is_sha3 = 1; + auth_type = ROC_SE_SHA3_SHAKE256; + break; case RTE_CRYPTO_AUTH_MD5_HMAC: case RTE_CRYPTO_AUTH_MD5: auth_type = ROC_SE_MD5_TYPE;