18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Cryptographic API. 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * SHA-3, as specified in 68c2ecf20Sopenharmony_ci * https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * SHA-3 code by Jeff Garzik <jeff@garzik.org> 98c2ecf20Sopenharmony_ci * Ard Biesheuvel <ard.biesheuvel@linaro.org> 108c2ecf20Sopenharmony_ci */ 118c2ecf20Sopenharmony_ci#include <crypto/internal/hash.h> 128c2ecf20Sopenharmony_ci#include <linux/init.h> 138c2ecf20Sopenharmony_ci#include <linux/module.h> 148c2ecf20Sopenharmony_ci#include <linux/types.h> 158c2ecf20Sopenharmony_ci#include <crypto/sha3.h> 168c2ecf20Sopenharmony_ci#include <asm/unaligned.h> 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci/* 198c2ecf20Sopenharmony_ci * On some 32-bit architectures (h8300), GCC ends up using 208c2ecf20Sopenharmony_ci * over 1 KB of stack if we inline the round calculation into the loop 218c2ecf20Sopenharmony_ci * in keccakf(). On the other hand, on 64-bit architectures with plenty 228c2ecf20Sopenharmony_ci * of [64-bit wide] general purpose registers, not inlining it severely 238c2ecf20Sopenharmony_ci * hurts performance. So let's use 64-bitness as a heuristic to decide 248c2ecf20Sopenharmony_ci * whether to inline or not. 258c2ecf20Sopenharmony_ci */ 268c2ecf20Sopenharmony_ci#ifdef CONFIG_64BIT 278c2ecf20Sopenharmony_ci#define SHA3_INLINE inline 288c2ecf20Sopenharmony_ci#else 298c2ecf20Sopenharmony_ci#define SHA3_INLINE noinline 308c2ecf20Sopenharmony_ci#endif 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#define KECCAK_ROUNDS 24 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_cistatic const u64 keccakf_rndc[24] = { 358c2ecf20Sopenharmony_ci 0x0000000000000001ULL, 0x0000000000008082ULL, 0x800000000000808aULL, 368c2ecf20Sopenharmony_ci 0x8000000080008000ULL, 0x000000000000808bULL, 0x0000000080000001ULL, 378c2ecf20Sopenharmony_ci 0x8000000080008081ULL, 0x8000000000008009ULL, 0x000000000000008aULL, 388c2ecf20Sopenharmony_ci 0x0000000000000088ULL, 0x0000000080008009ULL, 0x000000008000000aULL, 398c2ecf20Sopenharmony_ci 0x000000008000808bULL, 0x800000000000008bULL, 0x8000000000008089ULL, 408c2ecf20Sopenharmony_ci 0x8000000000008003ULL, 0x8000000000008002ULL, 0x8000000000000080ULL, 418c2ecf20Sopenharmony_ci 0x000000000000800aULL, 0x800000008000000aULL, 0x8000000080008081ULL, 428c2ecf20Sopenharmony_ci 0x8000000000008080ULL, 0x0000000080000001ULL, 0x8000000080008008ULL 438c2ecf20Sopenharmony_ci}; 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci/* update the state with given number of rounds */ 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_cistatic SHA3_INLINE void keccakf_round(u64 st[25]) 488c2ecf20Sopenharmony_ci{ 498c2ecf20Sopenharmony_ci u64 t[5], tt, bc[5]; 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci /* Theta */ 528c2ecf20Sopenharmony_ci bc[0] = st[0] ^ st[5] ^ st[10] ^ st[15] ^ st[20]; 538c2ecf20Sopenharmony_ci bc[1] = st[1] ^ st[6] ^ st[11] ^ st[16] ^ st[21]; 548c2ecf20Sopenharmony_ci bc[2] = st[2] ^ st[7] ^ st[12] ^ st[17] ^ st[22]; 558c2ecf20Sopenharmony_ci bc[3] = st[3] ^ st[8] ^ st[13] ^ st[18] ^ st[23]; 568c2ecf20Sopenharmony_ci bc[4] = st[4] ^ st[9] ^ st[14] ^ st[19] ^ st[24]; 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci t[0] = bc[4] ^ rol64(bc[1], 1); 598c2ecf20Sopenharmony_ci t[1] = bc[0] ^ rol64(bc[2], 1); 608c2ecf20Sopenharmony_ci t[2] = bc[1] ^ rol64(bc[3], 1); 618c2ecf20Sopenharmony_ci t[3] = bc[2] ^ rol64(bc[4], 1); 628c2ecf20Sopenharmony_ci t[4] = bc[3] ^ rol64(bc[0], 1); 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci st[0] ^= t[0]; 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci /* Rho Pi */ 678c2ecf20Sopenharmony_ci tt = st[1]; 688c2ecf20Sopenharmony_ci st[ 1] = rol64(st[ 6] ^ t[1], 44); 698c2ecf20Sopenharmony_ci st[ 6] = rol64(st[ 9] ^ t[4], 20); 708c2ecf20Sopenharmony_ci st[ 9] = rol64(st[22] ^ t[2], 61); 718c2ecf20Sopenharmony_ci st[22] = rol64(st[14] ^ t[4], 39); 728c2ecf20Sopenharmony_ci st[14] = rol64(st[20] ^ t[0], 18); 738c2ecf20Sopenharmony_ci st[20] = rol64(st[ 2] ^ t[2], 62); 748c2ecf20Sopenharmony_ci st[ 2] = rol64(st[12] ^ t[2], 43); 758c2ecf20Sopenharmony_ci st[12] = rol64(st[13] ^ t[3], 25); 768c2ecf20Sopenharmony_ci st[13] = rol64(st[19] ^ t[4], 8); 778c2ecf20Sopenharmony_ci st[19] = rol64(st[23] ^ t[3], 56); 788c2ecf20Sopenharmony_ci st[23] = rol64(st[15] ^ t[0], 41); 798c2ecf20Sopenharmony_ci st[15] = rol64(st[ 4] ^ t[4], 27); 808c2ecf20Sopenharmony_ci st[ 4] = rol64(st[24] ^ t[4], 14); 818c2ecf20Sopenharmony_ci st[24] = rol64(st[21] ^ t[1], 2); 828c2ecf20Sopenharmony_ci st[21] = rol64(st[ 8] ^ t[3], 55); 838c2ecf20Sopenharmony_ci st[ 8] = rol64(st[16] ^ t[1], 45); 848c2ecf20Sopenharmony_ci st[16] = rol64(st[ 5] ^ t[0], 36); 858c2ecf20Sopenharmony_ci st[ 5] = rol64(st[ 3] ^ t[3], 28); 868c2ecf20Sopenharmony_ci st[ 3] = rol64(st[18] ^ t[3], 21); 878c2ecf20Sopenharmony_ci st[18] = rol64(st[17] ^ t[2], 15); 888c2ecf20Sopenharmony_ci st[17] = rol64(st[11] ^ t[1], 10); 898c2ecf20Sopenharmony_ci st[11] = rol64(st[ 7] ^ t[2], 6); 908c2ecf20Sopenharmony_ci st[ 7] = rol64(st[10] ^ t[0], 3); 918c2ecf20Sopenharmony_ci st[10] = rol64( tt ^ t[1], 1); 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_ci /* Chi */ 948c2ecf20Sopenharmony_ci bc[ 0] = ~st[ 1] & st[ 2]; 958c2ecf20Sopenharmony_ci bc[ 1] = ~st[ 2] & st[ 3]; 968c2ecf20Sopenharmony_ci bc[ 2] = ~st[ 3] & st[ 4]; 978c2ecf20Sopenharmony_ci bc[ 3] = ~st[ 4] & st[ 0]; 988c2ecf20Sopenharmony_ci bc[ 4] = ~st[ 0] & st[ 1]; 998c2ecf20Sopenharmony_ci st[ 0] ^= bc[ 0]; 1008c2ecf20Sopenharmony_ci st[ 1] ^= bc[ 1]; 1018c2ecf20Sopenharmony_ci st[ 2] ^= bc[ 2]; 1028c2ecf20Sopenharmony_ci st[ 3] ^= bc[ 3]; 1038c2ecf20Sopenharmony_ci st[ 4] ^= bc[ 4]; 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci bc[ 0] = ~st[ 6] & st[ 7]; 1068c2ecf20Sopenharmony_ci bc[ 1] = ~st[ 7] & st[ 8]; 1078c2ecf20Sopenharmony_ci bc[ 2] = ~st[ 8] & st[ 9]; 1088c2ecf20Sopenharmony_ci bc[ 3] = ~st[ 9] & st[ 5]; 1098c2ecf20Sopenharmony_ci bc[ 4] = ~st[ 5] & st[ 6]; 1108c2ecf20Sopenharmony_ci st[ 5] ^= bc[ 0]; 1118c2ecf20Sopenharmony_ci st[ 6] ^= bc[ 1]; 1128c2ecf20Sopenharmony_ci st[ 7] ^= bc[ 2]; 1138c2ecf20Sopenharmony_ci st[ 8] ^= bc[ 3]; 1148c2ecf20Sopenharmony_ci st[ 9] ^= bc[ 4]; 1158c2ecf20Sopenharmony_ci 1168c2ecf20Sopenharmony_ci bc[ 0] = ~st[11] & st[12]; 1178c2ecf20Sopenharmony_ci bc[ 1] = ~st[12] & st[13]; 1188c2ecf20Sopenharmony_ci bc[ 2] = ~st[13] & st[14]; 1198c2ecf20Sopenharmony_ci bc[ 3] = ~st[14] & st[10]; 1208c2ecf20Sopenharmony_ci bc[ 4] = ~st[10] & st[11]; 1218c2ecf20Sopenharmony_ci st[10] ^= bc[ 0]; 1228c2ecf20Sopenharmony_ci st[11] ^= bc[ 1]; 1238c2ecf20Sopenharmony_ci st[12] ^= bc[ 2]; 1248c2ecf20Sopenharmony_ci st[13] ^= bc[ 3]; 1258c2ecf20Sopenharmony_ci st[14] ^= bc[ 4]; 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci bc[ 0] = ~st[16] & st[17]; 1288c2ecf20Sopenharmony_ci bc[ 1] = ~st[17] & st[18]; 1298c2ecf20Sopenharmony_ci bc[ 2] = ~st[18] & st[19]; 1308c2ecf20Sopenharmony_ci bc[ 3] = ~st[19] & st[15]; 1318c2ecf20Sopenharmony_ci bc[ 4] = ~st[15] & st[16]; 1328c2ecf20Sopenharmony_ci st[15] ^= bc[ 0]; 1338c2ecf20Sopenharmony_ci st[16] ^= bc[ 1]; 1348c2ecf20Sopenharmony_ci st[17] ^= bc[ 2]; 1358c2ecf20Sopenharmony_ci st[18] ^= bc[ 3]; 1368c2ecf20Sopenharmony_ci st[19] ^= bc[ 4]; 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_ci bc[ 0] = ~st[21] & st[22]; 1398c2ecf20Sopenharmony_ci bc[ 1] = ~st[22] & st[23]; 1408c2ecf20Sopenharmony_ci bc[ 2] = ~st[23] & st[24]; 1418c2ecf20Sopenharmony_ci bc[ 3] = ~st[24] & st[20]; 1428c2ecf20Sopenharmony_ci bc[ 4] = ~st[20] & st[21]; 1438c2ecf20Sopenharmony_ci st[20] ^= bc[ 0]; 1448c2ecf20Sopenharmony_ci st[21] ^= bc[ 1]; 1458c2ecf20Sopenharmony_ci st[22] ^= bc[ 2]; 1468c2ecf20Sopenharmony_ci st[23] ^= bc[ 3]; 1478c2ecf20Sopenharmony_ci st[24] ^= bc[ 4]; 1488c2ecf20Sopenharmony_ci} 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_cistatic void keccakf(u64 st[25]) 1518c2ecf20Sopenharmony_ci{ 1528c2ecf20Sopenharmony_ci int round; 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci for (round = 0; round < KECCAK_ROUNDS; round++) { 1558c2ecf20Sopenharmony_ci keccakf_round(st); 1568c2ecf20Sopenharmony_ci /* Iota */ 1578c2ecf20Sopenharmony_ci st[0] ^= keccakf_rndc[round]; 1588c2ecf20Sopenharmony_ci } 1598c2ecf20Sopenharmony_ci} 1608c2ecf20Sopenharmony_ci 1618c2ecf20Sopenharmony_ciint crypto_sha3_init(struct shash_desc *desc) 1628c2ecf20Sopenharmony_ci{ 1638c2ecf20Sopenharmony_ci struct sha3_state *sctx = shash_desc_ctx(desc); 1648c2ecf20Sopenharmony_ci unsigned int digest_size = crypto_shash_digestsize(desc->tfm); 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_ci sctx->rsiz = 200 - 2 * digest_size; 1678c2ecf20Sopenharmony_ci sctx->rsizw = sctx->rsiz / 8; 1688c2ecf20Sopenharmony_ci sctx->partial = 0; 1698c2ecf20Sopenharmony_ci 1708c2ecf20Sopenharmony_ci memset(sctx->st, 0, sizeof(sctx->st)); 1718c2ecf20Sopenharmony_ci return 0; 1728c2ecf20Sopenharmony_ci} 1738c2ecf20Sopenharmony_ciEXPORT_SYMBOL(crypto_sha3_init); 1748c2ecf20Sopenharmony_ci 1758c2ecf20Sopenharmony_ciint crypto_sha3_update(struct shash_desc *desc, const u8 *data, 1768c2ecf20Sopenharmony_ci unsigned int len) 1778c2ecf20Sopenharmony_ci{ 1788c2ecf20Sopenharmony_ci struct sha3_state *sctx = shash_desc_ctx(desc); 1798c2ecf20Sopenharmony_ci unsigned int done; 1808c2ecf20Sopenharmony_ci const u8 *src; 1818c2ecf20Sopenharmony_ci 1828c2ecf20Sopenharmony_ci done = 0; 1838c2ecf20Sopenharmony_ci src = data; 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_ci if ((sctx->partial + len) > (sctx->rsiz - 1)) { 1868c2ecf20Sopenharmony_ci if (sctx->partial) { 1878c2ecf20Sopenharmony_ci done = -sctx->partial; 1888c2ecf20Sopenharmony_ci memcpy(sctx->buf + sctx->partial, data, 1898c2ecf20Sopenharmony_ci done + sctx->rsiz); 1908c2ecf20Sopenharmony_ci src = sctx->buf; 1918c2ecf20Sopenharmony_ci } 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci do { 1948c2ecf20Sopenharmony_ci unsigned int i; 1958c2ecf20Sopenharmony_ci 1968c2ecf20Sopenharmony_ci for (i = 0; i < sctx->rsizw; i++) 1978c2ecf20Sopenharmony_ci sctx->st[i] ^= get_unaligned_le64(src + 8 * i); 1988c2ecf20Sopenharmony_ci keccakf(sctx->st); 1998c2ecf20Sopenharmony_ci 2008c2ecf20Sopenharmony_ci done += sctx->rsiz; 2018c2ecf20Sopenharmony_ci src = data + done; 2028c2ecf20Sopenharmony_ci } while (done + (sctx->rsiz - 1) < len); 2038c2ecf20Sopenharmony_ci 2048c2ecf20Sopenharmony_ci sctx->partial = 0; 2058c2ecf20Sopenharmony_ci } 2068c2ecf20Sopenharmony_ci memcpy(sctx->buf + sctx->partial, src, len - done); 2078c2ecf20Sopenharmony_ci sctx->partial += (len - done); 2088c2ecf20Sopenharmony_ci 2098c2ecf20Sopenharmony_ci return 0; 2108c2ecf20Sopenharmony_ci} 2118c2ecf20Sopenharmony_ciEXPORT_SYMBOL(crypto_sha3_update); 2128c2ecf20Sopenharmony_ci 2138c2ecf20Sopenharmony_ciint crypto_sha3_final(struct shash_desc *desc, u8 *out) 2148c2ecf20Sopenharmony_ci{ 2158c2ecf20Sopenharmony_ci struct sha3_state *sctx = shash_desc_ctx(desc); 2168c2ecf20Sopenharmony_ci unsigned int i, inlen = sctx->partial; 2178c2ecf20Sopenharmony_ci unsigned int digest_size = crypto_shash_digestsize(desc->tfm); 2188c2ecf20Sopenharmony_ci __le64 *digest = (__le64 *)out; 2198c2ecf20Sopenharmony_ci 2208c2ecf20Sopenharmony_ci sctx->buf[inlen++] = 0x06; 2218c2ecf20Sopenharmony_ci memset(sctx->buf + inlen, 0, sctx->rsiz - inlen); 2228c2ecf20Sopenharmony_ci sctx->buf[sctx->rsiz - 1] |= 0x80; 2238c2ecf20Sopenharmony_ci 2248c2ecf20Sopenharmony_ci for (i = 0; i < sctx->rsizw; i++) 2258c2ecf20Sopenharmony_ci sctx->st[i] ^= get_unaligned_le64(sctx->buf + 8 * i); 2268c2ecf20Sopenharmony_ci 2278c2ecf20Sopenharmony_ci keccakf(sctx->st); 2288c2ecf20Sopenharmony_ci 2298c2ecf20Sopenharmony_ci for (i = 0; i < digest_size / 8; i++) 2308c2ecf20Sopenharmony_ci put_unaligned_le64(sctx->st[i], digest++); 2318c2ecf20Sopenharmony_ci 2328c2ecf20Sopenharmony_ci if (digest_size & 4) 2338c2ecf20Sopenharmony_ci put_unaligned_le32(sctx->st[i], (__le32 *)digest); 2348c2ecf20Sopenharmony_ci 2358c2ecf20Sopenharmony_ci memset(sctx, 0, sizeof(*sctx)); 2368c2ecf20Sopenharmony_ci return 0; 2378c2ecf20Sopenharmony_ci} 2388c2ecf20Sopenharmony_ciEXPORT_SYMBOL(crypto_sha3_final); 2398c2ecf20Sopenharmony_ci 2408c2ecf20Sopenharmony_cistatic struct shash_alg algs[] = { { 2418c2ecf20Sopenharmony_ci .digestsize = SHA3_224_DIGEST_SIZE, 2428c2ecf20Sopenharmony_ci .init = crypto_sha3_init, 2438c2ecf20Sopenharmony_ci .update = crypto_sha3_update, 2448c2ecf20Sopenharmony_ci .final = crypto_sha3_final, 2458c2ecf20Sopenharmony_ci .descsize = sizeof(struct sha3_state), 2468c2ecf20Sopenharmony_ci .base.cra_name = "sha3-224", 2478c2ecf20Sopenharmony_ci .base.cra_driver_name = "sha3-224-generic", 2488c2ecf20Sopenharmony_ci .base.cra_blocksize = SHA3_224_BLOCK_SIZE, 2498c2ecf20Sopenharmony_ci .base.cra_module = THIS_MODULE, 2508c2ecf20Sopenharmony_ci}, { 2518c2ecf20Sopenharmony_ci .digestsize = SHA3_256_DIGEST_SIZE, 2528c2ecf20Sopenharmony_ci .init = crypto_sha3_init, 2538c2ecf20Sopenharmony_ci .update = crypto_sha3_update, 2548c2ecf20Sopenharmony_ci .final = crypto_sha3_final, 2558c2ecf20Sopenharmony_ci .descsize = sizeof(struct sha3_state), 2568c2ecf20Sopenharmony_ci .base.cra_name = "sha3-256", 2578c2ecf20Sopenharmony_ci .base.cra_driver_name = "sha3-256-generic", 2588c2ecf20Sopenharmony_ci .base.cra_blocksize = SHA3_256_BLOCK_SIZE, 2598c2ecf20Sopenharmony_ci .base.cra_module = THIS_MODULE, 2608c2ecf20Sopenharmony_ci}, { 2618c2ecf20Sopenharmony_ci .digestsize = SHA3_384_DIGEST_SIZE, 2628c2ecf20Sopenharmony_ci .init = crypto_sha3_init, 2638c2ecf20Sopenharmony_ci .update = crypto_sha3_update, 2648c2ecf20Sopenharmony_ci .final = crypto_sha3_final, 2658c2ecf20Sopenharmony_ci .descsize = sizeof(struct sha3_state), 2668c2ecf20Sopenharmony_ci .base.cra_name = "sha3-384", 2678c2ecf20Sopenharmony_ci .base.cra_driver_name = "sha3-384-generic", 2688c2ecf20Sopenharmony_ci .base.cra_blocksize = SHA3_384_BLOCK_SIZE, 2698c2ecf20Sopenharmony_ci .base.cra_module = THIS_MODULE, 2708c2ecf20Sopenharmony_ci}, { 2718c2ecf20Sopenharmony_ci .digestsize = SHA3_512_DIGEST_SIZE, 2728c2ecf20Sopenharmony_ci .init = crypto_sha3_init, 2738c2ecf20Sopenharmony_ci .update = crypto_sha3_update, 2748c2ecf20Sopenharmony_ci .final = crypto_sha3_final, 2758c2ecf20Sopenharmony_ci .descsize = sizeof(struct sha3_state), 2768c2ecf20Sopenharmony_ci .base.cra_name = "sha3-512", 2778c2ecf20Sopenharmony_ci .base.cra_driver_name = "sha3-512-generic", 2788c2ecf20Sopenharmony_ci .base.cra_blocksize = SHA3_512_BLOCK_SIZE, 2798c2ecf20Sopenharmony_ci .base.cra_module = THIS_MODULE, 2808c2ecf20Sopenharmony_ci} }; 2818c2ecf20Sopenharmony_ci 2828c2ecf20Sopenharmony_cistatic int __init sha3_generic_mod_init(void) 2838c2ecf20Sopenharmony_ci{ 2848c2ecf20Sopenharmony_ci return crypto_register_shashes(algs, ARRAY_SIZE(algs)); 2858c2ecf20Sopenharmony_ci} 2868c2ecf20Sopenharmony_ci 2878c2ecf20Sopenharmony_cistatic void __exit sha3_generic_mod_fini(void) 2888c2ecf20Sopenharmony_ci{ 2898c2ecf20Sopenharmony_ci crypto_unregister_shashes(algs, ARRAY_SIZE(algs)); 2908c2ecf20Sopenharmony_ci} 2918c2ecf20Sopenharmony_ci 2928c2ecf20Sopenharmony_cisubsys_initcall(sha3_generic_mod_init); 2938c2ecf20Sopenharmony_cimodule_exit(sha3_generic_mod_fini); 2948c2ecf20Sopenharmony_ci 2958c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL"); 2968c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("SHA-3 Secure Hash Algorithm"); 2978c2ecf20Sopenharmony_ci 2988c2ecf20Sopenharmony_ciMODULE_ALIAS_CRYPTO("sha3-224"); 2998c2ecf20Sopenharmony_ciMODULE_ALIAS_CRYPTO("sha3-224-generic"); 3008c2ecf20Sopenharmony_ciMODULE_ALIAS_CRYPTO("sha3-256"); 3018c2ecf20Sopenharmony_ciMODULE_ALIAS_CRYPTO("sha3-256-generic"); 3028c2ecf20Sopenharmony_ciMODULE_ALIAS_CRYPTO("sha3-384"); 3038c2ecf20Sopenharmony_ciMODULE_ALIAS_CRYPTO("sha3-384-generic"); 3048c2ecf20Sopenharmony_ciMODULE_ALIAS_CRYPTO("sha3-512"); 3058c2ecf20Sopenharmony_ciMODULE_ALIAS_CRYPTO("sha3-512-generic"); 306