Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type conversion fixes #7918

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/client/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -3223,7 +3223,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
#if (defined(WOLFSSL_SCTP) || defined(WOLFSSL_DTLS_MTU)) && \
defined(WOLFSSL_DTLS)
if (dtlsMTU)
wolfSSL_CTX_dtls_set_mtu(ctx, dtlsMTU);
wolfSSL_CTX_dtls_set_mtu(ctx, (unsigned short)dtlsMTU);
#endif

#ifndef NO_DH
Expand Down
2 changes: 1 addition & 1 deletion examples/server/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -2682,7 +2682,7 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
#if (defined(WOLFSSL_SCTP) || defined(WOLFSSL_DTLS_MTU)) && \
defined(WOLFSSL_DTLS)
if (dtlsMTU)
wolfSSL_CTX_dtls_set_mtu(ctx, dtlsMTU);
wolfSSL_CTX_dtls_set_mtu(ctx, (unsigned short)dtlsMTU);
#endif

#ifdef WOLFSSL_SCTP
Expand Down
2 changes: 1 addition & 1 deletion src/ocsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1432,7 +1432,7 @@ WOLFSSL_OCSP_REQ_CTX* wolfSSL_OCSP_REQ_CTX_new(WOLFSSL_BIO *bio, int maxline)
DYNAMIC_TYPE_OPENSSL);
if (ret != NULL) {
XMEMSET(ret, 0, sizeof(*ret));
ret->buf = (byte*)XMALLOC(maxline, NULL, DYNAMIC_TYPE_OPENSSL);
ret->buf = (byte*)XMALLOC((word32)maxline, NULL, DYNAMIC_TYPE_OPENSSL);
if (ret->buf == NULL)
goto error;
ret->reqResp = wolfSSL_BIO_new(wolfSSL_BIO_s_mem());
Expand Down
36 changes: 18 additions & 18 deletions wolfcrypt/src/asn.c
Original file line number Diff line number Diff line change
Expand Up @@ -5649,7 +5649,7 @@ int EncodeObjectId(const word16* in, word32 inSz, byte* out, word32* outSz)
}

/* compute length of encoded OID */
d = (in[0] * 40) + in[1];
d = ((word32)in[0] * 40) + in[1];
len = 0;
for (i = 1; i < (int)inSz; i++) {
x = 0;
Expand All @@ -5672,7 +5672,7 @@ int EncodeObjectId(const word16* in, word32 inSz, byte* out, word32* outSz)
}

/* calc first byte */
d = (in[0] * 40) + in[1];
d = ((word32)in[0] * 40) + in[1];

/* encode bytes */
x = 0;
Expand Down Expand Up @@ -5707,7 +5707,7 @@ int EncodeObjectId(const word16* in, word32 inSz, byte* out, word32* outSz)
}

/* return length */
*outSz = len;
*outSz = (word32)len;

return 0;
}
Expand Down Expand Up @@ -13473,12 +13473,12 @@ static int GenerateDNSEntryRIDString(DNS_entry* entry, void* heap)
}

if (i < tmpSize - 1) {
ret = XSNPRINTF(oidName + j, MAX_OID_SZ - j, "%d.",
tmpName[i]);
ret = XSNPRINTF(oidName + j, (word32)(MAX_OID_SZ - j),
"%d.", tmpName[i]);
}
else {
ret = XSNPRINTF(oidName + j, MAX_OID_SZ - j, "%d",
tmpName[i]);
ret = XSNPRINTF(oidName + j, (word32)(MAX_OID_SZ - j),
"%d", tmpName[i]);
}

