Moved UINT4 stuff in md4 & md5 to uint32_t, which is more portable.
[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 #include "autoconf.h"
7
8 #if HAVE_INTTYPES_H
9 #include <inttypes.h>
10 #endif
11
12 #if HAVE_SYS_TYPES_H
13 #include <sys/types.h>
14 #endif
15
16 #if HAVE_STDINT_H
17 #include <stdint.h>
18 #endif
19
20 /* GLOBAL.H - RSAREF types and constants
21  */
22
23 /* PROTOTYPES should be set to one if and only if the compiler supports
24   function argument prototyping.
25   The following makes PROTOTYPES default to 0 if it has not already
26   been defined with C compiler flags.
27  */
28 #ifndef PROTOTYPES
29 #  if __STDC__
30 #    define PROTOTYPES 1
31 #  else
32 #    define PROTOTYPES 0
33 #  endif
34 #endif
35
36 /* POINTER defines a generic pointer type */
37 #ifndef _POINTER_T
38 typedef unsigned char *POINTER;
39 #endif
40 typedef const unsigned char *CONSTPOINTER;
41
42 /* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
43    If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
44   returns an empty list.
45  */
46 #if PROTOTYPES
47 #define PROTO_LIST(list) list
48 #else
49 #define PROTO_LIST(list) ()
50 #endif
51 #endif /* _LRAD_PROTO_H */
52
53 /*
54  *  FreeRADIUS defines to ensure globally unique MD5 function names,
55  *  so that we don't pick up vendor-specific broken MD5 libraries.
56  */
57 #define MD5_CTX         librad_MD5_CTX
58 #define MD5Init         librad_MD5Init
59 #define MD5Update       librad_MD5Update
60 #define MD5Final        librad_MD5Final
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   uint32_t state[4];                                   /* state (ABCD) */
90   uint32_t 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 */