2 * md4.h Structures and prototypes for md4.
5 * License: LGPL, but largely derived from a public domain source.
15 #ifdef HAVE_INTTYPES_H
19 #ifdef HAVE_SYS_TYPES_H
20 #include <sys/types.h>
30 * FreeRADIUS defines to ensure globally unique MD4 function names,
31 * so that we don't pick up other MD4 libraries.
33 #define MD4_CTX librad_MD4_CTX
34 #define MD4Init librad_MD4Init
35 #define MD4Update librad_MD4Update
36 #define MD4Final librad_MD4Final
38 void md4_calc (unsigned char *, const unsigned char *, unsigned int);
40 /* The below was retrieved from
41 * http://www.openbsd.org/cgi-bin/cvsweb/src/include/md4.h?rev=1.12
42 * With the following changes: uint64_t => uint32_t[2]
43 * Commented out #include <sys/cdefs.h>
44 * Commented out the __BEGIN and __END _DECLS, and the __attributes.
45 * Commented out MD4End, MD4File, MD4Data
46 * Commented out header file protection #ifndef,#define,#endif
49 /* $OpenBSD: md4.h,v 1.12 2004/04/28 16:54:00 millert Exp $ */
52 * This code implements the MD4 message-digest algorithm.
53 * The algorithm is due to Ron Rivest. This code was
54 * written by Colin Plumb in 1993, no copyright is claimed.
55 * This code is in the public domain; do with it what you wish.
56 * Todd C. Miller modified the MD5 code to do MD4 based on RFC 1186.
58 * Equivalent code is available from RSA Data Security, Inc.
59 * This code has been tested against that, and is equivalent,
60 * except that you don't need to include two pages of legalese
67 #define MD4_BLOCK_LENGTH 64
68 #define MD4_DIGEST_LENGTH 16
69 #define MD4_DIGEST_STRING_LENGTH (MD4_DIGEST_LENGTH * 2 + 1)
71 typedef struct MD4Context {
72 u_int32_t state[4]; /* state */
73 u_int32_t count[2]; /* number of bits, mod 2^64 */
74 u_int8_t buffer[MD4_BLOCK_LENGTH]; /* input buffer */
77 /*#include <sys/cdefs.h>*/
80 void MD4Init(MD4_CTX *);
81 void MD4Update(MD4_CTX *, const u_int8_t *, size_t)
82 /* __attribute__((__bounded__(__string__,2,3)))*/;
83 void MD4Final(u_int8_t [MD4_DIGEST_LENGTH], MD4_CTX *)
84 /* __attribute__((__bounded__(__minbytes__,1,MD4_DIGEST_LENGTH)))*/;
85 void MD4Transform(u_int32_t [4], const u_int8_t [MD4_BLOCK_LENGTH])
86 /* __attribute__((__bounded__(__minbytes__,1,4)))
87 __attribute__((__bounded__(__minbytes__,2,MD4_BLOCK_LENGTH)))*/;
88 /*char *MD4End(MD4_CTX *, char [MD4_DIGEST_STRING_LENGTH])
89 __attribute__((__bounded__(__minbytes__,2,MD4_DIGEST_STRING_LENGTH)));
90 char *MD4File(char *, char [MD4_DIGEST_STRING_LENGTH])
91 __attribute__((__bounded__(__minbytes__,2,MD4_DIGEST_STRING_LENGTH)));
92 char *MD4Data(const u_int8_t *, size_t, char [MD4_DIGEST_STRING_LENGTH])
93 __attribute__((__bounded__(__string__,1,2)))
94 __attribute__((__bounded__(__minbytes__,3,MD4_DIGEST_STRING_LENGTH)));*/
97 #endif /* _LRAD_MD4_H */