blob: beadab35ffc445a6b7d19b41cc9dc85f095facdd [file] [log] [blame]
Jean-Christophe PLAGNIOL-VILLARDc58a6b82008-06-07 12:29:52 +02001#ifndef _SHA256_H
2#define _SHA256_H
3
4#define SHA256_SUM_LEN 32
5
Simon Glass0df82432012-12-05 14:46:34 +00006/* Reset watchdog each time we process this many bytes */
7#define CHUNKSZ_SHA256 (64 * 1024)
8
Jean-Christophe PLAGNIOL-VILLARDc58a6b82008-06-07 12:29:52 +02009typedef struct {
10 uint32_t total[2];
11 uint32_t state[8];
12 uint8_t buffer[64];
13} sha256_context;
14
15void sha256_starts(sha256_context * ctx);
Simon Glass0df82432012-12-05 14:46:34 +000016void sha256_update(sha256_context *ctx, const uint8_t *input, uint32_t length);
Jean-Christophe PLAGNIOL-VILLARDc58a6b82008-06-07 12:29:52 +020017void sha256_finish(sha256_context * ctx, uint8_t digest[SHA256_SUM_LEN]);
18
Simon Glass0df82432012-12-05 14:46:34 +000019void sha256_csum_wd(const unsigned char *input, unsigned int ilen,
20 unsigned char *output, unsigned int chunk_sz);
21
Jean-Christophe PLAGNIOL-VILLARDc58a6b82008-06-07 12:29:52 +020022#endif /* _SHA256_H */