mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 18:57:27 +02:00
tls.c type conversion fixed.
This commit is contained in:
22
src/tls.c
22
src/tls.c
@ -929,7 +929,7 @@ static int Hmac_UpdateFinal_CT(Hmac* hmac, byte* digest, const byte* in,
|
|||||||
int blockBits, blockMask;
|
int blockBits, blockMask;
|
||||||
int lastBlockLen, extraLen, eocIndex;
|
int lastBlockLen, extraLen, eocIndex;
|
||||||
int blocks, safeBlocks, lenBlock, eocBlock;
|
int blocks, safeBlocks, lenBlock, eocBlock;
|
||||||
unsigned int maxLen;
|
word32 maxLen;
|
||||||
int blockSz, padSz;
|
int blockSz, padSz;
|
||||||
int ret;
|
int ret;
|
||||||
word32 realLen;
|
word32 realLen;
|
||||||
@ -982,22 +982,22 @@ static int Hmac_UpdateFinal_CT(Hmac* hmac, byte* digest, const byte* in,
|
|||||||
blockMask = blockSz - 1;
|
blockMask = blockSz - 1;
|
||||||
|
|
||||||
/* Size of data to HMAC if padding length byte is zero. */
|
/* Size of data to HMAC if padding length byte is zero. */
|
||||||
maxLen = WOLFSSL_TLS_HMAC_INNER_SZ + sz - 1 - macLen;
|
maxLen = WOLFSSL_TLS_HMAC_INNER_SZ + sz - 1 - (word32)macLen;
|
||||||
/* Complete data (including padding) has block for EOC and/or length. */
|
/* Complete data (including padding) has block for EOC and/or length. */
|
||||||
extraBlock = ctSetLTE((maxLen + padSz) & blockMask, padSz);
|
extraBlock = ctSetLTE(((int)maxLen + padSz) & blockMask, padSz);
|
||||||
/* Total number of blocks for data including padding. */
|
/* Total number of blocks for data including padding. */
|
||||||
blocks = ((maxLen + blockSz - 1) >> blockBits) + extraBlock;
|
blocks = ((int)(maxLen + (word32)blockSz - 1) >> blockBits) + extraBlock;
|
||||||
/* Up to last 6 blocks can be hashed safely. */
|
/* Up to last 6 blocks can be hashed safely. */
|
||||||
safeBlocks = blocks - 6;
|
safeBlocks = blocks - 6;
|
||||||
|
|
||||||
/* Length of message data. */
|
/* Length of message data. */
|
||||||
realLen = maxLen - in[sz - 1];
|
realLen = maxLen - in[sz - 1];
|
||||||
/* Number of message bytes in last block. */
|
/* Number of message bytes in last block. */
|
||||||
lastBlockLen = realLen & blockMask;
|
lastBlockLen = (int)realLen & blockMask;
|
||||||
/* Number of padding bytes in last block. */
|
/* Number of padding bytes in last block. */
|
||||||
extraLen = ((blockSz * 2 - padSz - lastBlockLen) & blockMask) + 1;
|
extraLen = ((blockSz * 2 - padSz - lastBlockLen) & blockMask) + 1;
|
||||||
/* Number of blocks to create for hash. */
|
/* Number of blocks to create for hash. */
|
||||||
lenBlock = (realLen + extraLen) >> blockBits;
|
lenBlock = ((int)realLen + extraLen) >> blockBits;
|
||||||
/* Block containing EOC byte. */
|
/* Block containing EOC byte. */
|
||||||
eocBlock = (int)(realLen >> (word32)blockBits);
|
eocBlock = (int)(realLen >> (word32)blockBits);
|
||||||
/* Index of EOC byte in block. */
|
/* Index of EOC byte in block. */
|
||||||
@ -12505,7 +12505,7 @@ static int TLSX_GetSize(TLSX* list, byte* semaphore, byte msgType,
|
|||||||
continue; /* skip! */
|
continue; /* skip! */
|
||||||
|
|
||||||
/* ssl level extensions are expected to override ctx level ones. */
|
/* ssl level extensions are expected to override ctx level ones. */
|
||||||
if (!IS_OFF(semaphore, TLSX_ToSemaphore(extension->type)))
|
if (!IS_OFF(semaphore, TLSX_ToSemaphore((word16)extension->type)))
|
||||||
continue; /* skip! */
|
continue; /* skip! */
|
||||||
|
|
||||||
/* extension type + extension data length. */
|
/* extension type + extension data length. */
|
||||||
@ -12670,7 +12670,7 @@ static int TLSX_GetSize(TLSX* list, byte* semaphore, byte msgType,
|
|||||||
|
|
||||||
/* marks the extension as processed so ctx level */
|
/* marks the extension as processed so ctx level */
|
||||||
/* extensions don't overlap with ssl level ones. */
|
/* extensions don't overlap with ssl level ones. */
|
||||||
TURN_ON(semaphore, TLSX_ToSemaphore(extension->type));
|
TURN_ON(semaphore, TLSX_ToSemaphore((word16)extension->type));
|
||||||
}
|
}
|
||||||
|
|
||||||
*pLength += length;
|
*pLength += length;
|
||||||
@ -12697,11 +12697,11 @@ static int TLSX_Write(TLSX* list, byte* output, byte* semaphore,
|
|||||||
continue; /* skip! */
|
continue; /* skip! */
|
||||||
|
|
||||||
/* ssl level extensions are expected to override ctx level ones. */
|
/* ssl level extensions are expected to override ctx level ones. */
|
||||||
if (!IS_OFF(semaphore, TLSX_ToSemaphore(extension->type)))
|
if (!IS_OFF(semaphore, TLSX_ToSemaphore((word16)extension->type)))
|
||||||
continue; /* skip! */
|
continue; /* skip! */
|
||||||
|
|
||||||
/* writes extension type. */
|
/* writes extension type. */
|
||||||
c16toa(extension->type, output + offset);
|
c16toa((word16)extension->type, output + offset);
|
||||||
offset += HELLO_EXT_TYPE_SZ + OPAQUE16_LEN;
|
offset += HELLO_EXT_TYPE_SZ + OPAQUE16_LEN;
|
||||||
length_offset = offset;
|
length_offset = offset;
|
||||||
|
|
||||||
@ -12919,7 +12919,7 @@ static int TLSX_Write(TLSX* list, byte* output, byte* semaphore,
|
|||||||
|
|
||||||
/* marks the extension as processed so ctx level */
|
/* marks the extension as processed so ctx level */
|
||||||
/* extensions don't overlap with ssl level ones. */
|
/* extensions don't overlap with ssl level ones. */
|
||||||
TURN_ON(semaphore, TLSX_ToSemaphore(extension->type));
|
TURN_ON(semaphore, TLSX_ToSemaphore((word16)extension->type));
|
||||||
|
|
||||||
/* if we encountered an error propagate it */
|
/* if we encountered an error propagate it */
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
|
Reference in New Issue
Block a user