sha256.h 661 B

12345678910111213141516171819202122232425
  1. #ifndef _SHA256_H
  2. #define _SHA256_H
  3. #define SHA256_SUM_LEN 32
  4. #define SHA256_DER_LEN 19
  5. extern const uint8_t sha256_der_prefix[];
  6. /* Reset watchdog each time we process this many bytes */
  7. #define CHUNKSZ_SHA256 (64 * 1024)
  8. typedef struct {
  9. uint32_t total[2];
  10. uint32_t state[8];
  11. uint8_t buffer[64];
  12. } sha256_context;
  13. void sha256_starts(sha256_context * ctx);
  14. void sha256_update(sha256_context *ctx, const uint8_t *input, uint32_t length);
  15. void sha256_finish(sha256_context * ctx, uint8_t digest[SHA256_SUM_LEN]);
  16. void sha256_csum_wd(const unsigned char *input, unsigned int ilen,
  17. unsigned char *output, unsigned int chunk_sz);
  18. #endif /* _SHA256_H */