mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
endian: Renamed functions for curl API naming convention
This commit is contained in:
parent
7873f9bdbd
commit
f4413ca65a
@ -654,7 +654,7 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash,
|
|||||||
"%c%c%c%c", /* Reserved = 0 */
|
"%c%c%c%c", /* Reserved = 0 */
|
||||||
0, 0, 0, 0);
|
0, 0, 0, 0);
|
||||||
|
|
||||||
write64_le(tw, ptr + 24);
|
Curl_write64_le(tw, ptr + 24);
|
||||||
memcpy(ptr + 32, challenge_client, 8);
|
memcpy(ptr + 32, challenge_client, 8);
|
||||||
memcpy(ptr + 44, ntlm->target_info, ntlm->target_info_len);
|
memcpy(ptr + 44, ntlm->target_info, ntlm->target_info_len);
|
||||||
|
|
||||||
|
@ -173,8 +173,8 @@ static CURLcode ntlm_decode_type2_target(struct SessionHandle *data,
|
|||||||
unsigned int target_info_offset = 0;
|
unsigned int target_info_offset = 0;
|
||||||
|
|
||||||
if(size >= 48) {
|
if(size >= 48) {
|
||||||
target_info_len = readshort_le(&buffer[40]);
|
target_info_len = Curl_read16_le(&buffer[40]);
|
||||||
target_info_offset = readint_le(&buffer[44]);
|
target_info_offset = Curl_read32_le(&buffer[44]);
|
||||||
if(target_info_len > 0) {
|
if(target_info_len > 0) {
|
||||||
if(((target_info_offset + target_info_len) > size) ||
|
if(((target_info_offset + target_info_len) > size) ||
|
||||||
(target_info_offset < 48)) {
|
(target_info_offset < 48)) {
|
||||||
@ -287,7 +287,7 @@ CURLcode Curl_sasl_decode_ntlm_type2_message(struct SessionHandle *data,
|
|||||||
return CURLE_BAD_CONTENT_ENCODING;
|
return CURLE_BAD_CONTENT_ENCODING;
|
||||||
}
|
}
|
||||||
|
|
||||||
ntlm->flags = readint_le(&type2[20]);
|
ntlm->flags = Curl_read32_le(&type2[20]);
|
||||||
memcpy(ntlm->nonce, &type2[24], 8);
|
memcpy(ntlm->nonce, &type2[24], 8);
|
||||||
|
|
||||||
if(ntlm->flags & NTLMFLAG_NEGOTIATE_TARGET_INFO) {
|
if(ntlm->flags & NTLMFLAG_NEGOTIATE_TARGET_INFO) {
|
||||||
|
14
lib/endian.c
14
lib/endian.c
@ -29,7 +29,7 @@
|
|||||||
* package to whatever endian format we're using natively. Argument is a
|
* package to whatever endian format we're using natively. Argument is a
|
||||||
* pointer to a 2 byte buffer.
|
* pointer to a 2 byte buffer.
|
||||||
*/
|
*/
|
||||||
unsigned short readshort_le(unsigned char *buf)
|
unsigned short Curl_read16_le(unsigned char *buf)
|
||||||
{
|
{
|
||||||
return (unsigned short)(((unsigned short)buf[0]) |
|
return (unsigned short)(((unsigned short)buf[0]) |
|
||||||
((unsigned short)buf[1] << 8));
|
((unsigned short)buf[1] << 8));
|
||||||
@ -40,13 +40,13 @@ unsigned short readshort_le(unsigned char *buf)
|
|||||||
* incoming package to whatever endian format we're using natively.
|
* incoming package to whatever endian format we're using natively.
|
||||||
* Argument is a pointer to a 4 byte buffer.
|
* Argument is a pointer to a 4 byte buffer.
|
||||||
*/
|
*/
|
||||||
unsigned int readint_le(unsigned char *buf)
|
unsigned int Curl_read32_le(unsigned char *buf)
|
||||||
{
|
{
|
||||||
return ((unsigned int)buf[0]) | ((unsigned int)buf[1] << 8) |
|
return ((unsigned int)buf[0]) | ((unsigned int)buf[1] << 8) |
|
||||||
((unsigned int)buf[2] << 16) | ((unsigned int)buf[3] << 24);
|
((unsigned int)buf[2] << 16) | ((unsigned int)buf[3] << 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
void write32_le(const int value, unsigned char *buffer)
|
void Curl_write32_le(const int value, unsigned char *buffer)
|
||||||
{
|
{
|
||||||
buffer[0] = (char)(value & 0x000000FF);
|
buffer[0] = (char)(value & 0x000000FF);
|
||||||
buffer[1] = (char)((value & 0x0000FF00) >> 8);
|
buffer[1] = (char)((value & 0x0000FF00) >> 8);
|
||||||
@ -56,12 +56,12 @@ void write32_le(const int value, unsigned char *buffer)
|
|||||||
|
|
||||||
#if (CURL_SIZEOF_CURL_OFF_T > 4)
|
#if (CURL_SIZEOF_CURL_OFF_T > 4)
|
||||||
#if defined(HAVE_LONGLONG)
|
#if defined(HAVE_LONGLONG)
|
||||||
void write64_le(const long long value, unsigned char *buffer)
|
void Curl_write64_le(const long long value, unsigned char *buffer)
|
||||||
#else
|
#else
|
||||||
void write64_le(const __int64 value, unsigned char *buffer)
|
void Curl_write64_le(const __int64 value, unsigned char *buffer)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
write32_le((int)value, buffer);
|
Curl_write32_le((int)value, buffer);
|
||||||
write32_le((int)(value >> 32), buffer + 4);
|
Curl_write32_le((int)(value >> 32), buffer + 4);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
10
lib/endian.h
10
lib/endian.h
@ -22,16 +22,16 @@
|
|||||||
*
|
*
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
unsigned short readshort_le(unsigned char *buf);
|
unsigned short Curl_read16_le(unsigned char *buf);
|
||||||
unsigned int readint_le(unsigned char *buf);
|
unsigned int Curl_read32_le(unsigned char *buf);
|
||||||
|
|
||||||
void write32_le(const int value, unsigned char *buffer);
|
void Curl_write32_le(const int value, unsigned char *buffer);
|
||||||
|
|
||||||
#if (CURL_SIZEOF_CURL_OFF_T > 4)
|
#if (CURL_SIZEOF_CURL_OFF_T > 4)
|
||||||
#if defined(HAVE_LONGLONG)
|
#if defined(HAVE_LONGLONG)
|
||||||
void write64_le(const long long value, unsigned char *buffer);
|
void Curl_write64_le(const long long value, unsigned char *buffer);
|
||||||
#else
|
#else
|
||||||
void write64_le(const __int64 value, unsigned char *buffer);
|
void Curl_write64_le(const __int64 value, unsigned char *buffer);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user