Add proper pre-processor magic to get them to play nicely.
[freeradius.git] / src / include / md5.h
1 #ifndef _LRAD_MD5_H
2 #define _LRAD_MD5_H
3
4 #ifndef _LRAD_PROTO_H
5 #define _LRAD_PROTO_H
6 /* GLOBAL.H - RSAREF types and constants
7  */
8
9 /*
10  *  FreeRADIUS defines to ensure globally unique MD5 function names,
11  *  so that we don't pick up vendor-specific broken MD5 libraries.
12  */
13 #define MD5_CTX         librad_MD5_CTX
14 #define MD5Init         librad_MD5Init
15 #define MD5Update       librad_MD5Update
16 #define MD5Final        librad_MD5Final
17
18 /* PROTOTYPES should be set to one if and only if the compiler supports
19   function argument prototyping.
20   The following makes PROTOTYPES default to 0 if it has not already
21   been defined with C compiler flags.
22  */
23 #ifndef PROTOTYPES
24 #  if __STDC__
25 #    define PROTOTYPES 1
26 #  else
27 #    define PROTOTYPES 0
28 #  endif
29 #endif
30
31 /* POINTER defines a generic pointer type */
32 #ifndef _POINTER_T
33 typedef unsigned char *POINTER;
34 #endif
35 typedef const unsigned char *CONSTPOINTER;
36
37 /* UINT2 defines a two byte word */
38 #ifndef _UINT2_T
39 typedef unsigned short int UINT2;
40 #endif
41
42 /* UINT4 defines a four byte word */
43 #ifndef _UINT4_T
44 #if defined(__alpha) && (defined(__osf__) || defined(__linux__))
45 typedef unsigned int UINT4;
46 #else
47 typedef unsigned long int UINT4;
48 #endif
49 #endif
50
51 /* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
52    If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
53   returns an empty list.
54  */
55 #if PROTOTYPES
56 #define PROTO_LIST(list) list
57 #else
58 #define PROTO_LIST(list) ()
59 #endif
60 #endif /* _LRAD_PROTO_H */
61
62 /* MD5.H - header file for MD5C.C
63  */
64
65 /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
66 rights reserved.
67
68 License to copy and use this software is granted provided that it
69 is identified as the "RSA Data Security, Inc. MD5 Message-Digest
70 Algorithm" in all material mentioning or referencing this software
71 or this function.
72
73 License is also granted to make and use derivative works provided
74 that such works are identified as "derived from the RSA Data
75 Security, Inc. MD5 Message-Digest Algorithm" in all material
76 mentioning or referencing the derived work.
77
78 RSA Data Security, Inc. makes no representations concerning either
79 the merchantability of this software or the suitability of this
80 software for any particular purpose. It is provided "as is"
81 without express or implied warranty of any kind.
82
83 These notices must be retained in any copies of any part of this
84 documentation and/or software.
85  */
86
87 /* MD5 context. */
88 typedef struct {
89   UINT4 state[4];                                   /* state (ABCD) */
90   UINT4 count[2];        /* number of bits, modulo 2^64 (lsb first) */
91   unsigned char buffer[64];                         /* input buffer */
92 } MD5_CTX;
93
94 void MD5Init PROTO_LIST ((MD5_CTX *));
95 void MD5Update PROTO_LIST
96   ((MD5_CTX *, const unsigned char *, unsigned int));
97 void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *));
98 #endif /* _LRAD_MD5_H */