forked from wolfSSL/wolfssl
fix type conversion in ssl* files
This commit is contained in:
24
src/ssl.c
24
src/ssl.c
@@ -1684,7 +1684,7 @@ const char* wolfSSL_get_shared_ciphers(WOLFSSL* ssl, char* buf, int len)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
cipher = wolfSSL_get_cipher_name_iana(ssl);
|
cipher = wolfSSL_get_cipher_name_iana(ssl);
|
||||||
len = (int)min((word32)len, (int)(XSTRLEN(cipher) + 1));
|
len = (int)min((word32)len, (word32)(XSTRLEN(cipher) + 1));
|
||||||
XMEMCPY(buf, cipher, len);
|
XMEMCPY(buf, cipher, len);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
@@ -4673,7 +4673,7 @@ int wolfSSL_pending(WOLFSSL* ssl)
|
|||||||
if (ssl == NULL)
|
if (ssl == NULL)
|
||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
|
|
||||||
return ssl->buffers.clearOutputBuffer.length;
|
return (int)ssl->buffers.clearOutputBuffer.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wolfSSL_has_pending(const WOLFSSL* ssl)
|
int wolfSSL_has_pending(const WOLFSSL* ssl)
|
||||||
@@ -10391,7 +10391,7 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
|
|||||||
sending += (int)iov[i].iov_len;
|
sending += (int)iov[i].iov_len;
|
||||||
|
|
||||||
if (sending > (int)sizeof(staticBuffer)) {
|
if (sending > (int)sizeof(staticBuffer)) {
|
||||||
myBuffer = (byte*)XMALLOC(sending, ssl->heap,
|
myBuffer = (byte*)XMALLOC((size_t)sending, ssl->heap,
|
||||||
DYNAMIC_TYPE_WRITEV);
|
DYNAMIC_TYPE_WRITEV);
|
||||||
if (!myBuffer)
|
if (!myBuffer)
|
||||||
return MEMORY_ERROR;
|
return MEMORY_ERROR;
|
||||||
@@ -11734,7 +11734,7 @@ cleanup:
|
|||||||
WOLFSSL_MSG("wolfSSL options are set through API calls and macros");
|
WOLFSSL_MSG("wolfSSL options are set through API calls and macros");
|
||||||
if(ctx == NULL)
|
if(ctx == NULL)
|
||||||
return BAD_FUNC_ARG;
|
return BAD_FUNC_ARG;
|
||||||
return ctx->mask;
|
return (long)ctx->mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* forward declaration */
|
/* forward declaration */
|
||||||
@@ -11747,7 +11747,7 @@ cleanup:
|
|||||||
if (ctx == NULL)
|
if (ctx == NULL)
|
||||||
return BAD_FUNC_ARG;
|
return BAD_FUNC_ARG;
|
||||||
|
|
||||||
ctx->mask = wolf_set_options(ctx->mask, opt);
|
ctx->mask = (unsigned long)wolf_set_options((long)ctx->mask, opt);
|
||||||
#if defined(HAVE_SESSION_TICKET) && (defined(OPENSSL_EXTRA) \
|
#if defined(HAVE_SESSION_TICKET) && (defined(OPENSSL_EXTRA) \
|
||||||
|| defined(HAVE_WEBSERVER) || defined(WOLFSSL_WPAS_SMALL))
|
|| defined(HAVE_WEBSERVER) || defined(WOLFSSL_WPAS_SMALL))
|
||||||
if ((ctx->mask & WOLFSSL_OP_NO_TICKET) == WOLFSSL_OP_NO_TICKET) {
|
if ((ctx->mask & WOLFSSL_OP_NO_TICKET) == WOLFSSL_OP_NO_TICKET) {
|
||||||
@@ -11763,7 +11763,7 @@ cleanup:
|
|||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
#endif
|
#endif
|
||||||
return ctx->mask;
|
return (long)ctx->mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
long wolfSSL_CTX_clear_options(WOLFSSL_CTX* ctx, long opt)
|
long wolfSSL_CTX_clear_options(WOLFSSL_CTX* ctx, long opt)
|
||||||
@@ -11771,8 +11771,8 @@ cleanup:
|
|||||||
WOLFSSL_ENTER("wolfSSL_CTX_clear_options");
|
WOLFSSL_ENTER("wolfSSL_CTX_clear_options");
|
||||||
if(ctx == NULL)
|
if(ctx == NULL)
|
||||||
return BAD_FUNC_ARG;
|
return BAD_FUNC_ARG;
|
||||||
ctx->mask &= ~opt;
|
ctx->mask &= (unsigned long)~opt;
|
||||||
return ctx->mask;
|
return (long)ctx->mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef OPENSSL_EXTRA
|
#ifdef OPENSSL_EXTRA
|
||||||
@@ -14277,7 +14277,7 @@ word32 wolfSSL_CIPHER_get_id(const WOLFSSL_CIPHER* cipher)
|
|||||||
WOLFSSL_ENTER("wolfSSL_CIPHER_get_id");
|
WOLFSSL_ENTER("wolfSSL_CIPHER_get_id");
|
||||||
|
|
||||||
if (cipher && cipher->ssl) {
|
if (cipher && cipher->ssl) {
|
||||||
cipher_id = (cipher->ssl->options.cipherSuite0 << 8) |
|
cipher_id = (word16)(cipher->ssl->options.cipherSuite0 << 8) |
|
||||||
cipher->ssl->options.cipherSuite;
|
cipher->ssl->options.cipherSuite;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -15970,7 +15970,7 @@ long wolfSSL_set_options(WOLFSSL* ssl, long op)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssl->options.mask = wolf_set_options(ssl->options.mask, op);
|
ssl->options.mask = (unsigned long)wolf_set_options((long)ssl->options.mask, op);
|
||||||
|
|
||||||
if ((ssl->options.mask & WOLFSSL_OP_NO_TLSv1_3) == WOLFSSL_OP_NO_TLSv1_3) {
|
if ((ssl->options.mask & WOLFSSL_OP_NO_TLSv1_3) == WOLFSSL_OP_NO_TLSv1_3) {
|
||||||
WOLFSSL_MSG("Disabling TLS 1.3");
|
WOLFSSL_MSG("Disabling TLS 1.3");
|
||||||
@@ -16073,7 +16073,7 @@ long wolfSSL_set_options(WOLFSSL* ssl, long op)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ssl->options.mask;
|
return (long)ssl->options.mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -16082,7 +16082,7 @@ long wolfSSL_get_options(const WOLFSSL* ssl)
|
|||||||
WOLFSSL_ENTER("wolfSSL_get_options");
|
WOLFSSL_ENTER("wolfSSL_get_options");
|
||||||
if(ssl == NULL)
|
if(ssl == NULL)
|
||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
return ssl->options.mask;
|
return (long)ssl->options.mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_SECURE_RENEGOTIATION) \
|
#if defined(HAVE_SECURE_RENEGOTIATION) \
|
||||||
|
@@ -1561,7 +1561,7 @@ static void ProcessBufferCertSetHave(WOLFSSL_CTX* ctx, WOLFSSL* ssl,
|
|||||||
#endif
|
#endif
|
||||||
#ifndef WC_STRICT_SIG
|
#ifndef WC_STRICT_SIG
|
||||||
if ((ctx != NULL) || (ssl != NULL)) {
|
if ((ctx != NULL) || (ssl != NULL)) {
|
||||||
wolfssl_set_have_from_key_oid(ctx, ssl, cert->keyOID);
|
wolfssl_set_have_from_key_oid(ctx, ssl, (int)cert->keyOID);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/* Set whether ECC is available based on signature available. */
|
/* Set whether ECC is available based on signature available. */
|
||||||
@@ -5272,8 +5272,8 @@ int wolfSSL_SetTmpDH(WOLFSSL* ssl, const unsigned char* p, int pSz,
|
|||||||
|
|
||||||
if (ret == 1) {
|
if (ret == 1) {
|
||||||
/* Allocate buffers for p and g to be assigned into SSL. */
|
/* Allocate buffers for p and g to be assigned into SSL. */
|
||||||
pAlloc = (byte*)XMALLOC(pSz, ssl->heap, DYNAMIC_TYPE_PUBLIC_KEY);
|
pAlloc = (byte*)XMALLOC((size_t)pSz, ssl->heap, DYNAMIC_TYPE_PUBLIC_KEY);
|
||||||
gAlloc = (byte*)XMALLOC(gSz, ssl->heap, DYNAMIC_TYPE_PUBLIC_KEY);
|
gAlloc = (byte*)XMALLOC((size_t)gSz, ssl->heap, DYNAMIC_TYPE_PUBLIC_KEY);
|
||||||
if ((pAlloc == NULL) || (gAlloc == NULL)) {
|
if ((pAlloc == NULL) || (gAlloc == NULL)) {
|
||||||
/* Memory will be freed below in the (ret != 1) block */
|
/* Memory will be freed below in the (ret != 1) block */
|
||||||
ret = MEMORY_E;
|
ret = MEMORY_E;
|
||||||
@@ -5332,7 +5332,7 @@ static int wolfssl_check_dh_key(unsigned char* p, int pSz, unsigned char* g,
|
|||||||
/* Initialize a DH object. */
|
/* Initialize a DH object. */
|
||||||
if ((ret = wc_InitDhKey(checkKey)) == 0) {
|
if ((ret = wc_InitDhKey(checkKey)) == 0) {
|
||||||
/* Check DH parameters. */
|
/* Check DH parameters. */
|
||||||
ret = wc_DhSetCheckKey(checkKey, p, (word32)pSz, g, gSz, NULL, 0, 0, &rng);
|
ret = wc_DhSetCheckKey(checkKey, p, (word32)pSz, g, (word32)gSz, NULL, 0, 0, &rng);
|
||||||
/* Dispose of DH object. */
|
/* Dispose of DH object. */
|
||||||
wc_FreeDhKey(checkKey);
|
wc_FreeDhKey(checkKey);
|
||||||
}
|
}
|
||||||
@@ -5431,8 +5431,8 @@ int wolfSSL_CTX_SetTmpDH(WOLFSSL_CTX* ctx, const unsigned char* p, int pSz,
|
|||||||
|
|
||||||
if (ret == 1) {
|
if (ret == 1) {
|
||||||
/* Allocate buffers for p and g to be assigned into SSL context. */
|
/* Allocate buffers for p and g to be assigned into SSL context. */
|
||||||
pAlloc = (byte*)XMALLOC(pSz, ctx->heap, DYNAMIC_TYPE_PUBLIC_KEY);
|
pAlloc = (byte*)XMALLOC((size_t)pSz, ctx->heap, DYNAMIC_TYPE_PUBLIC_KEY);
|
||||||
gAlloc = (byte*)XMALLOC(gSz, ctx->heap, DYNAMIC_TYPE_PUBLIC_KEY);
|
gAlloc = (byte*)XMALLOC((size_t)gSz, ctx->heap, DYNAMIC_TYPE_PUBLIC_KEY);
|
||||||
if ((pAlloc == NULL) || (gAlloc == NULL)) {
|
if ((pAlloc == NULL) || (gAlloc == NULL)) {
|
||||||
ret = MEMORY_E;
|
ret = MEMORY_E;
|
||||||
}
|
}
|
||||||
@@ -5687,11 +5687,11 @@ static int ws_ctx_ssl_set_tmp_dh(WOLFSSL_CTX* ctx, WOLFSSL* ssl,
|
|||||||
}
|
}
|
||||||
else if (ssl != NULL) {
|
else if (ssl != NULL) {
|
||||||
/* Set p and g into SSL. */
|
/* Set p and g into SSL. */
|
||||||
res = wolfssl_set_tmp_dh(ssl, p, (int)pSz, g, gSz);
|
res = wolfssl_set_tmp_dh(ssl, p, (int)pSz, g, (int)gSz);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Set p and g into SSL context. */
|
/* Set p and g into SSL context. */
|
||||||
res = wolfssl_ctx_set_tmp_dh(ctx, p, (int)pSz, g, gSz);
|
res = wolfssl_ctx_set_tmp_dh(ctx, p, (int)pSz, g, (int)gSz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1004,7 +1004,7 @@ WOLFSSL_SESSION* wolfSSL_GetSessionClient(WOLFSSL* ssl, const byte* id, int len)
|
|||||||
#else
|
#else
|
||||||
current = &sessRow->Sessions[clSess[idx].serverIdx];
|
current = &sessRow->Sessions[clSess[idx].serverIdx];
|
||||||
#endif
|
#endif
|
||||||
if (current && XMEMCMP(current->serverID, id, len) == 0) {
|
if (current && XMEMCMP(current->serverID, id, (unsigned long)len) == 0) {
|
||||||
WOLFSSL_MSG("Found a serverid match for client");
|
WOLFSSL_MSG("Found a serverid match for client");
|
||||||
if (LowResTimer() < (current->bornOn + current->timeout)) {
|
if (LowResTimer() < (current->bornOn + current->timeout)) {
|
||||||
WOLFSSL_MSG("Session valid");
|
WOLFSSL_MSG("Session valid");
|
||||||
|
Reference in New Issue
Block a user