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