1 /*@ S-nail - a mail user agent derived from Berkeley Mail.
2 *@ MD5 algorithm implementation.
4 * Copyright (c) 2000-2004 Gunnar Ritter, Freiburg i. Br., Germany.
5 * Copyright (c) 2012 - 2013 Steffen "Daode" Nurpmeso <sdaoden@users.sf.net>.
8 * Derived from RFC 1321:
10 /* MD5.H - header file for MD5C.C
13 /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
16 License to copy and use this software is granted provided that it
17 is identified as the "RSA Data Security, Inc. MD5 Message-Digest
18 Algorithm" in all material mentioning or referencing this software
21 License is also granted to make and use derivative works provided
22 that such works are identified as "derived from the RSA Data
23 Security, Inc. MD5 Message-Digest Algorithm" in all material
24 mentioning or referencing the derived work.
26 RSA Data Security, Inc. makes no representations concerning either
27 the merchantability of this software or the suitability of this
28 software for any particular purpose. It is provided "as is"
29 without express or implied warranty of any kind.
31 These notices must be retained in any copies of any part of this
32 documentation and/or software.
35 #if defined HAVE_MD5 && !defined _NAIL_MD5_H
37 # ifdef HAVE_OPENSSL_MD5
38 # include <openssl/md5.h>
40 # define md5_ctx MD5_CTX
41 # define md5_init MD5_Init
42 # define md5_update MD5_Update
43 # define md5_final MD5_Final
46 * This version of MD5 has been changed such that any unsigned type with
47 * at least 32 bits is acceptable. This is important e.g. for Cray vector
48 * machines which provide only 64-bit integers.
50 typedef unsigned long md5_type
;
53 md5_type state
[4]; /* state (ABCD) */
54 md5_type count
[2]; /* number of bits, modulo 2^64 (lsb first) */
55 unsigned char buffer
[64]; /* input buffer */
58 FL
void md5_init(md5_ctx
*);
59 FL
void md5_update(md5_ctx
*, unsigned char *, unsigned int);
60 FL
void md5_final(unsigned char[16], md5_ctx
*);
61 # endif /* !HAVE_OPENSSL_MD5 */
63 FL
void hmac_md5(unsigned char *, int, unsigned char *, int, void *);