c++ build fixes

This commit is contained in:
toddouska
2012-05-17 10:05:24 -07:00
parent ac92d30955
commit 146e7ff1f4
3 changed files with 20 additions and 20 deletions

View File

@@ -2127,7 +2127,7 @@ static void DecodeCrlDist(byte* input, int sz, DecodedCert* cert)
}
/* Check for reasonFlags */
if (index < sz &&
if (index < (word32)sz &&
input[index] == (ASN_CONSTRUCTED | ASN_CONTEXT_SPECIFIC | 1))
{
index++;
@@ -2136,7 +2136,7 @@ static void DecodeCrlDist(byte* input, int sz, DecodedCert* cert)
}
/* Check for cRLIssuer */
if (index < sz &&
if (index < (word32)sz &&
input[index] == (ASN_CONSTRUCTED | ASN_CONTEXT_SPECIFIC | 2))
{
index++;
@@ -2144,7 +2144,7 @@ static void DecodeCrlDist(byte* input, int sz, DecodedCert* cert)
index += length;
}
if (index < sz)
if (index < (word32)sz)
{
CYASSL_MSG("\tThere are more CRL Distribution Point records, "
"but we only use the first one.");
@@ -2191,7 +2191,7 @@ static void DecodeAuthInfo(byte* input, int sz, DecodedCert* cert)
index += length;
}
if (index < sz)
if (index < (word32)sz)
{
CYASSL_MSG("\tThere are more Authority Information Access records, "
"but we only use first one.");
@@ -2223,7 +2223,7 @@ static void DecodeCertExtensions(DecodedCert* cert)
if (GetSequence(input, &index, &length, sz) < 0) return;
while (index < sz) {
while (index < (word32)sz) {
if (GetSequence(input, &index, &length, sz) < 0) {
CYASSL_MSG("\tfail: should be a SEQUENCE");
return;
@@ -2314,7 +2314,7 @@ int ParseCert(DecodedCert* cert, int type, int verify, void* cm)
#ifdef __cplusplus
extern "C" {
#endif
CYASSL_LOCAL Signer* GetCA(Signer* signers, byte* hash);
CYASSL_LOCAL Signer* GetCA(void* signers, byte* hash);
#ifdef __cplusplus
}
#endif

View File

@@ -406,7 +406,7 @@ static int rand_prime(mp_int* N, int len, RNG* rng, void* heap)
}
/* allocate buffer to work with */
buf = XMALLOC(len, heap, DYNAMIC_TYPE_RSA);
buf = (byte*)XMALLOC(len, heap, DYNAMIC_TYPE_RSA);
if (buf == NULL) {
return MEMORY_E;
}

View File

@@ -5943,7 +5943,7 @@ static int initGlobalRNG = 0;
CYASSL_MSG("CyaSSL_BN_free");
if (bn) {
if (bn->internal) {
mp_clear(bn->internal);
mp_clear((mp_int*)bn->internal);
XFREE(bn->internal, NULL, DYNAMIC_TYPE_BIGINT);
bn->internal = NULL;
}
@@ -6157,7 +6157,7 @@ static int initGlobalRNG = 0;
buffer[0] |= 0x80 | 0x40;
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");
return 0;
}
@@ -6319,7 +6319,7 @@ static int initGlobalRNG = 0;
if (dh) {
if (dh->internal) {
FreeDhKey(dh->internal);
FreeDhKey((DhKey*)dh->internal);
XFREE(dh->internal, NULL, DYNAMIC_TYPE_DH);
dh->internal = NULL;
}
@@ -6482,12 +6482,12 @@ static int initGlobalRNG = 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");
return 0;
}
if (CyaSSL_BN_bn2bin(otherPub, NULL) > pubSz) {
if (CyaSSL_BN_bn2bin(otherPub, NULL) > (int)pubSz) {
CYASSL_MSG("Bad otherPub size");
return 0;
}
@@ -6561,7 +6561,7 @@ static int initGlobalRNG = 0;
if (dsa) {
if (dsa->internal) {
FreeDsaKey(dsa->internal);
FreeDsaKey((DsaKey*)dsa->internal);
XFREE(dsa->internal, NULL, DYNAMIC_TYPE_DSA);
dsa->internal = NULL;
}
@@ -6648,7 +6648,7 @@ static int initGlobalRNG = 0;
if (rsa) {
if (rsa->internal) {
FreeRsaKey(rsa->internal);
FreeRsaKey((RsaKey*)rsa->internal);
XFREE(rsa->internal, NULL, DYNAMIC_TYPE_RSA);
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");
return -1;
}
@@ -6810,7 +6810,7 @@ static int initGlobalRNG = 0;
}
#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");
return -1;
}
@@ -7061,7 +7061,7 @@ static int initGlobalRNG = 0;
if (key && keylen) {
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");
}
else {
if (der.length <= buffSz) {
if (der.length <= (word32)buffSz) {
XMEMCPY(buff, der.buffer, 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;
}
ret = RsaPrivateKeyDecode(der, &idx, rsa->internal, derSz);
ret = RsaPrivateKeyDecode(der, &idx, (RsaKey*)rsa->internal, derSz);
if (ret < 0) {
CYASSL_MSG("RsaPrivateKeyDecode failed");
return ret;
@@ -7450,7 +7450,7 @@ int CyaSSL_DSA_LoadDer(CYASSL_DSA* dsa, const unsigned char* der, int derSz)
return BAD_FUNC_ARG;
}
ret = DsaPrivateKeyDecode(der, &idx, dsa->internal, derSz);
ret = DsaPrivateKeyDecode(der, &idx, (DsaKey*)dsa->internal, derSz);
if (ret < 0) {
CYASSL_MSG("DsaPrivateKeyDecode failed");
return ret;