blob: 9fb0441b98849e14e589d7a1b436e3338ae4688d [file] [log] [blame]
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07001/*
Nicolas Pitre30ae47b2009-08-17 20:09:56 -04002 * SHA1 routine optimized to do word accesses rather than byte accesses,
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07003 * and to avoid unnecessary copies into the context array.
Nicolas Pitre30ae47b2009-08-17 20:09:56 -04004 *
5 * This was initially based on the Mozilla SHA1 implementation, although
6 * none of the original Mozilla code remains.
Linus Torvaldsd7c208a2009-08-05 16:13:20 -07007 */
8
9typedef struct {
Nicolas Pitred5f6a962009-08-17 20:18:23 -040010 unsigned long long size;
Linus Torvaldsd7c208a2009-08-05 16:13:20 -070011 unsigned int H[5];
12 unsigned int W[16];
Linus Torvaldsd7c208a2009-08-05 16:13:20 -070013} blk_SHA_CTX;
14
15void blk_SHA1_Init(blk_SHA_CTX *ctx);
Jeff King9bb45422020-11-13 00:07:17 -050016void blk_SHA1_Update(blk_SHA_CTX *ctx, const void *dataIn, size_t len);
Linus Torvaldsd7c208a2009-08-05 16:13:20 -070017void blk_SHA1_Final(unsigned char hashout[20], blk_SHA_CTX *ctx);
18
Atousa Pahlevan Duprat3bc72fd2015-11-04 22:38:41 -080019#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