Andy Fleming | 72c23be | 2008-04-02 16:19:07 -0500 | [diff] [blame] | 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 | |
Mike Frysinger | 4ad8e9f | 2009-07-02 19:23:25 -0400 | [diff] [blame] | 9 | #include "compiler.h" |
Andy Fleming | 72c23be | 2008-04-02 16:19:07 -0500 | [diff] [blame] | 10 | |
| 11 | struct MD5Context { |
| 12 | __u32 buf[4]; |
| 13 | __u32 bits[2]; |
Marek Vasut | e7ab380 | 2012-04-29 00:28:40 +0200 | [diff] [blame] | 14 | union { |
| 15 | unsigned char in[64]; |
| 16 | __u32 in32[16]; |
| 17 | }; |
Andy Fleming | 72c23be | 2008-04-02 16:19:07 -0500 | [diff] [blame] | 18 | }; |
| 19 | |
Chia-Wei Wang | abc83f9 | 2021-07-30 09:08:02 +0800 | [diff] [blame] | 20 | void MD5Init(struct MD5Context *ctx); |
| 21 | void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len); |
| 22 | void MD5Final(unsigned char digest[16], struct MD5Context *ctx); |
| 23 | |
Andy Fleming | 72c23be | 2008-04-02 16:19:07 -0500 | [diff] [blame] | 24 | /* |
| 25 | * Calculate and store in 'output' the MD5 digest of 'len' bytes at |
| 26 | * 'input'. 'output' must have enough space to hold 16 bytes. |
| 27 | */ |
| 28 | void md5 (unsigned char *input, int len, unsigned char output[16]); |
| 29 | |
Bartlomiej Sieka | da5045d | 2008-04-22 12:27:56 +0200 | [diff] [blame] | 30 | /* |
| 31 | * Calculate and store in 'output' the MD5 digest of 'len' bytes at 'input'. |
| 32 | * 'output' must have enough space to hold 16 bytes. If 'chunk' Trigger the |
| 33 | * watchdog every 'chunk_sz' bytes of input processed. |
| 34 | */ |
| 35 | void md5_wd (unsigned char *input, int len, unsigned char output[16], |
| 36 | unsigned int chunk_sz); |
| 37 | |
Andy Fleming | 72c23be | 2008-04-02 16:19:07 -0500 | [diff] [blame] | 38 | #endif /* _MD5_H */ |