diff options
author | Martin Storsjo <martin@martin.st> | 2011-11-15 11:52:32 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2011-11-19 22:23:14 +0100 |
commit | 64f328c787ab763cc994eadd6b82f32490d37ebb (patch) | |
tree | 415403f46b8610b7ae9ab8308abd6dd58e324d0a /lib/md5.c | |
parent | c0db5ff678ecca068ca85b454517fb4585da85f1 (diff) |
Add support for using nettle instead of gcrypt as gnutls backend
Diffstat (limited to 'lib/md5.c')
-rw-r--r-- | lib/md5.c | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -27,6 +27,30 @@ #include "curl_md5.h" #include "curl_hmac.h" +#ifdef USE_GNUTLS_NETTLE + +#include <nettle/md5.h> + +typedef struct md5_ctx MD5_CTX; + +static void MD5_Init(MD5_CTX * ctx) +{ + md5_init(ctx); +} + +static void MD5_Update(MD5_CTX * ctx, + const unsigned char * input, + unsigned int inputLen) +{ + md5_update(ctx, inputLen, input); +} + +static void MD5_Final(unsigned char digest[16], MD5_CTX * ctx) +{ + md5_digest(ctx, 16, digest); +} +#else + #ifdef USE_GNUTLS #include <gcrypt.h> @@ -369,6 +393,8 @@ static void Decode (UINT4 *output, #endif /* USE_GNUTLS */ +#endif /* USE_GNUTLS_NETTLE */ + const HMAC_params Curl_HMAC_MD5[] = { { (HMAC_hinit_func) MD5_Init, /* Hash initialization function. */ |