sm3.h 833 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Common values for SM3 algorithm
  3. */
  4. #ifndef _CRYPTO_SM3_H
  5. #define _CRYPTO_SM3_H
  6. #include <linux/types.h>
  7. #define SM3_DIGEST_SIZE 32
  8. #define SM3_BLOCK_SIZE 64
  9. #define SM3_T1 0x79CC4519
  10. #define SM3_T2 0x7A879D8A
  11. #define SM3_IVA 0x7380166f
  12. #define SM3_IVB 0x4914b2b9
  13. #define SM3_IVC 0x172442d7
  14. #define SM3_IVD 0xda8a0600
  15. #define SM3_IVE 0xa96f30bc
  16. #define SM3_IVF 0x163138aa
  17. #define SM3_IVG 0xe38dee4d
  18. #define SM3_IVH 0xb0fb0e4e
  19. extern const u8 sm3_zero_message_hash[SM3_DIGEST_SIZE];
  20. struct sm3_state {
  21. u32 state[SM3_DIGEST_SIZE / 4];
  22. u64 count;
  23. u8 buffer[SM3_BLOCK_SIZE];
  24. };
  25. struct shash_desc;
  26. extern int crypto_sm3_update(struct shash_desc *desc, const u8 *data,
  27. unsigned int len);
  28. extern int crypto_sm3_finup(struct shash_desc *desc, const u8 *data,
  29. unsigned int len, u8 *hash);
  30. #endif