diff --git a/ctaocrypt/src/asn.c b/ctaocrypt/src/asn.c index 614134b94..1ea803c84 100644 --- a/ctaocrypt/src/asn.c +++ b/ctaocrypt/src/asn.c @@ -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) { diff --git a/ctaocrypt/src/ecc.c b/ctaocrypt/src/ecc.c index d13cb58c5..d7b8baf3f 100644 --- a/ctaocrypt/src/ecc.c +++ b/ctaocrypt/src/ecc.c @@ -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; diff --git a/ctaocrypt/src/random.c b/ctaocrypt/src/random.c index 357631f5b..06e4bbee6 100644 --- a/ctaocrypt/src/random.c +++ b/ctaocrypt/src/random.c @@ -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; } diff --git a/cyassl/ctaocrypt/asn.h b/cyassl/ctaocrypt/asn.h index 8df0b1d6c..fe45c3693 100644 --- a/cyassl/ctaocrypt/asn.h +++ b/cyassl/ctaocrypt/asn.h @@ -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 */ diff --git a/cyassl/ssl.h b/cyassl/ssl.h index e70e2f59b..7de6d2519 100644 --- a/cyassl/ssl.h +++ b/cyassl/ssl.h @@ -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 */ diff --git a/cyassl/test.h b/cyassl/test.h index 25a5bc508..6539f0798 100644 --- a/cyassl/test.h +++ b/cyassl/test.h @@ -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); diff --git a/src/internal.c b/src/internal.c index 96746298c..5a717e43e 100644 --- a/src/internal.c +++ b/src/internal.c @@ -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; diff --git a/src/io.c b/src/io.c index d0645875c..5536367ae 100644 --- a/src/io.c +++ b/src/io.c @@ -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"); diff --git a/src/sniffer.c b/src/sniffer.c index 815aed605..2462aaac2 100644 --- a/src/sniffer.c +++ b/src/sniffer.c @@ -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); } diff --git a/src/ssl.c b/src/ssl.c index 0e5801f92..faedcb02c 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -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; }