2 * md5.h Structures and prototypes for md5.
5 * License: LGPL, but largely derived from a public domain source.
14 #ifdef HAVE_INTTYPES_H
18 #ifdef HAVE_SYS_TYPES_H
19 #include <sys/types.h>
28 * FreeRADIUS defines to ensure globally unique MD5 function names,
29 * so that we don't pick up vendor-specific broken MD5 libraries.
31 #define MD5_CTX librad_MD5_CTX
32 #define MD5Init librad_MD5Init
33 #define MD5Update librad_MD5Update
34 #define MD5Final librad_MD5Final
35 #define MD5Transform librad_MD5Transform
37 /* The below was retrieved from
38 * http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/crypto/md5.h?rev=1.1
39 * With the following changes: uint64_t => uint32_t[2]
40 * Commented out #include <sys/cdefs.h>
41 * Commented out the __BEGIN and __END _DECLS, and the __attributes.
45 * This code implements the MD5 message-digest algorithm.
46 * The algorithm is due to Ron Rivest. This code was
47 * written by Colin Plumb in 1993, no copyright is claimed.
48 * This code is in the public domain; do with it what you wish.
50 * Equivalent code is available from RSA Data Security, Inc.
51 * This code has been tested against that, and is equivalent,
52 * except that you don't need to include two pages of legalese
56 #define MD5_BLOCK_LENGTH 64
57 #define MD5_DIGEST_LENGTH 16
59 typedef struct MD5Context {
60 uint32_t state[4]; /* state */
61 uint32_t count[2]; /* number of bits, mod 2^64 */
62 uint8_t buffer[MD5_BLOCK_LENGTH]; /* input buffer */
65 /* include <sys/cdefs.h> */
68 void MD5Init(MD5_CTX *);
69 void MD5Update(MD5_CTX *, const uint8_t *, size_t)
70 /* __attribute__((__bounded__(__string__,2,3)))*/;
71 void MD5Final(uint8_t [MD5_DIGEST_LENGTH], MD5_CTX *)
72 /* __attribute__((__bounded__(__minbytes__,1,MD5_DIGEST_LENGTH)))*/;
73 void MD5Transform(uint32_t [4], const uint8_t [MD5_BLOCK_LENGTH])
74 /* __attribute__((__bounded__(__minbytes__,1,4)))*/
75 /* __attribute__((__bounded__(__minbytes__,2,MD5_BLOCK_LENGTH)))*/;
78 #endif /* _LRAD_MD5_H */