Linus Torvalds | d7c208a | 2009-08-05 16:13:20 -0700 | [diff] [blame] | 1 | /* |
Nicolas Pitre | 30ae47b | 2009-08-17 20:09:56 -0400 | [diff] [blame] | 2 | * SHA1 routine optimized to do word accesses rather than byte accesses, |
Linus Torvalds | d7c208a | 2009-08-05 16:13:20 -0700 | [diff] [blame] | 3 | * and to avoid unnecessary copies into the context array. |
Nicolas Pitre | 30ae47b | 2009-08-17 20:09:56 -0400 | [diff] [blame] | 4 | * |
| 5 | * This was initially based on the Mozilla SHA1 implementation, although |
| 6 | * none of the original Mozilla code remains. |
Linus Torvalds | d7c208a | 2009-08-05 16:13:20 -0700 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | typedef struct { |
Nicolas Pitre | d5f6a96 | 2009-08-17 20:18:23 -0400 | [diff] [blame] | 10 | unsigned long long size; |
Linus Torvalds | d7c208a | 2009-08-05 16:13:20 -0700 | [diff] [blame] | 11 | unsigned int H[5]; |
| 12 | unsigned int W[16]; |
Linus Torvalds | d7c208a | 2009-08-05 16:13:20 -0700 | [diff] [blame] | 13 | } blk_SHA_CTX; |
| 14 | |
| 15 | void blk_SHA1_Init(blk_SHA_CTX *ctx); |
Jeff King | 9bb4542 | 2020-11-13 00:07:17 -0500 | [diff] [blame] | 16 | void blk_SHA1_Update(blk_SHA_CTX *ctx, const void *dataIn, size_t len); |
Linus Torvalds | d7c208a | 2009-08-05 16:13:20 -0700 | [diff] [blame] | 17 | void blk_SHA1_Final(unsigned char hashout[20], blk_SHA_CTX *ctx); |
| 18 | |
Atousa Pahlevan Duprat | 3bc72fd | 2015-11-04 22:38:41 -0800 | [diff] [blame] | 19 | #define platform_SHA_CTX blk_SHA_CTX |
| 20 | #define platform_SHA1_Init blk_SHA1_Init |
| 21 | #define platform_SHA1_Update blk_SHA1_Update |
| 22 | #define platform_SHA1_Final blk_SHA1_Final |