From patchwork Wed Jan 4 14:38:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Fialko X-Patchwork-Id: 121577 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 AB234A00C2; Wed, 4 Jan 2023 15:38:30 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9DD0142D15; Wed, 4 Jan 2023 15:38:30 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 0042242D14 for ; Wed, 4 Jan 2023 15:38:28 +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 30442PIR001233; Wed, 4 Jan 2023 06:38:28 -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=MoBm4YSVio8sbkHJ8kZJlgqyhhL0CrL/0knl6twjXN4UW9vRqJ7xIFvb9tcoVfC3fDgl Vkxq/wEc7LFkTSpxGvLqOqf73fC8fKqeIJ8TKBIHyrJ/ldLLDFQFCKm4ANx5t3fchw0+ fp61x/00cxdAMSoOGwnioDFGoYZvkztdF8UgJJNgDON2rN0t7WtZ+df66Q9dTCjso7Qp vAd+ZqKSvlZa7fWDz3v150Z88OjGsBEtDdDpONItWAaoBxf5gpigrVV4rcV0qO9Lsbj9 rdmcuATZ4y2+yoY4NF6Nb9VtZC2gtf7MMwammfR7fcWSjuMzbptKr8TAtJsA0fmPaO/J 6Q== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3mtnftkx9s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 04 Jan 2023 06:38:28 -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; Wed, 4 Jan 2023 06:38:26 -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; Wed, 4 Jan 2023 06:38:26 -0800 Received: from cavium-DT10.. (unknown [10.28.34.39]) by maili.marvell.com (Postfix) with ESMTP id 4D04A3F7054; Wed, 4 Jan 2023 06:38:24 -0800 (PST) From: Volodymyr Fialko To: , Akhil Goyal , Fan Zhang CC: , , Volodymyr Fialko Subject: [PATCH 1/3] cryptodev: add SHAKE algorithm Date: Wed, 4 Jan 2023 15:38:13 +0100 Message-ID: <20230104143815.603524-2-vfialko@marvell.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230104143815.603524-1-vfialko@marvell.com> References: <20230104143815.603524-1-vfialko@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: JtpJaoJDrkM47wFgfofN3MuX5m1Hv-D8 X-Proofpoint-ORIG-GUID: JtpJaoJDrkM47wFgfofN3MuX5m1Hv-D8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-04_07,2023-01-04_02,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 --- 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 Wed Jan 4 14:38:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Fialko X-Patchwork-Id: 121578 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 1DD35A00C2; Wed, 4 Jan 2023 15:38:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8BD9F42D22; Wed, 4 Jan 2023 15:38:35 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 100EC42D21 for ; Wed, 4 Jan 2023 15:38:33 +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 3043cric004846; Wed, 4 Jan 2023 06:38:33 -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=k4D7wrxPZBngw2ZSCLyw4bzLyVeb4VvXg75aqYlRo2P/9JHH6LyZ5gsqdhCoIDD7BAqx 27bskqrecGi+/iyOru1JpisiX1KKmD3KUSxLU5mivht0dDiZZ9xloGliRDPk7W+6NGn6 IcMAnyci4mCf5j0k5ZVYsp0qxrrIwc2ggIJwv+0PYdlDdtGttCbDfIvhMxsc0eAyVr9g PCVM5/ScpphZpp94TRG65X6AJMoXky6syY9axDah8F8oxzqV+6TglhH/J9r/ghZ9wOxh LnVbZDkF+cBrHrlbn/ISko6B9YYtJh/trsqBLq7tlSLl9tCZ3xrbibf39VcrDD65sUVW Ig== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3mtnftkxa0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 04 Jan 2023 06:38:33 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Wed, 4 Jan 2023 06:38:31 -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; Wed, 4 Jan 2023 06:38:31 -0800 Received: from cavium-DT10.. (unknown [10.28.34.39]) by maili.marvell.com (Postfix) with ESMTP id 932C13F7054; Wed, 4 Jan 2023 06:38:28 -0800 (PST) From: Volodymyr Fialko To: , Akhil Goyal , Fan Zhang , Yipeng Wang , Sameh Gobriel , Bruce Richardson , Vladimir Medvedkin CC: , , Volodymyr Fialko Subject: [PATCH 2/3] app/test: add SHAKE test cases Date: Wed, 4 Jan 2023 15:38:14 +0100 Message-ID: <20230104143815.603524-3-vfialko@marvell.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230104143815.603524-1-vfialko@marvell.com> References: <20230104143815.603524-1-vfialko@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: BScP75_pzS46OErmSRA9PkRiTYEkXbqW X-Proofpoint-ORIG-GUID: BScP75_pzS46OErmSRA9PkRiTYEkXbqW X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-04_07,2023-01-04_02,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 --- 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 Wed Jan 4 14:38:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Fialko X-Patchwork-Id: 121579 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 7E2BCA00C2; Wed, 4 Jan 2023 15:38:44 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EB95C42D20; Wed, 4 Jan 2023 15:38:42 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 9EDF042B8E for ; Wed, 4 Jan 2023 15:38:40 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 304CfK3F009005 for ; Wed, 4 Jan 2023 06:38:39 -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=3WzPJlqusi4pqNjWrPD0W4xLlSSO2ADZID+U3N6FwuU=; b=OXY+DzhH3ng+pultYyJ77ldW8jH9GykdtApTfeIpNnHUqqM4vxuzUP5G3TOe5ZadgWbi CCFH6m5QZQmb7jOiRqSlcDmsn87gVcrc25LJYhN0rrzb2pMzI/pPCZnDWqA42QH6HgPa gvgPLjILcpz9TY20fHLdRHqfckrb1G+Zo+1SpwDRpy8DkfBPv6f5s3PFElxGIIGvhnJa uOcFYcgluXa+TD+bQLndRwdXD5d45iErxkxiRbSP7/5qfppUIR2dEEGDtDe++szljWAG VZ1rxrLbgVvy7cBvvACyCIm5eraZ6uM0DyAPZoaFGJbLrGgB5EfgyCAkMK1Fsv1IYfyh jg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3mw9p50b72-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 04 Jan 2023 06:38:39 -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; Wed, 4 Jan 2023 06:38:38 -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; Wed, 4 Jan 2023 06:38:38 -0800 Received: from cavium-DT10.. (unknown [10.28.34.39]) by maili.marvell.com (Postfix) with ESMTP id C8DA43F7054; Wed, 4 Jan 2023 06:38:34 -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 3/3] crypto/cnxk: add support for SHAKE hash Date: Wed, 4 Jan 2023 15:38:15 +0100 Message-ID: <20230104143815.603524-4-vfialko@marvell.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230104143815.603524-1-vfialko@marvell.com> References: <20230104143815.603524-1-vfialko@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: H3nrjehQpDMKJxkCXkQE0m_FyZyKP8a9 X-Proofpoint-ORIG-GUID: H3nrjehQpDMKJxkCXkQE0m_FyZyKP8a9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-04_07,2023-01-04_02,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 c357c19c0b..f4a5a32522 100644 --- a/drivers/common/cnxk/roc_se.h +++ b/drivers/common/cnxk/roc_se.h @@ -92,8 +92,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 60514a32aa..78789c3e28 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 4b0cc4df19..6a651119b3 100644 --- a/drivers/crypto/cnxk/cnxk_se.h +++ b/drivers/crypto/cnxk/cnxk_se.h @@ -183,6 +183,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; @@ -2204,6 +2211,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;