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 #ifdef WITH_OPENSSL_MD4
30 #include <openssl/md4.h>
37 void fr_md4_calc (unsigned char *, const unsigned char *, unsigned int);
39 #ifndef WITH_OPENSSL_MD4
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 FR_MD4Context {
72 uint32_t state[4]; /* state */
73 uint32_t count[2]; /* number of bits, mod 2^64 */
74 uint8_t buffer[MD4_BLOCK_LENGTH]; /* input buffer */
78 void fr_MD4Init(FR_MD4_CTX *);
79 void fr_MD4Update(FR_MD4_CTX *, const uint8_t *, size_t)
80 /* __attribute__((__bounded__(__string__,2,3)))*/;
81 void fr_MD4Final(uint8_t [MD4_DIGEST_LENGTH], FR_MD4_CTX *)
82 /* __attribute__((__bounded__(__minbytes__,1,MD4_DIGEST_LENGTH)))*/;
83 void fr_MD4Transform(uint32_t [4], const uint8_t [MD4_BLOCK_LENGTH])
84 /* __attribute__((__bounded__(__minbytes__,1,4)))
85 __attribute__((__bounded__(__minbytes__,2,MD4_BLOCK_LENGTH)))*/;
87 #else /* WITH_OPENSSL_MD4 */
89 #define FR_MD4_CTX MD4_CTX
90 #define fr_MD4Init MD4_Init
91 #define fr_MD4Update MD4_Update
92 #define fr_MD4Final MD4_Final
93 #define fr_MD4Transform MD4_Transform
100 #endif /* _FR_MD4_H */