blob: 080f60c2e6b16012bd47d931b5179e263859609c [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Jeff Garzik53964b92016-06-17 10:30:35 +05302/*
3 * Common values for SHA-3 algorithms
4 */
5#ifndef __CRYPTO_SHA3_H__
6#define __CRYPTO_SHA3_H__
7
8#define SHA3_224_DIGEST_SIZE (224 / 8)
9#define SHA3_224_BLOCK_SIZE (200 - 2 * SHA3_224_DIGEST_SIZE)
10
11#define SHA3_256_DIGEST_SIZE (256 / 8)
12#define SHA3_256_BLOCK_SIZE (200 - 2 * SHA3_256_DIGEST_SIZE)
13
14#define SHA3_384_DIGEST_SIZE (384 / 8)
15#define SHA3_384_BLOCK_SIZE (200 - 2 * SHA3_384_DIGEST_SIZE)
16
17#define SHA3_512_DIGEST_SIZE (512 / 8)
18#define SHA3_512_BLOCK_SIZE (200 - 2 * SHA3_512_DIGEST_SIZE)
19
20struct sha3_state {
21 u64 st[25];
Jeff Garzik53964b92016-06-17 10:30:35 +053022 unsigned int rsiz;
23 unsigned int rsizw;
24
25 unsigned int partial;
26 u8 buf[SHA3_224_BLOCK_SIZE];
27};
28
Ard Biesheuvel66576742018-01-19 12:04:36 +000029int crypto_sha3_init(struct shash_desc *desc);
30int crypto_sha3_update(struct shash_desc *desc, const u8 *data,
31 unsigned int len);
32int crypto_sha3_final(struct shash_desc *desc, u8 *out);
33
Jeff Garzik53964b92016-06-17 10:30:35 +053034#endif