Python: Give goto_url_hook only one argument, like follow_url_hook.
[elinks.git] / src / util / md5.h
blobf4f7f4c49c64f903ff10d6f45c85a8b3935297fd
1 #ifndef EL__UTIL_MD5_H
2 #define EL__UTIL_MD5_H
4 /* Optionally MD5 support can depend on external implementation when linking
5 * against a SSL library that supports it. */
6 #if defined(CONFIG_OWN_LIBC)
7 #define CONFIG_MD5 1
8 #elif defined(CONFIG_OPENSSL)
9 #include <openssl/md5.h>
10 #elif defined(CONFIG_GNUTLS_OPENSSL_COMPAT)
11 #include <gnutls/openssl.h>
12 #else
13 #define CONFIG_MD5 1
14 #endif
16 /* GNU TLS doesn't define this */
17 #ifndef MD5_DIGEST_LENGTH
18 #define MD5_DIGEST_LENGTH 16
19 #endif
21 #define MD5_HEX_DIGEST_LENGTH (MD5_DIGEST_LENGTH * 2)
23 typedef unsigned char md5_digest_bin_T[MD5_DIGEST_LENGTH];
24 typedef unsigned char md5_digest_hex_T[MD5_HEX_DIGEST_LENGTH];
26 struct md5_context {
27 uint32_t buf[4];
28 uint32_t bits[2];
29 unsigned char in[64];
32 /* The interface for digesting several chunks of data. To compute the message
33 * digest of a chunk of bytes, declare an md5_context structure, pass it to
34 * init_md5(), call update_md5() as needed on buffers full of bytes, and then
35 * call done_md5(), which will fill a supplied 16-byte array with the digest. */
36 void init_md5(struct md5_context *context);
37 void update_md5(struct md5_context *context, const unsigned char *data, unsigned long length);
38 void done_md5(struct md5_context *context, md5_digest_bin_T digest);
40 /* Digest the passed @data with the given length and stores the MD5 digest in
41 * the @digest parameter. */
42 unsigned char *
43 digest_md5(const unsigned char *data, unsigned long length, md5_digest_bin_T digest);
45 #ifdef CONFIG_MD5
46 /* Provide compatibility with the OpenSSL interface: */
48 typedef struct md5_context MD5_CTX;
49 #define MD5_Init(context) init_md5(context)
50 #define MD5_Update(context, data, len) update_md5(context, data, len)
51 #define MD5_Final(md5, context) done_md5(context, md5)
52 #define MD5(data, len, md5) digest_md5(data, len, md5)
54 #endif /* CONFIG_MD5 */
56 #endif