blob: 516729d7750669bed525de86dea19b9355352a83 [file] [log] [blame]
Reuben Dowle1908fd92020-04-16 17:36:52 +12001#ifndef _SHA512_H
2#define _SHA512_H
3
4#define SHA384_SUM_LEN 48
5#define SHA384_DER_LEN 19
6#define SHA512_SUM_LEN 64
7#define SHA512_DER_LEN 19
8#define SHA512_BLOCK_SIZE 128
9
10#define CHUNKSZ_SHA384 (16 * 1024)
11#define CHUNKSZ_SHA512 (16 * 1024)
12
13typedef struct {
14 uint64_t state[SHA512_SUM_LEN / 8];
15 uint64_t count[2];
16 uint8_t buf[SHA512_BLOCK_SIZE];
17} sha512_context;
18
19extern const uint8_t sha512_der_prefix[];
20
21void sha512_starts(sha512_context * ctx);
22void sha512_update(sha512_context *ctx, const uint8_t *input, uint32_t length);
23void sha512_finish(sha512_context * ctx, uint8_t digest[SHA512_SUM_LEN]);
24
25void sha512_csum_wd(const unsigned char *input, unsigned int ilen,
26 unsigned char *output, unsigned int chunk_sz);
27
28extern const uint8_t sha384_der_prefix[];
29
30void sha384_starts(sha512_context * ctx);
31void sha384_update(sha512_context *ctx, const uint8_t *input, uint32_t length);
32void sha384_finish(sha512_context * ctx, uint8_t digest[SHA384_SUM_LEN]);
33
34void sha384_csum_wd(const unsigned char *input, unsigned int ilen,
35 unsigned char *output, unsigned int chunk_sz);
36
37
38#endif /* _SHA512_H */