Fix warnings and g++ casting error

This commit is contained in:
Sean Parkinson 2017-11-09 17:30:59 +10:00
parent 55ec382093
commit 6a825ea0ce
2 changed files with 14 additions and 23 deletions

View File

@ -288,16 +288,17 @@ WOLFSSL_CTX* wolfSSL_CTX_new_ex(WOLFSSL_METHOD* method, void* heap)
wolfSSL_CTX_free(ctx);
ctx = NULL;
}
#if defined(OPENSSL_EXTRA) && defined(WOLFCRYPT_HAVE_SRP) \
&& !defined(NO_SHA256) && !defined(WC_NO_RNG)
ctx->srp = (Srp*) XMALLOC(sizeof(Srp), heap, DYNAMIC_TYPE_SRP);
if (ctx->srp == NULL){
WOLFSSL_MSG("Init CTX failed");
wolfSSL_CTX_free(ctx);
return NULL;
&& !defined(NO_SHA256) && !defined(WC_NO_RNG)
else {
ctx->srp = (Srp*) XMALLOC(sizeof(Srp), heap, DYNAMIC_TYPE_SRP);
if (ctx->srp == NULL){
WOLFSSL_MSG("Init CTX failed");
wolfSSL_CTX_free(ctx);
return NULL;
}
XMEMSET(ctx->srp, 0, sizeof(Srp));
}
XMEMSET(ctx->srp, 0, sizeof(Srp));
#endif
}
else {
@ -11177,7 +11178,7 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
int wolfSSL_CTX_set_srp_username(WOLFSSL_CTX* ctx, char* username)
{
int r = 0;
int srp_side = 0;
SrpSide srp_side = SRP_CLIENT_SIDE;
WC_RNG rng;
byte salt[SRP_SALT_SIZE];
@ -11290,9 +11291,8 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
if (ctx->srp_password != NULL)
XFREE(ctx->srp_password,ctx->heap, DYNAMIC_TYPE_SRP);
ctx->srp_password = XMALLOC(XSTRLEN(password) + 1,
ctx->heap,
DYNAMIC_TYPE_SRP);
ctx->srp_password = (byte*)XMALLOC(XSTRLEN(password) + 1, ctx->heap,
DYNAMIC_TYPE_SRP);
if (ctx->srp_password == NULL){
WOLFSSL_MSG("memory allocation error");
return SSL_FAILURE;

View File

@ -7855,7 +7855,7 @@ int wc_AesXtsEncrypt(XtsAes* xaes, byte* out, const byte* in, word32 sz,
word32 blocks = (sz / AES_BLOCK_SIZE);
Aes *aes, *tweak;
if (xaes == NULL || out == NULL) {
if (xaes == NULL || out == NULL || in == NULL) {
return BAD_FUNC_ARG;
}
@ -7866,10 +7866,6 @@ int wc_AesXtsEncrypt(XtsAes* xaes, byte* out, const byte* in, word32 sz,
return BAD_FUNC_ARG;
}
if (in == NULL && sz > 0) {
return BAD_FUNC_ARG;
}
if (blocks > 0) {
byte tmp[AES_BLOCK_SIZE];
@ -7896,7 +7892,6 @@ int wc_AesXtsEncrypt(XtsAes* xaes, byte* out, const byte* in, word32 sz,
if (carry) {
tmp[0] ^= GF_XTS;
}
carry = 0;
in += AES_BLOCK_SIZE;
out += AES_BLOCK_SIZE;
@ -7948,7 +7943,7 @@ int wc_AesXtsDecrypt(XtsAes* xaes, byte* out, const byte* in, word32 sz,
word32 blocks = (sz / AES_BLOCK_SIZE);
Aes *aes, *tweak;
if (xaes == NULL || out == NULL) {
if (xaes == NULL || out == NULL || in == NULL) {
return BAD_FUNC_ARG;
}
@ -7959,10 +7954,6 @@ int wc_AesXtsDecrypt(XtsAes* xaes, byte* out, const byte* in, word32 sz,
return BAD_FUNC_ARG;
}
if (in == NULL && sz > 0) {
return BAD_FUNC_ARG;
}
if (blocks > 0) {
word32 j;
byte carry = 0;