api type conversion errors, first half of tls* files

This commit is contained in:
Reda Chouk
2024-09-09 16:05:15 +02:00
parent 73786112ec
commit 65db4b15d6
4 changed files with 41 additions and 39 deletions

View File

@@ -999,12 +999,12 @@ static int Hmac_UpdateFinal_CT(Hmac* hmac, byte* digest, const byte* in,
/* Number of blocks to create for hash. */
lenBlock = (realLen + extraLen) >> blockBits;
/* Block containing EOC byte. */
eocBlock = realLen >> blockBits;
eocBlock = (int)(realLen >> (word32)blockBits);
/* Index of EOC byte in block. */
eocIndex = realLen & blockMask;
eocIndex = (int)(realLen & (word32)blockMask);
/* Add length of hmac's ipad to total length. */
realLen += blockSz;
realLen += (word32)blockSz;
/* Length as bits - 8 bytes bigendian. */
c32toa(realLen >> ((sizeof(word32) * 8) - 3), lenBytes);
c32toa(realLen << 3, lenBytes + sizeof(word32));
@@ -1019,8 +1019,8 @@ static int Hmac_UpdateFinal_CT(Hmac* hmac, byte* digest, const byte* in,
ret = Hmac_HashUpdate(hmac, header, WOLFSSL_TLS_HMAC_INNER_SZ);
if (ret != 0)
return ret;
ret = Hmac_HashUpdate(hmac, in, safeBlocks * blockSz -
WOLFSSL_TLS_HMAC_INNER_SZ);
ret = Hmac_HashUpdate(hmac, in, (word32)(safeBlocks * blockSz -
WOLFSSL_TLS_HMAC_INNER_SZ));
if (ret != 0)
return ret;
}
@@ -1278,7 +1278,7 @@ int TLS_hmac(WOLFSSL* ssl, byte* digest, const byte* in, word32 sz, int padSz,
#endif
{
ret = Hmac_UpdateFinal_CT(&hmac, digest, in,
sz + hashSz + padSz + 1, hashSz, myInner);
(sz + hashSz + (word32)padSz + 1), (int)hashSz, myInner);
}
#else
ret = Hmac_UpdateFinal(&hmac, digest, in, sz + hashSz + padSz + 1,
@@ -7663,7 +7663,7 @@ static int TLSX_KeyShare_GenEccKey(WOLFSSL *ssl, KeyShareEntry* kse)
#endif
{
/* set curve info for EccMakeKey "peer" info */
ret = wc_ecc_set_curve(eccKey, kse->keyLen, curveId);
ret = wc_ecc_set_curve(eccKey, (int)kse->keyLen, curveId);
if (ret == 0) {
#ifdef WOLFSSL_ASYNC_CRYPT
/* Detect when private key generation is done */

View File

@@ -7014,7 +7014,7 @@ int DoTls13ClientHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
if (ret != 0)
goto exit_dch;
#else
if ((ret = HashInput(ssl, input + args->begin, helloSz)) != 0)
if ((ret = HashInput(ssl, input + args->begin, (int)helloSz)) != 0)
goto exit_dch;
#endif
@@ -7458,7 +7458,7 @@ int SendTls13ServerHello(WOLFSSL* ssl, byte extMsgType)
}
#endif /* WOLFSSL_DTLS13 */
ssl->buffers.outputBuffer.length += sendSz;
ssl->buffers.outputBuffer.length += (word32)sendSz;
if (!ssl->options.groupMessages || extMsgType != server_hello)
ret = SendBuffered(ssl);
@@ -7606,11 +7606,11 @@ static int SendTls13EncryptedExtensions(WOLFSSL* ssl)
/* This handshake message is always encrypted. */
sendSz = BuildTls13Message(ssl, output, sendSz, output + RECORD_HEADER_SZ,
idx - RECORD_HEADER_SZ, handshake, 1, 0, 0);
(int)(idx - RECORD_HEADER_SZ), handshake, 1, 0, 0);
if (sendSz < 0)
return sendSz;
ssl->buffers.outputBuffer.length += sendSz;
ssl->buffers.outputBuffer.length += (word32)sendSz;
ssl->options.buildingMsg = 0;
ssl->options.serverState = SERVER_ENCRYPTED_EXTENSIONS_COMPLETE;
@@ -7636,7 +7636,7 @@ static int SendTls13EncryptedExtensions(WOLFSSL* ssl)
* returns 0 on success, otherwise failure.
*/
static int SendTls13CertificateRequest(WOLFSSL* ssl, byte* reqCtx,
int reqCtxLen)
word32 reqCtxLen)
{
byte* output;
int ret;
@@ -7724,7 +7724,7 @@ static int SendTls13CertificateRequest(WOLFSSL* ssl, byte* reqCtx,
/* Always encrypted. */
sendSz = BuildTls13Message(ssl, output, sendSz, output + RECORD_HEADER_SZ,
i - RECORD_HEADER_SZ, handshake, 1, 0, 0);
(int)(i - RECORD_HEADER_SZ), handshake, 1, 0, 0);
if (sendSz < 0)
return sendSz;
@@ -7739,7 +7739,7 @@ static int SendTls13CertificateRequest(WOLFSSL* ssl, byte* reqCtx,
}
#endif
ssl->buffers.outputBuffer.length += sendSz;
ssl->buffers.outputBuffer.length += (word32)sendSz;
ssl->options.buildingMsg = 0;
if (!ssl->options.groupMessages)
ret = SendBuffered(ssl);
@@ -8510,7 +8510,7 @@ static int SendTls13Certificate(WOLFSSL* ssl)
certSz = 0;
certChainSz = 0;
headerSz = OPAQUE8_LEN + certReqCtxLen + CERT_HEADER_SZ;
length = headerSz;
length = (sword32)headerSz;
listSz = 0;
}
else {
@@ -8542,7 +8542,7 @@ static int SendTls13Certificate(WOLFSSL* ssl)
}
/* Length of message data with one certificate and extensions. */
length = headerSz + certSz + extSz;
length = (sword32)(headerSz + certSz + extSz);
/* Length of list data with one certificate and extensions. */
listSz = CERT_HEADER_SZ + certSz + extSz;
@@ -8551,7 +8551,7 @@ static int SendTls13Certificate(WOLFSSL* ssl)
p = ssl->buffers.certChain->buffer;
/* Chain length including extensions. */
certChainSz = ssl->buffers.certChain->length +
OPAQUE16_LEN * ssl->buffers.certChainCnt;
OPAQUE16_LEN * (word32)ssl->buffers.certChainCnt;
length += certChainSz;
listSz += certChainSz;
}
@@ -8559,7 +8559,7 @@ static int SendTls13Certificate(WOLFSSL* ssl)
certChainSz = 0;
}
payloadSz = length;
payloadSz = (word32)length;
if (ssl->fragOffset != 0)
length -= (ssl->fragOffset + headerSz);
@@ -8703,7 +8703,7 @@ static int SendTls13Certificate(WOLFSSL* ssl)
{
/* This message is always encrypted. */
sendSz = BuildTls13Message(ssl, output, sendSz,
output + RECORD_HEADER_SZ, i - RECORD_HEADER_SZ, handshake, 1,
output + RECORD_HEADER_SZ, (int)(i - RECORD_HEADER_SZ), handshake, 1,
0, 0);
if (sendSz < 0)
return sendSz;
@@ -8719,7 +8719,7 @@ static int SendTls13Certificate(WOLFSSL* ssl)
}
#endif
ssl->buffers.outputBuffer.length += sendSz;
ssl->buffers.outputBuffer.length += (word32)sendSz;
ssl->options.buildingMsg = 0;
if (!ssl->options.groupMessages)
ret = SendBuffered(ssl);
@@ -9150,7 +9150,7 @@ static int SendTls13CertificateVerify(WOLFSSL* ssl)
#endif /* !NO_RSA */
#ifdef HAVE_ECC
if (ssl->hsType == DYNAMIC_TYPE_ECC) {
args->sigLen = args->sendSz - args->idx - HASH_SIG_SIZE -
args->sigLen = (word32)args->sendSz - args->idx - HASH_SIG_SIZE -
VERIFY_HEADER;
#if defined(WOLFSSL_SM2) && defined(WOLFSSL_SM3)
if (ssl->buffers.keyType != sm2_sa_algo)
@@ -9555,7 +9555,7 @@ static int SendTls13CertificateVerify(WOLFSSL* ssl)
}
#endif
ssl->buffers.outputBuffer.length += args->sendSz;
ssl->buffers.outputBuffer.length += (word32)args->sendSz;
ssl->options.buildingMsg = 0;
if (!ssl->options.groupMessages)
ret = SendBuffered(ssl);
@@ -10846,7 +10846,7 @@ static int SendTls13Finished(WOLFSSL* ssl)
input = output + Dtls13GetRlHeaderLength(ssl, 1);
#endif /* WOLFSSL_DTLS13 */
AddTls13HandShakeHeader(input, (word32)finishedSz, 0, finishedSz, finished, ssl);
AddTls13HandShakeHeader(input, (word32)finishedSz, 0, (word32)finishedSz, finished, ssl);
#if defined(WOLFSSL_RENESAS_TSIP_TLS)
if (ssl->options.side == WOLFSSL_CLIENT_END) {
@@ -10931,7 +10931,7 @@ static int SendTls13Finished(WOLFSSL* ssl)
}
#endif
ssl->buffers.outputBuffer.length += sendSz;
ssl->buffers.outputBuffer.length += (word32)sendSz;
ssl->options.buildingMsg = 0;
}
@@ -11140,7 +11140,7 @@ static int SendTls13KeyUpdate(WOLFSSL* ssl)
}
#endif
ssl->buffers.outputBuffer.length += sendSz;
ssl->buffers.outputBuffer.length += (word32)sendSz;
ret = SendBuffered(ssl);