18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Common values for SM3 algorithm
38c2ecf20Sopenharmony_ci */
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#ifndef _CRYPTO_SM3_H
68c2ecf20Sopenharmony_ci#define _CRYPTO_SM3_H
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#include <linux/types.h>
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#define SM3_DIGEST_SIZE	32
118c2ecf20Sopenharmony_ci#define SM3_BLOCK_SIZE	64
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#define SM3_T1		0x79CC4519
148c2ecf20Sopenharmony_ci#define SM3_T2		0x7A879D8A
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#define SM3_IVA		0x7380166f
178c2ecf20Sopenharmony_ci#define SM3_IVB		0x4914b2b9
188c2ecf20Sopenharmony_ci#define SM3_IVC		0x172442d7
198c2ecf20Sopenharmony_ci#define SM3_IVD		0xda8a0600
208c2ecf20Sopenharmony_ci#define SM3_IVE		0xa96f30bc
218c2ecf20Sopenharmony_ci#define SM3_IVF		0x163138aa
228c2ecf20Sopenharmony_ci#define SM3_IVG		0xe38dee4d
238c2ecf20Sopenharmony_ci#define SM3_IVH		0xb0fb0e4e
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ciextern const u8 sm3_zero_message_hash[SM3_DIGEST_SIZE];
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_cistruct sm3_state {
288c2ecf20Sopenharmony_ci	u32 state[SM3_DIGEST_SIZE / 4];
298c2ecf20Sopenharmony_ci	u64 count;
308c2ecf20Sopenharmony_ci	u8 buffer[SM3_BLOCK_SIZE];
318c2ecf20Sopenharmony_ci};
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_cistruct shash_desc;
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ciextern int crypto_sm3_update(struct shash_desc *desc, const u8 *data,
368c2ecf20Sopenharmony_ci			      unsigned int len);
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ciextern int crypto_sm3_final(struct shash_desc *desc, u8 *out);
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ciextern int crypto_sm3_finup(struct shash_desc *desc, const u8 *data,
418c2ecf20Sopenharmony_ci			     unsigned int len, u8 *hash);
428c2ecf20Sopenharmony_ci#endif
43