1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-11 12:05:06 -05:00

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.
This commit is contained in:
Tatsuhiro Tsujikawa 2012-05-22 22:49:40 +09:00 committed by Daniel Stenberg
parent 0fd7fa7daf
commit 6cc066a2c5
3 changed files with 8 additions and 8 deletions

View File

@ -34,9 +34,9 @@ typedef void (* Curl_MD5_update_func)(void *context,
typedef void (* Curl_MD5_final_func)(unsigned char *result, void *context); typedef void (* Curl_MD5_final_func)(unsigned char *result, void *context);
typedef struct { typedef struct {
Curl_MD5_init_func md5_init; /* Initialize context procedure */ Curl_MD5_init_func md5_init_func; /* Initialize context procedure */
Curl_MD5_update_func md5_update; /* Update context with data */ Curl_MD5_update_func md5_update_func; /* Update context with data */
Curl_MD5_final_func md5_final; /* Get final result procedure */ Curl_MD5_final_func md5_final_func; /* Get final result procedure */
unsigned int md5_ctxtsize; /* Context structure size */ unsigned int md5_ctxtsize; /* Context structure size */
unsigned int md5_resultlen; /* Result length (bytes) */ unsigned int md5_resultlen; /* Result length (bytes) */
} MD5_params; } MD5_params;

View File

@ -145,7 +145,7 @@ static void setup_des_key(const unsigned char *key_56,
{ {
char key[8]; char key[8];
extend_key_56_to_64(key_56, key); 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) #elif defined(USE_GNUTLS)
@ -389,7 +389,7 @@ CURLcode Curl_ntlm_core_mk_nt_hash(struct SessionHandle *data,
#elif defined(USE_GNUTLS_NETTLE) #elif defined(USE_GNUTLS_NETTLE)
struct md4_ctx MD4pw; struct md4_ctx MD4pw;
md4_init(&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); md4_digest(&MD4pw, MD4_DIGEST_SIZE, ntbuffer);
#elif defined(USE_GNUTLS) #elif defined(USE_GNUTLS)
gcry_md_hd_t MD4pw; gcry_md_hd_t MD4pw;

View File

@ -445,7 +445,7 @@ MD5_context *Curl_MD5_init(const MD5_params *md5params)
ctxt->md5_hash = md5params; ctxt->md5_hash = md5params;
md5params->md5_init(ctxt->md5_hashctx); (*md5params->md5_init_func)(ctxt->md5_hashctx);
return ctxt; return ctxt;
} }
@ -454,14 +454,14 @@ int Curl_MD5_update(MD5_context *context,
const unsigned char *data, const unsigned char *data,
unsigned int len) 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; return 0;
} }
int Curl_MD5_final(MD5_context *context, unsigned char *result) 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->md5_hashctx);
free(context); free(context);