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