mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-02 04:04:39 +02:00
c++ build fixes
This commit is contained in:
@@ -2127,7 +2127,7 @@ static void DecodeCrlDist(byte* input, int sz, DecodedCert* cert)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check for reasonFlags */
|
/* Check for reasonFlags */
|
||||||
if (index < sz &&
|
if (index < (word32)sz &&
|
||||||
input[index] == (ASN_CONSTRUCTED | ASN_CONTEXT_SPECIFIC | 1))
|
input[index] == (ASN_CONSTRUCTED | ASN_CONTEXT_SPECIFIC | 1))
|
||||||
{
|
{
|
||||||
index++;
|
index++;
|
||||||
@@ -2136,7 +2136,7 @@ static void DecodeCrlDist(byte* input, int sz, DecodedCert* cert)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check for cRLIssuer */
|
/* Check for cRLIssuer */
|
||||||
if (index < sz &&
|
if (index < (word32)sz &&
|
||||||
input[index] == (ASN_CONSTRUCTED | ASN_CONTEXT_SPECIFIC | 2))
|
input[index] == (ASN_CONSTRUCTED | ASN_CONTEXT_SPECIFIC | 2))
|
||||||
{
|
{
|
||||||
index++;
|
index++;
|
||||||
@@ -2144,7 +2144,7 @@ static void DecodeCrlDist(byte* input, int sz, DecodedCert* cert)
|
|||||||
index += length;
|
index += length;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index < sz)
|
if (index < (word32)sz)
|
||||||
{
|
{
|
||||||
CYASSL_MSG("\tThere are more CRL Distribution Point records, "
|
CYASSL_MSG("\tThere are more CRL Distribution Point records, "
|
||||||
"but we only use the first one.");
|
"but we only use the first one.");
|
||||||
@@ -2191,7 +2191,7 @@ static void DecodeAuthInfo(byte* input, int sz, DecodedCert* cert)
|
|||||||
index += length;
|
index += length;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index < sz)
|
if (index < (word32)sz)
|
||||||
{
|
{
|
||||||
CYASSL_MSG("\tThere are more Authority Information Access records, "
|
CYASSL_MSG("\tThere are more Authority Information Access records, "
|
||||||
"but we only use first one.");
|
"but we only use first one.");
|
||||||
@@ -2223,7 +2223,7 @@ static void DecodeCertExtensions(DecodedCert* cert)
|
|||||||
|
|
||||||
if (GetSequence(input, &index, &length, sz) < 0) return;
|
if (GetSequence(input, &index, &length, sz) < 0) return;
|
||||||
|
|
||||||
while (index < sz) {
|
while (index < (word32)sz) {
|
||||||
if (GetSequence(input, &index, &length, sz) < 0) {
|
if (GetSequence(input, &index, &length, sz) < 0) {
|
||||||
CYASSL_MSG("\tfail: should be a SEQUENCE");
|
CYASSL_MSG("\tfail: should be a SEQUENCE");
|
||||||
return;
|
return;
|
||||||
@@ -2314,7 +2314,7 @@ int ParseCert(DecodedCert* cert, int type, int verify, void* cm)
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
CYASSL_LOCAL Signer* GetCA(Signer* signers, byte* hash);
|
CYASSL_LOCAL Signer* GetCA(void* signers, byte* hash);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -406,7 +406,7 @@ static int rand_prime(mp_int* N, int len, RNG* rng, void* heap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* allocate buffer to work with */
|
/* allocate buffer to work with */
|
||||||
buf = XMALLOC(len, heap, DYNAMIC_TYPE_RSA);
|
buf = (byte*)XMALLOC(len, heap, DYNAMIC_TYPE_RSA);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
return MEMORY_E;
|
return MEMORY_E;
|
||||||
}
|
}
|
||||||
|
26
src/ssl.c
26
src/ssl.c
@@ -5943,7 +5943,7 @@ static int initGlobalRNG = 0;
|
|||||||
CYASSL_MSG("CyaSSL_BN_free");
|
CYASSL_MSG("CyaSSL_BN_free");
|
||||||
if (bn) {
|
if (bn) {
|
||||||
if (bn->internal) {
|
if (bn->internal) {
|
||||||
mp_clear(bn->internal);
|
mp_clear((mp_int*)bn->internal);
|
||||||
XFREE(bn->internal, NULL, DYNAMIC_TYPE_BIGINT);
|
XFREE(bn->internal, NULL, DYNAMIC_TYPE_BIGINT);
|
||||||
bn->internal = NULL;
|
bn->internal = NULL;
|
||||||
}
|
}
|
||||||
@@ -6157,7 +6157,7 @@ static int initGlobalRNG = 0;
|
|||||||
buffer[0] |= 0x80 | 0x40;
|
buffer[0] |= 0x80 | 0x40;
|
||||||
buffer[len-1] |= 0x01;
|
buffer[len-1] |= 0x01;
|
||||||
|
|
||||||
if (mp_read_unsigned_bin(bn->internal, buffer, len) != MP_OKAY) {
|
if (mp_read_unsigned_bin((mp_int*)bn->internal,buffer,len) != MP_OKAY) {
|
||||||
CYASSL_MSG("mp read bin failed");
|
CYASSL_MSG("mp read bin failed");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -6319,7 +6319,7 @@ static int initGlobalRNG = 0;
|
|||||||
|
|
||||||
if (dh) {
|
if (dh) {
|
||||||
if (dh->internal) {
|
if (dh->internal) {
|
||||||
FreeDhKey(dh->internal);
|
FreeDhKey((DhKey*)dh->internal);
|
||||||
XFREE(dh->internal, NULL, DYNAMIC_TYPE_DH);
|
XFREE(dh->internal, NULL, DYNAMIC_TYPE_DH);
|
||||||
dh->internal = NULL;
|
dh->internal = NULL;
|
||||||
}
|
}
|
||||||
@@ -6482,12 +6482,12 @@ static int initGlobalRNG = 0;
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CyaSSL_BN_bn2bin(dh->priv_key, NULL) > privSz) {
|
if (CyaSSL_BN_bn2bin(dh->priv_key, NULL) > (int)privSz) {
|
||||||
CYASSL_MSG("Bad priv internal size");
|
CYASSL_MSG("Bad priv internal size");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CyaSSL_BN_bn2bin(otherPub, NULL) > pubSz) {
|
if (CyaSSL_BN_bn2bin(otherPub, NULL) > (int)pubSz) {
|
||||||
CYASSL_MSG("Bad otherPub size");
|
CYASSL_MSG("Bad otherPub size");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -6561,7 +6561,7 @@ static int initGlobalRNG = 0;
|
|||||||
|
|
||||||
if (dsa) {
|
if (dsa) {
|
||||||
if (dsa->internal) {
|
if (dsa->internal) {
|
||||||
FreeDsaKey(dsa->internal);
|
FreeDsaKey((DsaKey*)dsa->internal);
|
||||||
XFREE(dsa->internal, NULL, DYNAMIC_TYPE_DSA);
|
XFREE(dsa->internal, NULL, DYNAMIC_TYPE_DSA);
|
||||||
dsa->internal = NULL;
|
dsa->internal = NULL;
|
||||||
}
|
}
|
||||||
@@ -6648,7 +6648,7 @@ static int initGlobalRNG = 0;
|
|||||||
|
|
||||||
if (rsa) {
|
if (rsa) {
|
||||||
if (rsa->internal) {
|
if (rsa->internal) {
|
||||||
FreeRsaKey(rsa->internal);
|
FreeRsaKey((RsaKey*)rsa->internal);
|
||||||
XFREE(rsa->internal, NULL, DYNAMIC_TYPE_RSA);
|
XFREE(rsa->internal, NULL, DYNAMIC_TYPE_RSA);
|
||||||
rsa->internal = NULL;
|
rsa->internal = NULL;
|
||||||
}
|
}
|
||||||
@@ -6684,7 +6684,7 @@ static int initGlobalRNG = 0;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mp_copy(mpi, (*bn)->internal) != MP_OKAY) {
|
if (mp_copy(mpi, (mp_int*)((*bn)->internal)) != MP_OKAY) {
|
||||||
CYASSL_MSG("mp_copy error");
|
CYASSL_MSG("mp_copy error");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -6810,7 +6810,7 @@ static int initGlobalRNG = 0;
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CYASSL_KEY_GEN
|
#ifdef CYASSL_KEY_GEN
|
||||||
if (MakeRsaKey(rsa->internal, bits, 65537, &rng) < 0) {
|
if (MakeRsaKey((RsaKey*)rsa->internal, bits, 65537, &rng) < 0) {
|
||||||
CYASSL_MSG("MakeRsaKey failed");
|
CYASSL_MSG("MakeRsaKey failed");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -7061,7 +7061,7 @@ static int initGlobalRNG = 0;
|
|||||||
|
|
||||||
if (key && keylen) {
|
if (key && keylen) {
|
||||||
CYASSL_MSG("keying hmac");
|
CYASSL_MSG("keying hmac");
|
||||||
HmacSetKey(&ctx->hmac, ctx->type, key, (word32)keylen);
|
HmacSetKey(&ctx->hmac, ctx->type, (const byte*)key, (word32)keylen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7391,7 +7391,7 @@ int CyaSSL_KeyPemToDer(const unsigned char* pem, int pemSz, unsigned char* buff,
|
|||||||
CYASSL_MSG("Bad Pem To Der");
|
CYASSL_MSG("Bad Pem To Der");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (der.length <= buffSz) {
|
if (der.length <= (word32)buffSz) {
|
||||||
XMEMCPY(buff, der.buffer, der.length);
|
XMEMCPY(buff, der.buffer, der.length);
|
||||||
ret = der.length;
|
ret = der.length;
|
||||||
}
|
}
|
||||||
@@ -7420,7 +7420,7 @@ int CyaSSL_RSA_LoadDer(CYASSL_RSA* rsa, const unsigned char* der, int derSz)
|
|||||||
return BAD_FUNC_ARG;
|
return BAD_FUNC_ARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = RsaPrivateKeyDecode(der, &idx, rsa->internal, derSz);
|
ret = RsaPrivateKeyDecode(der, &idx, (RsaKey*)rsa->internal, derSz);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
CYASSL_MSG("RsaPrivateKeyDecode failed");
|
CYASSL_MSG("RsaPrivateKeyDecode failed");
|
||||||
return ret;
|
return ret;
|
||||||
@@ -7450,7 +7450,7 @@ int CyaSSL_DSA_LoadDer(CYASSL_DSA* dsa, const unsigned char* der, int derSz)
|
|||||||
return BAD_FUNC_ARG;
|
return BAD_FUNC_ARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = DsaPrivateKeyDecode(der, &idx, dsa->internal, derSz);
|
ret = DsaPrivateKeyDecode(der, &idx, (DsaKey*)dsa->internal, derSz);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
CYASSL_MSG("DsaPrivateKeyDecode failed");
|
CYASSL_MSG("DsaPrivateKeyDecode failed");
|
||||||
return ret;
|
return ret;
|
||||||
|
Reference in New Issue
Block a user