Brian Waters | 13d9601 | 2017-12-08 16:53:31 -0600 | [diff] [blame] | 1 | /*********************************************************************************/ |
| 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 | |
| 29 | typedef uint64_t u64; |
| 30 | typedef uint32_t u32; |
| 31 | typedef uint16_t u16; |
| 32 | typedef uint8_t u8; |
| 33 | typedef int64_t s64; |
| 34 | typedef int32_t s32; |
| 35 | typedef int16_t s16; |
| 36 | typedef int8_t s8; |
| 37 | |
| 38 | #define HASHLEN 16 |
| 39 | typedef char HASH[HASHLEN]; |
| 40 | #define HASHHEXLEN 32 |
| 41 | typedef char HASHHEX[HASHHEXLEN+1]; |
| 42 | #define IN |
| 43 | #define OUT |
| 44 | |
| 45 | struct MD5Context { |
| 46 | u32 buf[4]; |
| 47 | u32 bits[2]; |
| 48 | u8 in[64]; |
| 49 | }; |
| 50 | typedef 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 | |
| 55 | void MD5Init(struct MD5Context *ctx); |
| 56 | void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len); |
| 57 | void MD5Final(unsigned char digest[16], struct MD5Context *ctx); |
| 58 | |
| 59 | #endif /* MD5_H */ |