From 6cc066a2c57e39306e7be538826fd4e17a8fa102 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Tue, 22 May 2012 22:49:40 +0900 Subject: Fixed compile error with GNUTLS+NETTLE In nettle/md5.h, md5_init and md5_update are defined as macros to nettle_md5_init and nettle_md5_update respectively. This causes error when using MD5_params.md5_init and md5_update. This patch renames these members as md5_init_func and md5_update_func to avoid name conflict. For completeness, MD5_params.md5_final was also renamed as md5_final_func. The changes in curl_ntlm_core.c is conversion error and fixed by casting to proper type. --- lib/curl_md5.h | 6 +++--- lib/curl_ntlm_core.c | 4 ++-- lib/md5.c | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/curl_md5.h b/lib/curl_md5.h index b445500fc..9c0e0b5ee 100644 --- a/lib/curl_md5.h +++ b/lib/curl_md5.h @@ -34,9 +34,9 @@ typedef void (* Curl_MD5_update_func)(void *context, typedef void (* Curl_MD5_final_func)(unsigned char *result, void *context); typedef struct { - Curl_MD5_init_func md5_init; /* Initialize context procedure */ - Curl_MD5_update_func md5_update; /* Update context with data */ - Curl_MD5_final_func md5_final; /* Get final result procedure */ + Curl_MD5_init_func md5_init_func; /* Initialize context procedure */ + Curl_MD5_update_func md5_update_func; /* Update context with data */ + Curl_MD5_final_func md5_final_func; /* Get final result procedure */ unsigned int md5_ctxtsize; /* Context structure size */ unsigned int md5_resultlen; /* Result length (bytes) */ } MD5_params; diff --git a/lib/curl_ntlm_core.c b/lib/curl_ntlm_core.c index 39952d2f1..6d1fb8091 100644 --- a/lib/curl_ntlm_core.c +++ b/lib/curl_ntlm_core.c @@ -145,7 +145,7 @@ static void setup_des_key(const unsigned char *key_56, { char key[8]; extend_key_56_to_64(key_56, key); - des_set_key(des, key); + des_set_key(des, (const uint8_t*)key); } #elif defined(USE_GNUTLS) @@ -389,7 +389,7 @@ CURLcode Curl_ntlm_core_mk_nt_hash(struct SessionHandle *data, #elif defined(USE_GNUTLS_NETTLE) struct md4_ctx MD4pw; md4_init(&MD4pw); - md4_update(&MD4pw, 2 * len, pw); + md4_update(&MD4pw, (unsigned int)(2 * len), pw); md4_digest(&MD4pw, MD4_DIGEST_SIZE, ntbuffer); #elif defined(USE_GNUTLS) gcry_md_hd_t MD4pw; diff --git a/lib/md5.c b/lib/md5.c index 8d66d95ec..c32455e9e 100644 --- a/lib/md5.c +++ b/lib/md5.c @@ -445,7 +445,7 @@ MD5_context *Curl_MD5_init(const MD5_params *md5params) ctxt->md5_hash = md5params; - md5params->md5_init(ctxt->md5_hashctx); + (*md5params->md5_init_func)(ctxt->md5_hashctx); return ctxt; } @@ -454,14 +454,14 @@ int Curl_MD5_update(MD5_context *context, const unsigned char *data, unsigned int len) { - (*context->md5_hash->md5_update)(context->md5_hashctx, data, len); + (*context->md5_hash->md5_update_func)(context->md5_hashctx, data, len); return 0; } int Curl_MD5_final(MD5_context *context, unsigned char *result) { - (*context->md5_hash->md5_final)(result, context->md5_hashctx); + (*context->md5_hash->md5_final_func)(result, context->md5_hashctx); free(context->md5_hashctx); free(context); -- cgit v1.2.3