if (ret >= 0) {
Expand All @@ -13497,15 +13497,15 @@ static int GenerateDNSEntryRIDString(DNS_entry* entry, void* heap)
if (ret == 0) {
nameSz = (int)XSTRLEN((const char*)finalName);

entry->ridString = (char*)XMALLOC(nameSz + 1, heap,
entry->ridString = (char*)XMALLOC((word32)(nameSz + 1), heap,
DYNAMIC_TYPE_ALTNAME);

if (entry->ridString == NULL) {
ret = MEMORY_E;
}

if (ret == 0) {
XMEMCPY(entry->ridString, finalName, nameSz + 1);
XMEMCPY(entry->ridString, finalName, (word32)(nameSz + 1));
}
}

Expand Down Expand Up @@ -28110,9 +28110,9 @@ static int EncodeName(EncodedName* name, const char* nameStr,
break;
#ifdef WOLFSSL_CUSTOM_OID
case ASN_CUSTOM_NAME:
nameSz = cname->custom.valSz;
nameSz = (word32)cname->custom.valSz;
oid = cname->custom.oid;
oidSz = cname->custom.oidSz;
oidSz = (word32)cname->custom.oidSz;
break;
#endif
#ifdef WOLFSSL_CERT_REQ
Expand Down Expand Up @@ -28436,8 +28436,8 @@ static int SetNameRdnItems(ASNSetData* dataASN, ASNItem* namesASN,
else if (type == ASN_CUSTOM_NAME) {
#ifdef WOLFSSL_CUSTOM_OID
SetRdnItems(namesASN + idx, dataASN + idx, name->custom.oid,
name->custom.oidSz, name->custom.enc,
name->custom.val, name->custom.valSz);
(word32)name->custom.oidSz, (byte)name->custom.enc,
name->custom.val, (word32)name->custom.valSz);
#endif
}
else {
Expand Down Expand Up @@ -32475,7 +32475,7 @@ int wc_SetExtKeyUsageOID(Cert *cert, const char *in, word32 sz, byte idx,
}

XMEMCPY(cert->extKeyUsageOID[idx], oid, oidSz);
cert->extKeyUsageOIDSz[idx] = oidSz;
cert->extKeyUsageOIDSz[idx] = (byte)oidSz;
cert->extKeyUsage |= EXTKEYUSE_USER;

return 0;
Expand Down Expand Up @@ -32511,7 +32511,7 @@ int wc_SetCustomExtension(Cert *cert, int critical, const char *oid,
ext->oid = (char*)oid;
ext->crit = (critical == 0) ? 0 : 1;
ext->val = (byte*)der;
ext->valSz = derSz;
ext->valSz = (int)derSz;

cert->customCertExtCount++;
return 0;
Expand Down Expand Up @@ -38713,15 +38713,15 @@ int ParseCRL(RevokedCert* rcert, DecodedCRL* dcrl, const byte* buff, word32 sz,
tbsParams =
GetASNItem_Addr(dataASN[CRLASN_IDX_TBS_SIGALGO_PARAMS],
buff);
tbsParamsSz =
tbsParamsSz =(int)
GetASNItem_Length(dataASN[CRLASN_IDX_TBS_SIGALGO_PARAMS],
buff);
}
if (dataASN[CRLASN_IDX_SIGALGO_PARAMS].tag != 0) {
sigParams =
GetASNItem_Addr(dataASN[CRLASN_IDX_SIGALGO_PARAMS],
buff);
sigParamsSz =
sigParamsSz = (int)
GetASNItem_Length(dataASN[CRLASN_IDX_SIGALGO_PARAMS],
buff);
dcrl->sigParamsIndex =
Expand All @@ -38748,7 +38748,7 @@ int ParseCRL(RevokedCert* rcert, DecodedCRL* dcrl, const byte* buff, word32 sz,
ret = ASN_PARSE_E;
}
else if ((tbsParamsSz > 0) &&
(XMEMCMP(tbsParams, sigParams, tbsParamsSz) != 0)) {
(XMEMCMP(tbsParams, sigParams, (word32)tbsParamsSz) != 0)) {
WOLFSSL_MSG("CRL TBS and signature parameter mismatch");
ret = ASN_PARSE_E;
}
Expand Down
Loading