Renamed MD4* to fr_MD4*, in order to avoid issues with OpenSSL
[freeradius.git] / src / include / md4.h
1 /*
2  * md4.h        Structures and prototypes for md4.
3  *
4  * Version:     $Id$
5  * License:             LGPL, but largely derived from a public domain source.
6  *
7  */
8
9 #ifndef _LRAD_MD4_H
10 #define _LRAD_MD4_H
11
12 #include <freeradius-devel/ident.h>
13 RCSIDH(md4_h, "$Id$")
14
15 #ifdef HAVE_INTTYPES_H
16 #include <inttypes.h>
17 #endif
18
19 #ifdef HAVE_SYS_TYPES_H
20 #include <sys/types.h>
21 #endif
22
23 #ifdef HAVE_STDINT_H
24 #include <stdint.h>
25 #endif
26
27 #include <string.h>
28
29 void fr_md4_calc (unsigned char *, const unsigned char *, unsigned int);
30
31 /*  The below was retrieved from
32  *  http://www.openbsd.org/cgi-bin/cvsweb/src/include/md4.h?rev=1.12
33  *  With the following changes: uint64_t => uint32_t[2]
34  *  Commented out #include <sys/cdefs.h>
35  *  Commented out the __BEGIN and __END _DECLS, and the __attributes.
36  *  Commented out MD4End, MD4File, MD4Data
37  *  Commented out header file protection #ifndef,#define,#endif
38  */
39
40 /*      $OpenBSD: md4.h,v 1.12 2004/04/28 16:54:00 millert Exp $        */
41
42 /*
43  * This code implements the MD4 message-digest algorithm.
44  * The algorithm is due to Ron Rivest.  This code was
45  * written by Colin Plumb in 1993, no copyright is claimed.
46  * This code is in the public domain; do with it what you wish.
47  * Todd C. Miller modified the MD5 code to do MD4 based on RFC 1186.
48  *
49  * Equivalent code is available from RSA Data Security, Inc.
50  * This code has been tested against that, and is equivalent,
51  * except that you don't need to include two pages of legalese
52  * with every copy.
53  */
54
55 /*#ifndef _MD4_H_*/
56 /*#define _MD4_H_*/
57
58 #define MD4_BLOCK_LENGTH                64
59 #define MD4_DIGEST_LENGTH               16
60 #define MD4_DIGEST_STRING_LENGTH        (MD4_DIGEST_LENGTH * 2 + 1)
61
62 typedef struct FR_MD4Context {
63         uint32_t state[4];                      /* state */
64         uint32_t count[2];                      /* number of bits, mod 2^64 */
65         uint8_t buffer[MD4_BLOCK_LENGTH];       /* input buffer */
66 } FR_MD4_CTX;
67
68 /*#include <sys/cdefs.h>*/
69
70 /*__BEGIN_DECLS*/
71 void     fr_MD4Init(FR_MD4_CTX *);
72 void     fr_MD4Update(FR_MD4_CTX *, const uint8_t *, size_t)
73 /*              __attribute__((__bounded__(__string__,2,3)))*/;
74 void     fr_MD4Final(uint8_t [MD4_DIGEST_LENGTH], FR_MD4_CTX *)
75 /*              __attribute__((__bounded__(__minbytes__,1,MD4_DIGEST_LENGTH)))*/;
76 void     fr_MD4Transform(uint32_t [4], const uint8_t [MD4_BLOCK_LENGTH])
77 /*              __attribute__((__bounded__(__minbytes__,1,4)))
78                 __attribute__((__bounded__(__minbytes__,2,MD4_BLOCK_LENGTH)))*/;
79 /*__END_DECLS*/
80
81 #endif /* _LRAD_MD4_H */