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