curl_ntlm_core: Fixed use of long long for VC6 and VC7

Commit 07b66cbfa4 unfortunately broke native NTLM message support in
compilers, such as VC6, VC7 and others, that don't support long long
type declarations. This commit fixes VC6 and VC7 as they support the
__int64 extension, however, we should consider an additional fix for
other compilers that don't support this.
This commit is contained in:
Steve Holme 2014-05-04 18:59:55 +01:00
parent 6ebc0d3bd8
commit 4febbedc5a

View File

@ -402,7 +402,11 @@ static void write32_le(const int value, unsigned char *buffer)
buffer[3] = (char)((value & 0xFF000000) >> 24);
}
#if defined(HAVE_LONGLONG)
static void write64_le(const long long value, unsigned char *buffer)
#else
static void write64_le(const __int64 value, unsigned char *buffer)
#endif
{
write32_le((int)value, buffer);
write32_le((int)(value >> 32), buffer + 4);
@ -550,16 +554,27 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash,
unsigned int len = 0;
unsigned char *ptr = NULL;
unsigned char hmac_output[NTLM_HMAC_MD5_LEN];
#if defined(HAVE_LONGLONG)
long long tw;
#else
__int64 tw;
#endif
CURLcode res = CURLE_OK;
/* Calculate the timestamp */
#if defined(HAVE_LONGLONG)
#if defined(DEBUGBUILD)
tw = 11644473600ULL * 10000000ULL;
#else
tw = ((long long)time(NULL) + 11644473600ULL) * 10000000ULL;
#endif
#else
#if defined(DEBUGBUILD)
tw = 11644473600ui64 * 10000000ui64;
#else
tw = ((__int64)time(NULL) + 11644473600ui64) * 10000000ui64;
#endif
#endif
/* Calculate the response len */
len = NTLM_HMAC_MD5_LEN + NTLMv2_BLOB_LEN;