blob: a4fe176c0b46a0a2ad86cb404f27b29a715e4864 [file] [log] [blame]
Jean-Christophe PLAGNIOL-VILLARDc58a6b82008-06-07 12:29:52 +02001#ifndef _SHA256_H
2#define _SHA256_H
3
Tom Rinidec7ea02024-05-20 13:35:03 -06004#include <linux/types.h>
5
Jean-Christophe PLAGNIOL-VILLARDc58a6b82008-06-07 12:29:52 +02006#define SHA256_SUM_LEN 32
Andrew Duda3db9ff02016-11-08 18:53:40 +00007#define SHA256_DER_LEN 19
8
9extern const uint8_t sha256_der_prefix[];
Jean-Christophe PLAGNIOL-VILLARDc58a6b82008-06-07 12:29:52 +020010
Simon Glass0df82432012-12-05 14:46:34 +000011/* Reset watchdog each time we process this many bytes */
12#define CHUNKSZ_SHA256 (64 * 1024)
13
Jean-Christophe PLAGNIOL-VILLARDc58a6b82008-06-07 12:29:52 +020014typedef struct {
15 uint32_t total[2];
16 uint32_t state[8];
17 uint8_t buffer[64];
18} sha256_context;
19
20void sha256_starts(sha256_context * ctx);
Simon Glass0df82432012-12-05 14:46:34 +000021void sha256_update(sha256_context *ctx, const uint8_t *input, uint32_t length);
Jean-Christophe PLAGNIOL-VILLARDc58a6b82008-06-07 12:29:52 +020022void sha256_finish(sha256_context * ctx, uint8_t digest[SHA256_SUM_LEN]);
23
Simon Glass0df82432012-12-05 14:46:34 +000024void sha256_csum_wd(const unsigned char *input, unsigned int ilen,
25 unsigned char *output, unsigned int chunk_sz);
26
Jean-Christophe PLAGNIOL-VILLARDc58a6b82008-06-07 12:29:52 +020027#endif /* _SHA256_H */