forked from wolfSSL/wolfssl
fix clang -Wconversion except -Wsign-conversion
This commit is contained in:
@ -998,7 +998,7 @@ void bench_eccKeyAgree(void)
|
|||||||
|
|
||||||
/* make dummy digest */
|
/* make dummy digest */
|
||||||
for (i = 0; i < (int)sizeof(digest); i++)
|
for (i = 0; i < (int)sizeof(digest); i++)
|
||||||
digest[i] = i;
|
digest[i] = (byte)i;
|
||||||
|
|
||||||
|
|
||||||
start = current_time(1);
|
start = current_time(1);
|
||||||
|
@ -3210,11 +3210,11 @@ static void DecodeSubjKeyId(byte* input, int sz, DecodedCert* cert)
|
|||||||
length--;
|
length--;
|
||||||
|
|
||||||
if (length == 2) {
|
if (length == 2) {
|
||||||
cert->extKeyUsage = (input[idx] << 8) | input[idx+1];
|
cert->extKeyUsage = (word16)((input[idx] << 8) | input[idx+1]);
|
||||||
cert->extKeyUsage >>= unusedBits;
|
cert->extKeyUsage >>= unusedBits;
|
||||||
}
|
}
|
||||||
else if (length == 1)
|
else if (length == 1)
|
||||||
cert->extKeyUsage = (input[idx] << 1);
|
cert->extKeyUsage = (word16)(input[idx] << 1);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -95,9 +95,9 @@ int Base64_Decode(const byte* in, word32 inLen, byte* out, word32* outLen)
|
|||||||
e3 = (e3 == PAD) ? 0 : base64Decode[e3 - 0x2B];
|
e3 = (e3 == PAD) ? 0 : base64Decode[e3 - 0x2B];
|
||||||
e4 = (e4 == PAD) ? 0 : base64Decode[e4 - 0x2B];
|
e4 = (e4 == PAD) ? 0 : base64Decode[e4 - 0x2B];
|
||||||
|
|
||||||
b1 = (e1 << 2) | (e2 >> 4);
|
b1 = (byte)((e1 << 2) | (e2 >> 4));
|
||||||
b2 = ((e2 & 0xF) << 4) | (e3 >> 2);
|
b2 = (byte)(((e2 & 0xF) << 4) | (e3 >> 2));
|
||||||
b3 = ((e3 & 0x3) << 6) | e4;
|
b3 = (byte)(((e3 & 0x3) << 6) | e4);
|
||||||
|
|
||||||
out[i++] = b1;
|
out[i++] = b1;
|
||||||
if (!pad3)
|
if (!pad3)
|
||||||
@ -251,8 +251,8 @@ static int DoBase64_Encode(const byte* in, word32 inLen, byte* out,
|
|||||||
|
|
||||||
/* encoded idx */
|
/* encoded idx */
|
||||||
byte e1 = b1 >> 2;
|
byte e1 = b1 >> 2;
|
||||||
byte e2 = ((b1 & 0x3) << 4) | (b2 >> 4);
|
byte e2 = (byte)(((b1 & 0x3) << 4) | (b2 >> 4));
|
||||||
byte e3 = ((b2 & 0xF) << 2) | (b3 >> 6);
|
byte e3 = (byte)(((b2 & 0xF) << 2) | (b3 >> 6));
|
||||||
byte e4 = b3 & 0x3F;
|
byte e4 = b3 & 0x3F;
|
||||||
|
|
||||||
/* store */
|
/* store */
|
||||||
@ -281,8 +281,8 @@ static int DoBase64_Encode(const byte* in, word32 inLen, byte* out,
|
|||||||
byte b2 = (twoBytes) ? in[j++] : 0;
|
byte b2 = (twoBytes) ? in[j++] : 0;
|
||||||
|
|
||||||
byte e1 = b1 >> 2;
|
byte e1 = b1 >> 2;
|
||||||
byte e2 = ((b1 & 0x3) << 4) | (b2 >> 4);
|
byte e2 = (byte)(((b1 & 0x3) << 4) | (b2 >> 4));
|
||||||
byte e3 = (b2 & 0xF) << 2;
|
byte e3 = (byte)((b2 & 0xF) << 2);
|
||||||
|
|
||||||
ret = CEscape(escaped, e1, out, &i, *outLen, 0);
|
ret = CEscape(escaped, e1, out, &i, *outLen, 0);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
@ -375,7 +375,7 @@ int Base16_Decode(const byte* in, word32 inLen, byte* out, word32* outLen)
|
|||||||
if (b == BAD || b2 == BAD)
|
if (b == BAD || b2 == BAD)
|
||||||
return ASN_INPUT_E;
|
return ASN_INPUT_E;
|
||||||
|
|
||||||
out[outIdx++] = (b << 4) | b2;
|
out[outIdx++] = (byte)((b << 4) | b2);
|
||||||
inLen -= 2;
|
inLen -= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3784,7 +3784,7 @@ int ecc_test(void)
|
|||||||
|
|
||||||
/* test DSA sign hash */
|
/* test DSA sign hash */
|
||||||
for (i = 0; i < (int)sizeof(digest); i++)
|
for (i = 0; i < (int)sizeof(digest); i++)
|
||||||
digest[i] = i;
|
digest[i] = (byte)i;
|
||||||
|
|
||||||
x = sizeof(sig);
|
x = sizeof(sig);
|
||||||
ret = ecc_sign_hash(digest, sizeof(digest), sig, &x, &rng, &userA);
|
ret = ecc_sign_hash(digest, sizeof(digest), sig, &x, &rng, &userA);
|
||||||
|
@ -159,8 +159,8 @@
|
|||||||
#define crlPemDir "./certs/crl"
|
#define crlPemDir "./certs/crl"
|
||||||
|
|
||||||
typedef struct tcp_ready {
|
typedef struct tcp_ready {
|
||||||
int ready; /* predicate */
|
word16 ready; /* predicate */
|
||||||
int port;
|
word16 port;
|
||||||
#if defined(_POSIX_THREADS) && !defined(__MINGW32__)
|
#if defined(_POSIX_THREADS) && !defined(__MINGW32__)
|
||||||
pthread_mutex_t mutex;
|
pthread_mutex_t mutex;
|
||||||
pthread_cond_t cond;
|
pthread_cond_t cond;
|
||||||
@ -558,7 +558,7 @@ static INLINE int tcp_select(SOCKET_T socketfd, int to_sec)
|
|||||||
#endif /* !CYASSL_MDK_ARM */
|
#endif /* !CYASSL_MDK_ARM */
|
||||||
|
|
||||||
|
|
||||||
static INLINE void tcp_listen(SOCKET_T* sockfd, int* port, int useAnyAddr,
|
static INLINE void tcp_listen(SOCKET_T* sockfd, word16* port, int useAnyAddr,
|
||||||
int udp)
|
int udp)
|
||||||
{
|
{
|
||||||
SOCKADDR_IN_T addr;
|
SOCKADDR_IN_T addr;
|
||||||
@ -620,7 +620,7 @@ static INLINE int udp_read_connect(SOCKET_T sockfd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static INLINE void udp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd,
|
static INLINE void udp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd,
|
||||||
int useAnyAddr, int port, func_args* args)
|
int useAnyAddr, word16 port, func_args* args)
|
||||||
{
|
{
|
||||||
SOCKADDR_IN_T addr;
|
SOCKADDR_IN_T addr;
|
||||||
|
|
||||||
@ -671,7 +671,7 @@ static INLINE void udp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static INLINE void tcp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd,
|
static INLINE void tcp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd,
|
||||||
func_args* args, int port, int useAnyAddr,
|
func_args* args, word16 port, int useAnyAddr,
|
||||||
int udp)
|
int udp)
|
||||||
{
|
{
|
||||||
SOCKADDR_IN_T client;
|
SOCKADDR_IN_T client;
|
||||||
|
@ -175,7 +175,7 @@ THREAD_RETURN CYASSL_THREAD client_test(void* args)
|
|||||||
int input;
|
int input;
|
||||||
int msgSz = (int)strlen(msg);
|
int msgSz = (int)strlen(msg);
|
||||||
|
|
||||||
int port = yasslPort;
|
word16 port = yasslPort;
|
||||||
char* host = (char*)yasslIP;
|
char* host = (char*)yasslIP;
|
||||||
char* domain = (char*)"www.yassl.com";
|
char* domain = (char*)"www.yassl.com";
|
||||||
|
|
||||||
@ -293,7 +293,7 @@ THREAD_RETURN CYASSL_THREAD client_test(void* args)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'p' :
|
case 'p' :
|
||||||
port = atoi(myoptarg);
|
port = (word16)atoi(myoptarg);
|
||||||
#if !defined(NO_MAIN_DRIVER) || defined(USE_WINDOWS_API)
|
#if !defined(NO_MAIN_DRIVER) || defined(USE_WINDOWS_API)
|
||||||
if (port == 0)
|
if (port == 0)
|
||||||
err_sys("port number cannot be 0");
|
err_sys("port number cannot be 0");
|
||||||
|
@ -60,7 +60,7 @@ void echoclient_test(void* args)
|
|||||||
int sendSz;
|
int sendSz;
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
char** argv = 0;
|
char** argv = 0;
|
||||||
int port = yasslPort;
|
word16 port = yasslPort;
|
||||||
|
|
||||||
((func_args*)args)->return_code = -1; /* error state */
|
((func_args*)args)->return_code = -1; /* error state */
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
#define SVR_COMMAND_SIZE 256
|
#define SVR_COMMAND_SIZE 256
|
||||||
|
|
||||||
static void SignalReady(void* args, int port)
|
static void SignalReady(void* args, word16 port)
|
||||||
{
|
{
|
||||||
#if defined(_POSIX_THREADS) && defined(NO_MAIN_DRIVER) && !defined(__MINGW32__)
|
#if defined(_POSIX_THREADS) && defined(NO_MAIN_DRIVER) && !defined(__MINGW32__)
|
||||||
/* signal ready to tcp_accept */
|
/* signal ready to tcp_accept */
|
||||||
@ -76,7 +76,7 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
|
|||||||
int outCreated = 0;
|
int outCreated = 0;
|
||||||
int shutDown = 0;
|
int shutDown = 0;
|
||||||
int useAnyAddr = 0;
|
int useAnyAddr = 0;
|
||||||
int port = yasslPort;
|
word16 port = yasslPort;
|
||||||
int argc = ((func_args*)args)->argc;
|
int argc = ((func_args*)args)->argc;
|
||||||
char** argv = ((func_args*)args)->argv;
|
char** argv = ((func_args*)args)->argv;
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
|||||||
int version = SERVER_DEFAULT_VERSION;
|
int version = SERVER_DEFAULT_VERSION;
|
||||||
int doCliCertCheck = 1;
|
int doCliCertCheck = 1;
|
||||||
int useAnyAddr = 0;
|
int useAnyAddr = 0;
|
||||||
int port = yasslPort;
|
word16 port = yasslPort;
|
||||||
int usePsk = 0;
|
int usePsk = 0;
|
||||||
int doDTLS = 0;
|
int doDTLS = 0;
|
||||||
int useNtruKey = 0;
|
int useNtruKey = 0;
|
||||||
@ -230,7 +230,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'p' :
|
case 'p' :
|
||||||
port = atoi(myoptarg);
|
port = (word16)atoi(myoptarg);
|
||||||
#if !defined(NO_MAIN_DRIVER) || defined(USE_WINDOWS_API)
|
#if !defined(NO_MAIN_DRIVER) || defined(USE_WINDOWS_API)
|
||||||
if (port == 0)
|
if (port == 0)
|
||||||
err_sys("port number cannot be 0");
|
err_sys("port number cannot be 0");
|
||||||
|
@ -231,7 +231,7 @@ static INLINE void c24to32(const word24 u24, word32* u32)
|
|||||||
/* convert opaque to 16 bit integer */
|
/* convert opaque to 16 bit integer */
|
||||||
static INLINE void ato16(const byte* c, word16* u16)
|
static INLINE void ato16(const byte* c, word16* u16)
|
||||||
{
|
{
|
||||||
*u16 = (c[0] << 8) | (c[1]);
|
*u16 = (word16) ((c[0] << 8) | (c[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4703,7 +4703,7 @@ static int DoAlert(CYASSL* ssl, byte* input, word32* inOutIdx, int* type)
|
|||||||
RECORD_HEADER_SZ, 2 + RECORD_HEADER_SZ, ssl->heap);
|
RECORD_HEADER_SZ, 2 + RECORD_HEADER_SZ, ssl->heap);
|
||||||
#endif
|
#endif
|
||||||
level = input[(*inOutIdx)++];
|
level = input[(*inOutIdx)++];
|
||||||
code = (int)input[(*inOutIdx)++];
|
code = input[(*inOutIdx)++];
|
||||||
ssl->alert_history.last_rx.code = code;
|
ssl->alert_history.last_rx.code = code;
|
||||||
ssl->alert_history.last_rx.level = level;
|
ssl->alert_history.last_rx.level = level;
|
||||||
*type = code;
|
*type = code;
|
||||||
@ -4904,7 +4904,7 @@ int ProcessReply(CYASSL* ssl)
|
|||||||
ssl->buffers.inputBuffer.buffer[ssl->buffers.inputBuffer.idx++];
|
ssl->buffers.inputBuffer.buffer[ssl->buffers.inputBuffer.idx++];
|
||||||
b1 =
|
b1 =
|
||||||
ssl->buffers.inputBuffer.buffer[ssl->buffers.inputBuffer.idx++];
|
ssl->buffers.inputBuffer.buffer[ssl->buffers.inputBuffer.idx++];
|
||||||
ssl->curSize = ((b0 & 0x7f) << 8) | b1;
|
ssl->curSize = (word16)(((b0 & 0x7f) << 8) | b1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ssl->options.processReply = getRecordLayerHeader;
|
ssl->options.processReply = getRecordLayerHeader;
|
||||||
|
@ -1142,7 +1142,7 @@ static int ProcessSessionTicket(const byte* input, int* sslBytes,
|
|||||||
input += TICKET_HINT_LEN; /* skip over hint */
|
input += TICKET_HINT_LEN; /* skip over hint */
|
||||||
*sslBytes -= TICKET_HINT_LEN;
|
*sslBytes -= TICKET_HINT_LEN;
|
||||||
|
|
||||||
len = (input[0] << 8) | input[1];
|
len = (word16)((input[0] << 8) | input[1]);
|
||||||
input += LENGTH_SZ;
|
input += LENGTH_SZ;
|
||||||
*sslBytes -= LENGTH_SZ;
|
*sslBytes -= LENGTH_SZ;
|
||||||
|
|
||||||
@ -1349,7 +1349,7 @@ static int ProcessClientHello(const byte* input, int* sslBytes,
|
|||||||
SetError(CLIENT_HELLO_INPUT_STR, error, session, FATAL_ERROR_STATE);
|
SetError(CLIENT_HELLO_INPUT_STR, error, session, FATAL_ERROR_STATE);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
len = (input[0] << 8) | input[1];
|
len = (word16)((input[0] << 8) | input[1]);
|
||||||
input += SUITE_LEN;
|
input += SUITE_LEN;
|
||||||
*sslBytes -= SUITE_LEN;
|
*sslBytes -= SUITE_LEN;
|
||||||
/* make sure can read suites + comp len */
|
/* make sure can read suites + comp len */
|
||||||
@ -1382,7 +1382,7 @@ static int ProcessClientHello(const byte* input, int* sslBytes,
|
|||||||
SetError(CLIENT_HELLO_INPUT_STR, error, session, FATAL_ERROR_STATE);
|
SetError(CLIENT_HELLO_INPUT_STR, error, session, FATAL_ERROR_STATE);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
len = (input[0] << 8) | input[1];
|
len = (word16)((input[0] << 8) | input[1]);
|
||||||
input += SUITE_LEN;
|
input += SUITE_LEN;
|
||||||
*sslBytes -= SUITE_LEN;
|
*sslBytes -= SUITE_LEN;
|
||||||
/* make sure can read through all extensions */
|
/* make sure can read through all extensions */
|
||||||
@ -1400,7 +1400,7 @@ static int ProcessClientHello(const byte* input, int* sslBytes,
|
|||||||
input += EXT_TYPE_SZ;
|
input += EXT_TYPE_SZ;
|
||||||
*sslBytes -= EXT_TYPE_SZ;
|
*sslBytes -= EXT_TYPE_SZ;
|
||||||
|
|
||||||
extLen = (input[0] << 8) | input[1];
|
extLen = (word16)((input[0] << 8) | input[1]);
|
||||||
input += LENGTH_SZ;
|
input += LENGTH_SZ;
|
||||||
*sslBytes -= LENGTH_SZ;
|
*sslBytes -= LENGTH_SZ;
|
||||||
|
|
||||||
@ -1700,8 +1700,8 @@ static SnifferSession* CreateSession(IpInfo* ipInfo, TcpInfo* tcpInfo,
|
|||||||
InitSession(session);
|
InitSession(session);
|
||||||
session->server = ipInfo->dst;
|
session->server = ipInfo->dst;
|
||||||
session->client = ipInfo->src;
|
session->client = ipInfo->src;
|
||||||
session->srvPort = tcpInfo->dstPort;
|
session->srvPort = (word16)tcpInfo->dstPort;
|
||||||
session->cliPort = tcpInfo->srcPort;
|
session->cliPort = (word16)tcpInfo->srcPort;
|
||||||
session->cliSeqStart = tcpInfo->sequence;
|
session->cliSeqStart = tcpInfo->sequence;
|
||||||
session->cliExpected = 1; /* relative */
|
session->cliExpected = 1; /* relative */
|
||||||
session->lastUsed= time(NULL);
|
session->lastUsed= time(NULL);
|
||||||
@ -1781,7 +1781,7 @@ static int DoOldHello(SnifferSession* session, const byte* sslFrame,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = ProcessOldClientHello(session->sslServer, input, &idx, *sslBytes,
|
ret = ProcessOldClientHello(session->sslServer, input, &idx, *sslBytes,
|
||||||
*rhSize);
|
(word16)*rhSize);
|
||||||
if (ret < 0 && ret != MATCH_SUITE_ERROR) {
|
if (ret < 0 && ret != MATCH_SUITE_ERROR) {
|
||||||
SetError(BAD_OLD_CLIENT_STR, error, session, FATAL_ERROR_STATE);
|
SetError(BAD_OLD_CLIENT_STR, error, session, FATAL_ERROR_STATE);
|
||||||
return -1;
|
return -1;
|
||||||
|
Reference in New Issue
Block a user