xref: /openbmc/linux/include/crypto/sha3.h (revision 552c69b36ebd966186573b9c7a286b390935cce1)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
253964b9eSJeff Garzik /*
353964b9eSJeff Garzik  * Common values for SHA-3 algorithms
453964b9eSJeff Garzik  */
553964b9eSJeff Garzik #ifndef __CRYPTO_SHA3_H__
653964b9eSJeff Garzik #define __CRYPTO_SHA3_H__
753964b9eSJeff Garzik 
853964b9eSJeff Garzik #define SHA3_224_DIGEST_SIZE	(224 / 8)
953964b9eSJeff Garzik #define SHA3_224_BLOCK_SIZE	(200 - 2 * SHA3_224_DIGEST_SIZE)
1053964b9eSJeff Garzik 
1153964b9eSJeff Garzik #define SHA3_256_DIGEST_SIZE	(256 / 8)
1253964b9eSJeff Garzik #define SHA3_256_BLOCK_SIZE	(200 - 2 * SHA3_256_DIGEST_SIZE)
1353964b9eSJeff Garzik 
1453964b9eSJeff Garzik #define SHA3_384_DIGEST_SIZE	(384 / 8)
1553964b9eSJeff Garzik #define SHA3_384_BLOCK_SIZE	(200 - 2 * SHA3_384_DIGEST_SIZE)
1653964b9eSJeff Garzik 
1753964b9eSJeff Garzik #define SHA3_512_DIGEST_SIZE	(512 / 8)
1853964b9eSJeff Garzik #define SHA3_512_BLOCK_SIZE	(200 - 2 * SHA3_512_DIGEST_SIZE)
1953964b9eSJeff Garzik 
2053964b9eSJeff Garzik struct sha3_state {
2153964b9eSJeff Garzik 	u64		st[25];
2253964b9eSJeff Garzik 	unsigned int	rsiz;
2353964b9eSJeff Garzik 	unsigned int	rsizw;
2453964b9eSJeff Garzik 
2553964b9eSJeff Garzik 	unsigned int	partial;
2653964b9eSJeff Garzik 	u8		buf[SHA3_224_BLOCK_SIZE];
2753964b9eSJeff Garzik };
2853964b9eSJeff Garzik 
29*6657674bSArd Biesheuvel int crypto_sha3_init(struct shash_desc *desc);
30*6657674bSArd Biesheuvel int crypto_sha3_update(struct shash_desc *desc, const u8 *data,
31*6657674bSArd Biesheuvel 		       unsigned int len);
32*6657674bSArd Biesheuvel int crypto_sha3_final(struct shash_desc *desc, u8 *out);
33*6657674bSArd Biesheuvel 
3453964b9eSJeff Garzik #endif
35