Merge tag 'next-20220328' of https://source.denx.de/u-boot/custodians/u-boot-video...
[platform/kernel/u-boot.git] / include / u-boot / md5.h
1 /*
2  * This file was transplanted with slight modifications from Linux sources
3  * (fs/cifs/md5.h) into U-Boot by Bartlomiej Sieka <tur@semihalf.com>.
4  */
5
6 #ifndef _MD5_H
7 #define _MD5_H
8
9 #include "compiler.h"
10
11 #define MD5_SUM_LEN     16
12
13 struct MD5Context {
14         __u32 buf[4];
15         __u32 bits[2];
16         union {
17                 unsigned char in[64];
18                 __u32 in32[16];
19         };
20 };
21
22 void MD5Init(struct MD5Context *ctx);
23 void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len);
24 void MD5Final(unsigned char digest[16], struct MD5Context *ctx);
25
26 /*
27  * Calculate and store in 'output' the MD5 digest of 'len' bytes at
28  * 'input'. 'output' must have enough space to hold 16 bytes.
29  */
30 void md5 (unsigned char *input, int len, unsigned char output[16]);
31
32 /*
33  * Calculate and store in 'output' the MD5 digest of 'len' bytes at 'input'.
34  * 'output' must have enough space to hold 16 bytes. If 'chunk' Trigger the
35  * watchdog every 'chunk_sz' bytes of input processed.
36  */
37 void md5_wd(const unsigned char *input, unsigned int len,
38              unsigned char output[16], unsigned int chunk_sz);
39
40 #endif /* _MD5_H */