blob: fc55872085ef7dcf3a3cad84d48db00a61a486a2 [file] [log] [blame]
Brian Waters13d96012017-12-08 16:53:31 -06001/*********************************************************************************/
2/* freeDiameter author note:
3 * The content from this file comes directly from the hostap project.
4 * It is redistributed under the terms of the BSD license, as allowed
5 * by the original copyright reproduced below.
6 * The file has not been modified, except for this notice.
7 */
8/*********************************************************************************/
9
10/*
11 * MD5 hash implementation and interface functions
12 * Copyright (c) 2003-2005, Jouni Malinen <j@w1.fi>
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
17 *
18 * Alternatively, this software may be distributed under the terms of BSD
19 * license.
20 *
21 * See README and COPYING for more details.
22 */
23
24#ifndef MD5_H
25#define MD5_H
26
27#define MD5_MAC_LEN 16
28
29typedef uint64_t u64;
30typedef uint32_t u32;
31typedef uint16_t u16;
32typedef uint8_t u8;
33typedef int64_t s64;
34typedef int32_t s32;
35typedef int16_t s16;
36typedef int8_t s8;
37
38#define HASHLEN 16
39typedef char HASH[HASHLEN];
40#define HASHHEXLEN 32
41typedef char HASHHEX[HASHHEXLEN+1];
42#define IN
43#define OUT
44
45struct MD5Context {
46 u32 buf[4];
47 u32 bits[2];
48 u8 in[64];
49};
50typedef struct MD5Context MD5_CTX;
51#define os_memcpy(d, s, n) memcpy((d), (s), (n))
52#define os_memset(s, c, n) memset(s, c, n)
53
54
55void MD5Init(struct MD5Context *ctx);
56void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len);
57void MD5Final(unsigned char digest[16], struct MD5Context *ctx);
58
59#endif /* MD5_H */