fix build errors when compiler is C++

This commit is contained in:
toddouska 2014-12-04 17:16:39 -08:00
parent 8105b9efa2
commit 51ffb84e11
10 changed files with 25 additions and 16 deletions

View File

@ -6327,9 +6327,6 @@ static int SetNameFromCert(CertName* cn, const byte* der, int derSz)
#ifndef NO_FILESYSTEM
/* forward from CyaSSL */
int CyaSSL_PemCertToDer(const char* fileName, unsigned char* derBuf, int derSz);
/* Set cert issuer from issuerFile in PEM */
int SetIssuer(Cert* cert, const char* issuerFile)
{

View File

@ -1768,11 +1768,11 @@ static int ecc_mul2add(ecc_point* A, mp_int* kA,
/* allocate memory */
tA = XMALLOC(ECC_BUFSIZE, NULL, DYNAMIC_TYPE_TMP_BUFFER);
tA = (unsigned char*)XMALLOC(ECC_BUFSIZE, NULL, DYNAMIC_TYPE_TMP_BUFFER);
if (tA == NULL) {
return GEN_MEM_ERR;
}
tB = XMALLOC(ECC_BUFSIZE, NULL, DYNAMIC_TYPE_TMP_BUFFER);
tB = (unsigned char*)XMALLOC(ECC_BUFSIZE, NULL, DYNAMIC_TYPE_TMP_BUFFER);
if (tB == NULL) {
XFREE(tA, NULL, DYNAMIC_TYPE_TMP_BUFFER);
return GEN_MEM_ERR;

View File

@ -368,7 +368,7 @@ int InitRng(RNG* rng)
if (rng != NULL) {
byte entropy[ENTROPY_NONCE_SZ];
rng->drbg = XMALLOC(sizeof(DRBG), NULL, DYNAMIC_TYPE_RNG);
rng->drbg = (struct DRBG*)XMALLOC(sizeof(DRBG), NULL, DYNAMIC_TYPE_RNG);
if (rng->drbg == NULL) {
ret = MEMORY_E;
}

View File

@ -553,6 +553,14 @@ enum cert_enums {
ECC_KEY = 12
};
#ifndef CYASSL_PEMCERT_TODER_DEFINED
#ifndef NO_FILESYSTEM
/* forward from CyaSSL */
CYASSL_API
int CyaSSL_PemCertToDer(const char* fileName, unsigned char* derBuf, int derSz);
#define CYASSL_PEMCERT_TODER_DEFINED
#endif
#endif
#endif /* CYASSL_CERT_GEN */

View File

@ -227,7 +227,10 @@ CYASSL_API int CyaSSL_use_RSAPrivateKey_file(CYASSL*, const char*, int);
/* load NTRU private key blob */
#endif
CYASSL_API int CyaSSL_PemCertToDer(const char*, unsigned char*, int);
#ifndef CYASSL_PEMCERT_TODER_DEFINED
CYASSL_API int CyaSSL_PemCertToDer(const char*, unsigned char*, int);
#define CYASSL_PEMCERT_TODER_DEFINED
#endif
#endif /* !NO_FILESYSTEM && !NO_CERTS */

View File

@ -1572,8 +1572,8 @@ static INLINE void SetupAtomicUser(CYASSL_CTX* ctx, CYASSL* ssl)
static INLINE void FreeAtomicUser(CYASSL* ssl)
{
AtomicEncCtx* encCtx = CyaSSL_GetMacEncryptCtx(ssl);
AtomicDecCtx* decCtx = CyaSSL_GetDecryptVerifyCtx(ssl);
AtomicEncCtx* encCtx = (AtomicEncCtx*)CyaSSL_GetMacEncryptCtx(ssl);
AtomicDecCtx* decCtx = (AtomicDecCtx*)CyaSSL_GetDecryptVerifyCtx(ssl);
free(decCtx);
free(encCtx);

View File

@ -4423,7 +4423,7 @@ static int DoCertificate(CYASSL* ssl, byte* input, word32* inOutIdx,
#ifdef HAVE_PK_CALLBACKS
#ifndef NO_RSA
ssl->buffers.peerRsaKey.buffer =
XMALLOC(dCert->pubKeySize,
(byte*)XMALLOC(dCert->pubKeySize,
ssl->heap, DYNAMIC_TYPE_RSA);
if (ssl->buffers.peerRsaKey.buffer == NULL)
ret = MEMORY_ERROR;
@ -4471,7 +4471,7 @@ static int DoCertificate(CYASSL* ssl, byte* input, word32* inOutIdx,
#ifdef HAVE_PK_CALLBACKS
#ifdef HAVE_ECC
ssl->buffers.peerEccDsaKey.buffer =
XMALLOC(dCert->pubKeySize,
(byte*)XMALLOC(dCert->pubKeySize,
ssl->heap, DYNAMIC_TYPE_ECC);
if (ssl->buffers.peerEccDsaKey.buffer == NULL)
ret = MEMORY_ERROR;

View File

@ -450,7 +450,8 @@ int EmbedSendTo(CYASSL* ssl, char *buf, int sz, void *ctx)
CYASSL_ENTER("EmbedSendTo()");
sent = (int)SENDTO_FUNCTION(sd, &buf[sz - len], len, ssl->wflags,
dtlsCtx->peer.sa, dtlsCtx->peer.sz);
(const struct sockaddr*)dtlsCtx->peer.sa,
dtlsCtx->peer.sz);
if (sent < 0) {
err = LastError();
CYASSL_MSG("Embed Send To error");

View File

@ -593,8 +593,8 @@ typedef struct TcpPseudoHdr {
static int SetPassword(char* passwd, int sz, int rw, void* userdata)
{
(void)rw;
XSTRNCPY(passwd, userdata, sz);
return (int)XSTRLEN(userdata);
XSTRNCPY(passwd, (const char*)userdata, sz);
return (int)XSTRLEN((const char*)userdata);
}

View File

@ -7936,8 +7936,8 @@ int CyaSSL_set_compression(CYASSL* ssl)
if (HmacUpdate(hmac, d, n) == 0)
if (HmacFinal(hmac, md) == 0) {
if (md_len)
*md_len = type == MD5 ? MD5_DIGEST_SIZE
: SHA_DIGEST_SIZE;
*md_len = (type == MD5) ? (int)MD5_DIGEST_SIZE
: (int)SHA_DIGEST_SIZE;
ret = md;
}