2 * md5.h Structures and prototypes for md5.
5 * License: LGPL, but largely derived from a public domain source.
12 #include <freeradius-devel/ident.h>
15 #ifdef HAVE_INTTYPES_H
19 #ifdef HAVE_SYS_TYPES_H
20 #include <sys/types.h>
29 #ifndef WITH_OPENSSL_MD5
30 /* The below was retrieved from
31 * http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/crypto/md5.h?rev=1.1
32 * With the following changes: uint64_t => uint32_t[2]
33 * Commented out #include <sys/cdefs.h>
34 * Commented out the __BEGIN and __END _DECLS, and the __attributes.
38 * This code implements the MD5 message-digest algorithm.
39 * The algorithm is due to Ron Rivest. This code was
40 * written by Colin Plumb in 1993, no copyright is claimed.
41 * This code is in the public domain; do with it what you wish.
43 * Equivalent code is available from RSA Data Security, Inc.
44 * This code has been tested against that, and is equivalent,
45 * except that you don't need to include two pages of legalese
49 #define MD5_BLOCK_LENGTH 64
50 #define MD5_DIGEST_LENGTH 16
52 typedef struct FR_MD5Context {
53 uint32_t state[4]; /* state */
54 uint32_t count[2]; /* number of bits, mod 2^64 */
55 uint8_t buffer[MD5_BLOCK_LENGTH]; /* input buffer */
58 /* include <sys/cdefs.h> */
61 void fr_MD5Init(FR_MD5_CTX *);
62 void fr_MD5Update(FR_MD5_CTX *, const uint8_t *, size_t)
63 /* __attribute__((__bounded__(__string__,2,3)))*/;
64 void fr_MD5Final(uint8_t [MD5_DIGEST_LENGTH], FR_MD5_CTX *)
65 /* __attribute__((__bounded__(__minbytes__,1,MD5_DIGEST_LENGTH)))*/;
66 void fr_MD5Transform(uint32_t [4], const uint8_t [MD5_BLOCK_LENGTH])
67 /* __attribute__((__bounded__(__minbytes__,1,4)))*/
68 /* __attribute__((__bounded__(__minbytes__,2,MD5_BLOCK_LENGTH)))*/;
71 #else /* WITH_OPENSSL_HASH */
73 #include <openssl/md5.h>
75 #define FR_MD5_CTX MD5_CTX
76 #define fr_MD5Init MD5_Init
77 #define fr_MD5Update MD5_Update
78 #define fr_MD5Final MD5_Final
79 #define fr_MD5Transform MD5_Transform
82 #endif /* _FR_MD5_H */