sha3.h 879 B

1234567891011121314151617181920212223242526272829303132333435
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Common values for SHA-3 algorithms
  4. */
  5. #ifndef __CRYPTO_SHA3_H__
  6. #define __CRYPTO_SHA3_H__
  7. #define SHA3_224_DIGEST_SIZE (224 / 8)
  8. #define SHA3_224_BLOCK_SIZE (200 - 2 * SHA3_224_DIGEST_SIZE)
  9. #define SHA3_256_DIGEST_SIZE (256 / 8)
  10. #define SHA3_256_BLOCK_SIZE (200 - 2 * SHA3_256_DIGEST_SIZE)
  11. #define SHA3_384_DIGEST_SIZE (384 / 8)
  12. #define SHA3_384_BLOCK_SIZE (200 - 2 * SHA3_384_DIGEST_SIZE)
  13. #define SHA3_512_DIGEST_SIZE (512 / 8)
  14. #define SHA3_512_BLOCK_SIZE (200 - 2 * SHA3_512_DIGEST_SIZE)
  15. struct sha3_state {
  16. u64 st[25];
  17. unsigned int rsiz;
  18. unsigned int rsizw;
  19. unsigned int partial;
  20. u8 buf[SHA3_224_BLOCK_SIZE];
  21. };
  22. int crypto_sha3_init(struct shash_desc *desc);
  23. int crypto_sha3_update(struct shash_desc *desc, const u8 *data,
  24. unsigned int len);
  25. int crypto_sha3_final(struct shash_desc *desc, u8 *out);
  26. #endif