2 * md4.h Structures and prototypes for md4.
5 * License: LGPL, but largely derived from a public domain source.
12 #include <freeradius-devel/ident.h>
15 #ifdef HAVE_INTTYPES_H
19 #ifdef HAVE_SYS_TYPES_H
20 #include <sys/types.h>
29 void fr_md4_calc (unsigned char *, const unsigned char *, unsigned int);
31 #ifndef WITH_OPENSSL_MD4
32 /* The below was retrieved from
33 * http://www.openbsd.org/cgi-bin/cvsweb/src/include/md4.h?rev=1.12
34 * With the following changes: uint64_t => uint32_t[2]
35 * Commented out #include <sys/cdefs.h>
36 * Commented out the __BEGIN and __END _DECLS, and the __attributes.
37 * Commented out MD4End, MD4File, MD4Data
38 * Commented out header file protection #ifndef,#define,#endif
41 /* $OpenBSD: md4.h,v 1.12 2004/04/28 16:54:00 millert Exp $ */
44 * This code implements the MD4 message-digest algorithm.
45 * The algorithm is due to Ron Rivest. This code was
46 * written by Colin Plumb in 1993, no copyright is claimed.
47 * This code is in the public domain; do with it what you wish.
48 * Todd C. Miller modified the MD5 code to do MD4 based on RFC 1186.
50 * Equivalent code is available from RSA Data Security, Inc.
51 * This code has been tested against that, and is equivalent,
52 * except that you don't need to include two pages of legalese
59 #define MD4_BLOCK_LENGTH 64
60 #define MD4_DIGEST_LENGTH 16
61 #define MD4_DIGEST_STRING_LENGTH (MD4_DIGEST_LENGTH * 2 + 1)
63 typedef struct FR_MD4Context {
64 uint32_t state[4]; /* state */
65 uint32_t count[2]; /* number of bits, mod 2^64 */
66 uint8_t buffer[MD4_BLOCK_LENGTH]; /* input buffer */
69 /*#include <sys/cdefs.h>*/
72 void fr_MD4Init(FR_MD4_CTX *);
73 void fr_MD4Update(FR_MD4_CTX *, const uint8_t *, size_t)
74 /* __attribute__((__bounded__(__string__,2,3)))*/;
75 void fr_MD4Final(uint8_t [MD4_DIGEST_LENGTH], FR_MD4_CTX *)
76 /* __attribute__((__bounded__(__minbytes__,1,MD4_DIGEST_LENGTH)))*/;
77 void fr_MD4Transform(uint32_t [4], const uint8_t [MD4_BLOCK_LENGTH])
78 /* __attribute__((__bounded__(__minbytes__,1,4)))
79 __attribute__((__bounded__(__minbytes__,2,MD4_BLOCK_LENGTH)))*/;
81 #else /* WITH_OPENSSL_MD4 */
83 #include <openssl/md4.h>
85 #define FR_MD4_CTX MD4_CTX
86 #define fr_MD4Init MD4_Init
87 #define fr_MD4Update MD4_Update
88 #define fr_MD4Final MD4_Final
89 #define fr_MD4Transform MD4_Transform
92 #endif /* _FR_MD4_H */