Permalink
Browse files

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.
  • Loading branch information...
1 parent 0fd7fa7 commit 6cc066a2c57e39306e7be538826fd4e17a8fa102 @tatsuhiro-t tatsuhiro-t committed with bagder May 22, 2012
Showing with 8 additions and 8 deletions.
  1. +3 −3 lib/curl_md5.h
  2. +2 −2 lib/curl_ntlm_core.c
  3. +3 −3 lib/md5.c
View
6 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;
View
4 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;
View
6 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);

0 comments on commit 6cc066a

Please sign in to comment.