xref: /openbmc/linux/include/crypto/sm3.h (revision 2359ccdd)
1 /*
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 
25 extern const u8 sm3_zero_message_hash[SM3_DIGEST_SIZE];
26 
27 struct sm3_state {
28 	u32 state[SM3_DIGEST_SIZE / 4];
29 	u64 count;
30 	u8 buffer[SM3_BLOCK_SIZE];
31 };
32 
33 struct shash_desc;
34 
35 extern int crypto_sm3_update(struct shash_desc *desc, const u8 *data,
36 			      unsigned int len);
37 
38 extern int crypto_sm3_finup(struct shash_desc *desc, const u8 *data,
39 			     unsigned int len, u8 *hash);
40 #endif
41