mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-02 12:14:38 +02:00
Fix warnings in VS
This commit is contained in:
@@ -11499,7 +11499,7 @@ int LoadCertByIssuer(WOLFSSL_X509_STORE* store, X509_NAME* issuer, int type)
|
|||||||
const char* post = "";
|
const char* post = "";
|
||||||
byte* pbuf = NULL;
|
byte* pbuf = NULL;
|
||||||
int len, num, i, idx;
|
int len, num, i, idx;
|
||||||
byte suffix = 0;
|
int suffix = 0;
|
||||||
int retHash = NOT_COMPILED_IN;
|
int retHash = NOT_COMPILED_IN;
|
||||||
byte dgt[WC_MAX_DIGEST_SIZE];
|
byte dgt[WC_MAX_DIGEST_SIZE];
|
||||||
|
|
||||||
@@ -19222,7 +19222,7 @@ int SendCertificateRequest(WOLFSSL* ssl)
|
|||||||
|
|
||||||
if (name != NULL) {
|
if (name != NULL) {
|
||||||
c16toa((word16)name->rawLen +
|
c16toa((word16)name->rawLen +
|
||||||
SetSequence(name->rawLen, seq), &output[i]);
|
(word16)SetSequence(name->rawLen, seq), &output[i]);
|
||||||
i += OPAQUE16_LEN;
|
i += OPAQUE16_LEN;
|
||||||
i += SetSequence(name->rawLen, output + i);
|
i += SetSequence(name->rawLen, output + i);
|
||||||
XMEMCPY(output + i, name->raw, name->rawLen);
|
XMEMCPY(output + i, name->raw, name->rawLen);
|
||||||
@@ -31159,7 +31159,7 @@ static int DefTicketEncCb(WOLFSSL* ssl, byte key_name[WOLFSSL_TICKET_NAME_SZ],
|
|||||||
int ret;
|
int ret;
|
||||||
TicketEncCbCtx* keyCtx = (TicketEncCbCtx*)userCtx;
|
TicketEncCbCtx* keyCtx = (TicketEncCbCtx*)userCtx;
|
||||||
WOLFSSL_CTX* ctx = keyCtx->ctx;
|
WOLFSSL_CTX* ctx = keyCtx->ctx;
|
||||||
word16 sLen = XHTONS(inLen);
|
word16 sLen = XHTONS((word16)inLen);
|
||||||
byte aad[WOLFSSL_TICKET_NAME_SZ + WOLFSSL_TICKET_IV_SZ + sizeof(sLen)];
|
byte aad[WOLFSSL_TICKET_NAME_SZ + WOLFSSL_TICKET_IV_SZ + sizeof(sLen)];
|
||||||
int aadSz = WOLFSSL_TICKET_NAME_SZ + WOLFSSL_TICKET_IV_SZ + sizeof(sLen);
|
int aadSz = WOLFSSL_TICKET_NAME_SZ + WOLFSSL_TICKET_IV_SZ + sizeof(sLen);
|
||||||
byte* p = aad;
|
byte* p = aad;
|
||||||
|
48
src/ssl.c
48
src/ssl.c
@@ -10177,7 +10177,7 @@ int wolfSSL_X509_add_ext(WOLFSSL_X509 *x509, WOLFSSL_X509_EXTENSION *ext, int lo
|
|||||||
WOLFSSL_MSG("asn1_string_copy_to_buffer error");
|
WOLFSSL_MSG("asn1_string_copy_to_buffer error");
|
||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
}
|
}
|
||||||
x509->authKeyIdCrit = ext->crit;
|
x509->authKeyIdCrit = (byte)ext->crit;
|
||||||
break;
|
break;
|
||||||
case NID_subject_key_identifier:
|
case NID_subject_key_identifier:
|
||||||
if (asn1_string_copy_to_buffer(&ext->value, &x509->subjKeyId,
|
if (asn1_string_copy_to_buffer(&ext->value, &x509->subjKeyId,
|
||||||
@@ -10185,7 +10185,7 @@ int wolfSSL_X509_add_ext(WOLFSSL_X509 *x509, WOLFSSL_X509_EXTENSION *ext, int lo
|
|||||||
WOLFSSL_MSG("asn1_string_copy_to_buffer error");
|
WOLFSSL_MSG("asn1_string_copy_to_buffer error");
|
||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
}
|
}
|
||||||
x509->subjKeyIdCrit = ext->crit;
|
x509->subjKeyIdCrit = (byte)ext->crit;
|
||||||
break;
|
break;
|
||||||
case NID_subject_alt_name:
|
case NID_subject_alt_name:
|
||||||
{
|
{
|
||||||
@@ -10201,21 +10201,21 @@ int wolfSSL_X509_add_ext(WOLFSSL_X509 *x509, WOLFSSL_X509_EXTENSION *ext, int lo
|
|||||||
gns = gns->next;
|
gns = gns->next;
|
||||||
}
|
}
|
||||||
x509->subjAltNameSet = 1;
|
x509->subjAltNameSet = 1;
|
||||||
x509->subjAltNameCrit = ext->crit;
|
x509->subjAltNameCrit = (byte)ext->crit;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NID_key_usage:
|
case NID_key_usage:
|
||||||
if (ext && ext->value.data &&
|
if (ext && ext->value.data &&
|
||||||
ext->value.length == sizeof(word16)) {
|
ext->value.length == sizeof(word16)) {
|
||||||
x509->keyUsage = *(word16*)ext->value.data;
|
x509->keyUsage = *(word16*)ext->value.data;
|
||||||
x509->keyUsageCrit = ext->crit;
|
x509->keyUsageCrit = (byte)ext->crit;
|
||||||
x509->keyUsageSet = 1;
|
x509->keyUsageSet = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NID_basic_constraints:
|
case NID_basic_constraints:
|
||||||
if (ext->obj) {
|
if (ext->obj) {
|
||||||
x509->isCa = ext->obj->ca;
|
x509->isCa = (byte)ext->obj->ca;
|
||||||
x509->basicConstCrit = ext->crit;
|
x509->basicConstCrit = (byte)ext->crit;
|
||||||
if (ext->obj->pathlen)
|
if (ext->obj->pathlen)
|
||||||
x509->pathLength = ext->obj->pathlen->length;
|
x509->pathLength = ext->obj->pathlen->length;
|
||||||
x509->basicConstSet = 1;
|
x509->basicConstSet = 1;
|
||||||
@@ -15519,7 +15519,7 @@ int wolfSSL_SetSession(WOLFSSL* ssl, WOLFSSL_SESSION* session)
|
|||||||
ticLenAlloc >= ssl->session.ticketLen) {
|
ticLenAlloc >= ssl->session.ticketLen) {
|
||||||
XMEMCPY(ticBuff, session->ticket, ssl->session.ticketLen);
|
XMEMCPY(ticBuff, session->ticket, ssl->session.ticketLen);
|
||||||
ssl->session.ticket = ticBuff;
|
ssl->session.ticket = ticBuff;
|
||||||
ssl->session.ticketLenAlloc = ticLenAlloc;
|
ssl->session.ticketLenAlloc = (word16)ticLenAlloc;
|
||||||
ticBuff = NULL; /* don't free later after unlock */
|
ticBuff = NULL; /* don't free later after unlock */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -21039,7 +21039,7 @@ static WOLFSSL_X509* d2i_X509orX509REQ(WOLFSSL_X509** x509,
|
|||||||
|
|
||||||
InitDecodedCert(cert, (byte*)in, len, NULL);
|
InitDecodedCert(cert, (byte*)in, len, NULL);
|
||||||
#ifdef WOLFSSL_CERT_REQ
|
#ifdef WOLFSSL_CERT_REQ
|
||||||
cert->isCSR = req;
|
cert->isCSR = (byte)req;
|
||||||
#endif
|
#endif
|
||||||
if (ParseCertRelative(cert, type, 0, NULL) == 0) {
|
if (ParseCertRelative(cert, type, 0, NULL) == 0) {
|
||||||
newX509 = wolfSSL_X509_new();
|
newX509 = wolfSSL_X509_new();
|
||||||
@@ -26074,39 +26074,39 @@ int wolfSSL_sk_CIPHER_description(WOLFSSL_CIPHER* cipher)
|
|||||||
/* Build up the string by copying onto the end. */
|
/* Build up the string by copying onto the end. */
|
||||||
XSTRNCPY(dp, name, len);
|
XSTRNCPY(dp, name, len);
|
||||||
dp[len-1] = '\0'; strLen = (int)XSTRLEN(dp);
|
dp[len-1] = '\0'; strLen = (int)XSTRLEN(dp);
|
||||||
len -= (int)strLen; dp += strLen;
|
len -= (unsigned char)strLen; dp += strLen;
|
||||||
|
|
||||||
XSTRNCPY(dp, " ", len);
|
XSTRNCPY(dp, " ", len);
|
||||||
dp[len-1] = '\0'; strLen = (int)XSTRLEN(dp);
|
dp[len-1] = '\0'; strLen = (int)XSTRLEN(dp);
|
||||||
len -= (int)strLen; dp += strLen;
|
len -= (unsigned char)strLen; dp += strLen;
|
||||||
XSTRNCPY(dp, protocol, len);
|
XSTRNCPY(dp, protocol, len);
|
||||||
dp[len-1] = '\0'; strLen = (int)XSTRLEN(dp);
|
dp[len-1] = '\0'; strLen = (int)XSTRLEN(dp);
|
||||||
len -= (int)strLen; dp += strLen;
|
len -= (unsigned char)strLen; dp += strLen;
|
||||||
|
|
||||||
XSTRNCPY(dp, " Kx=", len);
|
XSTRNCPY(dp, " Kx=", len);
|
||||||
dp[len-1] = '\0'; strLen = (int)XSTRLEN(dp);
|
dp[len-1] = '\0'; strLen = (int)XSTRLEN(dp);
|
||||||
len -= (int)strLen; dp += strLen;
|
len -= (unsigned char)strLen; dp += strLen;
|
||||||
XSTRNCPY(dp, keaStr, len);
|
XSTRNCPY(dp, keaStr, len);
|
||||||
dp[len-1] = '\0'; strLen = (int)XSTRLEN(dp);
|
dp[len-1] = '\0'; strLen = (int)XSTRLEN(dp);
|
||||||
len -= (int)strLen; dp += strLen;
|
len -= (unsigned char)strLen; dp += strLen;
|
||||||
|
|
||||||
XSTRNCPY(dp, " Au=", len);
|
XSTRNCPY(dp, " Au=", len);
|
||||||
dp[len-1] = '\0'; strLen = (int)XSTRLEN(dp);
|
dp[len-1] = '\0'; strLen = (int)XSTRLEN(dp);
|
||||||
len -= (int)strLen; dp += strLen;
|
len -= (unsigned char)strLen; dp += strLen;
|
||||||
XSTRNCPY(dp, authStr, len);
|
XSTRNCPY(dp, authStr, len);
|
||||||
dp[len-1] = '\0'; strLen = (int)XSTRLEN(dp);
|
dp[len-1] = '\0'; strLen = (int)XSTRLEN(dp);
|
||||||
len -= (int)strLen; dp += strLen;
|
len -= (unsigned char)strLen; dp += strLen;
|
||||||
|
|
||||||
XSTRNCPY(dp, " Enc=", len);
|
XSTRNCPY(dp, " Enc=", len);
|
||||||
dp[len-1] = '\0'; strLen = (int)XSTRLEN(dp);
|
dp[len-1] = '\0'; strLen = (int)XSTRLEN(dp);
|
||||||
len -= (int)strLen; dp += strLen;
|
len -= (unsigned char)strLen; dp += strLen;
|
||||||
XSTRNCPY(dp, encStr, len);
|
XSTRNCPY(dp, encStr, len);
|
||||||
dp[len-1] = '\0'; strLen = (int)XSTRLEN(dp);
|
dp[len-1] = '\0'; strLen = (int)XSTRLEN(dp);
|
||||||
len -= (int)strLen; dp += strLen;
|
len -= (unsigned char)strLen; dp += strLen;
|
||||||
|
|
||||||
XSTRNCPY(dp, " Mac=", len);
|
XSTRNCPY(dp, " Mac=", len);
|
||||||
dp[len-1] = '\0'; strLen = (int)XSTRLEN(dp);
|
dp[len-1] = '\0'; strLen = (int)XSTRLEN(dp);
|
||||||
len -= (int)strLen; dp += strLen;
|
len -= (unsigned char)strLen; dp += strLen;
|
||||||
XSTRNCPY(dp, macStr, len);
|
XSTRNCPY(dp, macStr, len);
|
||||||
dp[len-1] = '\0';
|
dp[len-1] = '\0';
|
||||||
|
|
||||||
@@ -43748,7 +43748,7 @@ void* wolfSSL_GetHKDFExtractCtx(WOLFSSL* ssl)
|
|||||||
else {
|
else {
|
||||||
i->length = cert.serialSz + 2;
|
i->length = cert.serialSz + 2;
|
||||||
i->data[0] = ASN_INTEGER;
|
i->data[0] = ASN_INTEGER;
|
||||||
i->data[1] = cert.serialSz;
|
i->data[1] = (unsigned char)cert.serialSz;
|
||||||
XMEMCPY(i->data + 2, cert.serial, cert.serialSz);
|
XMEMCPY(i->data + 2, cert.serial, cert.serialSz);
|
||||||
if (wolfSSL_X509_set_serialNumber(x509, i) != WOLFSSL_SUCCESS) {
|
if (wolfSSL_X509_set_serialNumber(x509, i) != WOLFSSL_SUCCESS) {
|
||||||
WOLFSSL_MSG("Issue setting generated serial number");
|
WOLFSSL_MSG("Issue setting generated serial number");
|
||||||
@@ -44078,7 +44078,7 @@ static int wolfSSL_ASN1_STRING_canon(WOLFSSL_ASN1_STRING* asn_out,
|
|||||||
/* remove the rest of spaces */
|
/* remove the rest of spaces */
|
||||||
while (XISSPACE(*++src) && i++ < len);
|
while (XISSPACE(*++src) && i++ < len);
|
||||||
} else {
|
} else {
|
||||||
*dst = XTOLOWER((unsigned char)*src++);
|
*dst = (char)XTOLOWER((unsigned char)*src++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* put actual length */
|
/* put actual length */
|
||||||
@@ -44150,7 +44150,7 @@ int wolfSSL_i2d_X509_NAME_canon(WOLFSSL_X509_NAME* name, unsigned char** out)
|
|||||||
nameStr = (const char*)wolfSSL_ASN1_STRING_data(cano_data);
|
nameStr = (const char*)wolfSSL_ASN1_STRING_data(cano_data);
|
||||||
|
|
||||||
ret = wc_EncodeNameCanonical(&names[i], nameStr, CTC_UTF8,
|
ret = wc_EncodeNameCanonical(&names[i], nameStr, CTC_UTF8,
|
||||||
ConvertNIDToWolfSSL(entry->nid));
|
(byte)ConvertNIDToWolfSSL(entry->nid));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
#ifdef WOLFSSL_SMALL_STACK
|
#ifdef WOLFSSL_SMALL_STACK
|
||||||
XFREE(names, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
XFREE(names, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
@@ -44260,8 +44260,8 @@ int wolfSSL_i2d_X509_NAME(WOLFSSL_X509_NAME* name, unsigned char** out)
|
|||||||
WOLFSSL_MSG("Unknown encoding type conversion UTF8 by default");
|
WOLFSSL_MSG("Unknown encoding type conversion UTF8 by default");
|
||||||
type = CTC_UTF8;
|
type = CTC_UTF8;
|
||||||
}
|
}
|
||||||
ret = wc_EncodeName(&names[i], nameStr, type,
|
ret = wc_EncodeName(&names[i], nameStr, (char)type,
|
||||||
ConvertNIDToWolfSSL(entry->nid));
|
(byte)ConvertNIDToWolfSSL(entry->nid));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
#ifdef WOLFSSL_SMALL_STACK
|
#ifdef WOLFSSL_SMALL_STACK
|
||||||
XFREE(names, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
XFREE(names, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
@@ -60333,7 +60333,7 @@ void wolfSSL_BIO_set_shutdown(WOLFSSL_BIO* bio, int shut)
|
|||||||
{
|
{
|
||||||
WOLFSSL_ENTER("wolfSSL_BIO_set_shutdown");
|
WOLFSSL_ENTER("wolfSSL_BIO_set_shutdown");
|
||||||
if (bio != NULL)
|
if (bio != NULL)
|
||||||
bio->shutdown = shut;
|
bio->shutdown = (byte)shut;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wolfSSL_BIO_get_shutdown(WOLFSSL_BIO* bio)
|
int wolfSSL_BIO_get_shutdown(WOLFSSL_BIO* bio)
|
||||||
|
Reference in New Issue
Block a user