Add "extern C {...} to header files for C++ builds.
[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 _FR_MD4_H
10 #define _FR_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 #ifdef WITH_OPENSSL_MD4
30 #include <openssl/md4.h>
31 #endif
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 void fr_md4_calc (unsigned char *, const unsigned char *, unsigned int);
38
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
47  */
48
49 /*      $OpenBSD: md4.h,v 1.12 2004/04/28 16:54:00 millert Exp $        */
50
51 /*
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.
57  *
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
61  * with every copy.
62  */
63
64 /*#ifndef _MD4_H_*/
65 /*#define _MD4_H_*/
66
67 #define MD4_BLOCK_LENGTH                64
68 #define MD4_DIGEST_LENGTH               16
69 #define MD4_DIGEST_STRING_LENGTH        (MD4_DIGEST_LENGTH * 2 + 1)
70
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 */
75 } FR_MD4_CTX;
76
77 /*__BEGIN_DECLS*/
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)))*/;
86 /*__END_DECLS*/
87 #else  /* WITH_OPENSSL_MD4 */
88
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
94 #endif
95
96 #ifdef __cplusplus
97 }
98 #endif
99
100 #endif /* _FR_MD4_H */