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