blob: 1438942dc7737437a0a9104cb14f0de9bb3dd89d [file] [log] [blame]
Gilad Ben-Yossef4f0fc162017-08-21 13:51:28 +03001/*
2 * Common values for SM3 algorithm
3 */
4
5#ifndef _CRYPTO_SM3_H
6#define _CRYPTO_SM3_H
7
8#include <linux/types.h>
9
10#define SM3_DIGEST_SIZE 32
11#define SM3_BLOCK_SIZE 64
12
13#define SM3_T1 0x79CC4519
14#define SM3_T2 0x7A879D8A
15
16#define SM3_IVA 0x7380166f
17#define SM3_IVB 0x4914b2b9
18#define SM3_IVC 0x172442d7
19#define SM3_IVD 0xda8a0600
20#define SM3_IVE 0xa96f30bc
21#define SM3_IVF 0x163138aa
22#define SM3_IVG 0xe38dee4d
23#define SM3_IVH 0xb0fb0e4e
24
25extern const u8 sm3_zero_message_hash[SM3_DIGEST_SIZE];
26
27struct sm3_state {
28 u32 state[SM3_DIGEST_SIZE / 4];
29 u64 count;
30 u8 buffer[SM3_BLOCK_SIZE];
31};
32
33struct shash_desc;
34
35extern int crypto_sm3_update(struct shash_desc *desc, const u8 *data,
36 unsigned int len);
37
38extern int crypto_sm3_finup(struct shash_desc *desc, const u8 *data,
39 unsigned int len, u8 *hash);
40#endif