blob: c465925ea8daaeaedfad0752f753912c84a099be [file] [log] [blame]
Andy Fleming72c23be2008-04-02 16:19:07 -05001/*
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 Frysinger4ad8e9f2009-07-02 19:23:25 -04009#include "compiler.h"
Andy Fleming72c23be2008-04-02 16:19:07 -050010
Alexandru Gagniucf3016582021-09-02 19:54:20 -050011#define MD5_SUM_LEN 16
12
Raymond Maocdc93182024-05-16 14:11:51 -070013typedef struct MD5Context {
Andy Fleming72c23be2008-04-02 16:19:07 -050014 __u32 buf[4];
15 __u32 bits[2];
Marek Vasute7ab3802012-04-29 00:28:40 +020016 union {
17 unsigned char in[64];
18 __u32 in32[16];
19 };
Raymond Maocdc93182024-05-16 14:11:51 -070020} MD5Context;
Andy Fleming72c23be2008-04-02 16:19:07 -050021
Raymond Maocdc93182024-05-16 14:11:51 -070022void MD5Init(MD5Context *ctx);
23void MD5Update(MD5Context *ctx, unsigned char const *buf, unsigned int len);
24void MD5Final(unsigned char digest[16], MD5Context *ctx);
Chia-Wei Wangabc83f92021-07-30 09:08:02 +080025
Andy Fleming72c23be2008-04-02 16:19:07 -050026/*
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 */
30void md5 (unsigned char *input, int len, unsigned char output[16]);
31
Bartlomiej Siekada5045d2008-04-22 12:27:56 +020032/*
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 */
Alexandru Gagniucf3016582021-09-02 19:54:20 -050037void md5_wd(const unsigned char *input, unsigned int len,
38 unsigned char output[16], unsigned int chunk_sz);
Bartlomiej Siekada5045d2008-04-22 12:27:56 +020039
Andy Fleming72c23be2008-04-02 16:19:07 -050040#endif /* _MD5_H */