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