blob: cc486d5b16710007b14e44cb49333ca5113cee8d [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001
2
3#define SHA_LBLOCK 16
4#define SHA_CBLOCK (SHA_LBLOCK*4)/* SHA treats input data as a
5 * contiguous array of 32 bit wide
6 * big-endian values. */
7#define SHA_LAST_BLOCK (SHA_CBLOCK-8)
8#define SHA_DIGEST_LENGTH 20
9#define SHA512_CBLOCK (SHA_LBLOCK*8)
10#define SHA512_DIGEST_LENGTH 64
11
12
13#define SHA_LONG64 unsigned long
14
15#define U64(C) C##ULL
16
17
18typedef struct SHA512state_st {
19 SHA_LONG64 h[8];
20 SHA_LONG64 Nl, Nh;
21 union {
22 SHA_LONG64 d[SHA_LBLOCK];
23 unsigned char p[SHA512_CBLOCK];
24 } u;
25 unsigned int num, md_len;
26} SHA512_CTX;
27