18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Common values for SHA-3 algorithms 48c2ecf20Sopenharmony_ci */ 58c2ecf20Sopenharmony_ci#ifndef __CRYPTO_SHA3_H__ 68c2ecf20Sopenharmony_ci#define __CRYPTO_SHA3_H__ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#define SHA3_224_DIGEST_SIZE (224 / 8) 98c2ecf20Sopenharmony_ci#define SHA3_224_BLOCK_SIZE (200 - 2 * SHA3_224_DIGEST_SIZE) 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#define SHA3_256_DIGEST_SIZE (256 / 8) 128c2ecf20Sopenharmony_ci#define SHA3_256_BLOCK_SIZE (200 - 2 * SHA3_256_DIGEST_SIZE) 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#define SHA3_384_DIGEST_SIZE (384 / 8) 158c2ecf20Sopenharmony_ci#define SHA3_384_BLOCK_SIZE (200 - 2 * SHA3_384_DIGEST_SIZE) 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#define SHA3_512_DIGEST_SIZE (512 / 8) 188c2ecf20Sopenharmony_ci#define SHA3_512_BLOCK_SIZE (200 - 2 * SHA3_512_DIGEST_SIZE) 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_cistruct sha3_state { 218c2ecf20Sopenharmony_ci u64 st[25]; 228c2ecf20Sopenharmony_ci unsigned int rsiz; 238c2ecf20Sopenharmony_ci unsigned int rsizw; 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci unsigned int partial; 268c2ecf20Sopenharmony_ci u8 buf[SHA3_224_BLOCK_SIZE]; 278c2ecf20Sopenharmony_ci}; 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ciint crypto_sha3_init(struct shash_desc *desc); 308c2ecf20Sopenharmony_ciint crypto_sha3_update(struct shash_desc *desc, const u8 *data, 318c2ecf20Sopenharmony_ci unsigned int len); 328c2ecf20Sopenharmony_ciint crypto_sha3_final(struct shash_desc *desc, u8 *out); 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci#endif 35