Reuben Dowle | 1908fd9 | 2020-04-16 17:36:52 +1200 | [diff] [blame] | 1 | #ifndef _SHA512_H |
| 2 | #define _SHA512_H |
| 3 | |
Tom Rini | dec7ea0 | 2024-05-20 13:35:03 -0600 | [diff] [blame] | 4 | #include <linux/types.h> |
| 5 | |
Reuben Dowle | 1908fd9 | 2020-04-16 17:36:52 +1200 | [diff] [blame] | 6 | #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 | |
| 15 | typedef 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 | |
| 21 | extern const uint8_t sha512_der_prefix[]; |
| 22 | |
| 23 | void sha512_starts(sha512_context * ctx); |
| 24 | void sha512_update(sha512_context *ctx, const uint8_t *input, uint32_t length); |
| 25 | void sha512_finish(sha512_context * ctx, uint8_t digest[SHA512_SUM_LEN]); |
| 26 | |
| 27 | void sha512_csum_wd(const unsigned char *input, unsigned int ilen, |
| 28 | unsigned char *output, unsigned int chunk_sz); |
| 29 | |
| 30 | extern const uint8_t sha384_der_prefix[]; |
| 31 | |
| 32 | void sha384_starts(sha512_context * ctx); |
| 33 | void sha384_update(sha512_context *ctx, const uint8_t *input, uint32_t length); |
| 34 | void sha384_finish(sha512_context * ctx, uint8_t digest[SHA384_SUM_LEN]); |
| 35 | |
| 36 | void sha384_csum_wd(const unsigned char *input, unsigned int ilen, |
| 37 | unsigned char *output, unsigned int chunk_sz); |
| 38 | |
| 39 | |
| 40 | #endif /* _SHA512_H */ |