1 /* $MirOS: src/include/md4.h,v 1.3 2014/03/05 14:07:26 tg Exp $ */ 2 /* $OpenBSD: md4.h,v 1.15 2004/06/22 01:57:30 jfb Exp $ */ 3 4 /* 5 * This code implements the MD4 message-digest algorithm. 6 * The algorithm is due to Ron Rivest. This code was 7 * written by Colin Plumb in 1993, no copyright is claimed. 8 * This code is in the public domain; do with it what you wish. 9 * Todd C. Miller modified the MD5 code to do MD4 based on RFC 1186. 10 * 11 * Equivalent code is available from RSA Data Security, Inc. 12 * This code has been tested against that, and is equivalent, 13 * except that you don't need to include two pages of legalese 14 * with every copy. 15 */ 16 17 #ifndef _MD4_H_ 18 #define _MD4_H_ 19 20 #define MD4_BLOCK_LENGTH 64 21 #define MD4_DIGEST_LENGTH 16 22 #define MD4_DIGEST_STRING_LENGTH (MD4_DIGEST_LENGTH * 2 + 1) 23 24 typedef struct MD4Context { 25 u_int32_t state[4]; /* state */ 26 u_int64_t count; /* number of bits, mod 2^64 */ 27 u_int8_t buffer[MD4_BLOCK_LENGTH]; /* input buffer */ 28 } MD4_CTX; 29 30 #include <sys/cdefs.h> 31 32 __BEGIN_DECLS 33 void MD4Init(MD4_CTX *); 34 void MD4Update(MD4_CTX *, const u_int8_t *, size_t) 35 __attribute__((__bounded__(__string__, 2, 3))); 36 void MD4Pad(MD4_CTX *); 37 void MD4Final(u_int8_t *, MD4_CTX *) 38 __attribute__((__bounded__(__minbytes__, 1, MD4_DIGEST_LENGTH))); 39 void MD4Transform(u_int32_t *, const u_int8_t *) 40 __attribute__((__bounded__(__minbytes__, 1, 16))) 41 __attribute__((__bounded__(__minbytes__, 2, MD4_BLOCK_LENGTH))); 42 char *MD4End(MD4_CTX *, char *) 43 __attribute__((__bounded__(__minbytes__, 2, MD4_DIGEST_STRING_LENGTH))); 44 char *MD4File(const char *, char *) 45 __attribute__((__bounded__(__minbytes__, 2, MD4_DIGEST_STRING_LENGTH))); 46 char *MD4FileChunk(const char *, char *, off_t, off_t) 47 __attribute__((__bounded__(__minbytes__, 2, MD4_DIGEST_STRING_LENGTH))); 48 char *MD4Data(const u_int8_t *, size_t, char *) 49 __attribute__((__bounded__(__string__, 1, 2))) 50 __attribute__((__bounded__(__minbytes__, 3, MD4_DIGEST_STRING_LENGTH))); 51 __END_DECLS 52 53 #endif /* _MD4_H_ */ 54