mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-03 04:34:41 +02:00
Merge pull request #689 from dgarske/fix_iar_arm
Fixes for compiler warnings with IAR EWARM 8
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#define NO_DEV_RANDOM
|
||||
#define USE_CERT_BUFFERS_2048
|
||||
#define WOLFSSL_USER_CURRTIME
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
|
||||
#define CUSTOM_RAND_GENERATE custom_rand_generate
|
||||
/* warning "write a real random seed!!!!, just for testing now" */
|
||||
|
@@ -1423,9 +1423,9 @@ int InitSSL_Ctx(WOLFSSL_CTX* ctx, WOLFSSL_METHOD* method, void* heap)
|
||||
/* In case contexts are held in array and don't want to free actual ctx */
|
||||
void SSL_CtxResourceFree(WOLFSSL_CTX* ctx)
|
||||
{
|
||||
#ifdef HAVE_CERTIFICATE_STATUS_REQUEST_V2
|
||||
int i;
|
||||
|
||||
(void)i;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WOLF_EVENT
|
||||
wolfEventQueue_Free(&ctx->event_queue);
|
||||
@@ -1438,14 +1438,14 @@ void SSL_CtxResourceFree(WOLFSSL_CTX* ctx)
|
||||
#ifndef NO_DH
|
||||
XFREE(ctx->serverDH_G.buffer, ctx->heap, DYNAMIC_TYPE_DH);
|
||||
XFREE(ctx->serverDH_P.buffer, ctx->heap, DYNAMIC_TYPE_DH);
|
||||
#endif
|
||||
#endif /* !NO_DH */
|
||||
|
||||
#ifdef SINGLE_THREADED
|
||||
if (ctx->rng) {
|
||||
wc_FreeRng(ctx->rng);
|
||||
XFREE(ctx->rng, ctx->heap, DYNAMIC_TYPE_RNG);
|
||||
}
|
||||
#endif
|
||||
#endif /* SINGLE_THREADED */
|
||||
|
||||
#ifndef NO_CERTS
|
||||
FreeDer(&ctx->privateKey);
|
||||
@@ -1455,16 +1455,15 @@ void SSL_CtxResourceFree(WOLFSSL_CTX* ctx)
|
||||
if (ctx->ourCert) {
|
||||
XFREE(ctx->ourCert, ctx->heap, DYNAMIC_TYPE_X509);
|
||||
}
|
||||
#endif
|
||||
#endif /* KEEP_OUR_CERT */
|
||||
FreeDer(&ctx->certChain);
|
||||
wolfSSL_CertManagerFree(ctx->cm);
|
||||
#endif
|
||||
#endif /* !NO_CERTS */
|
||||
|
||||
#ifdef HAVE_TLS_EXTENSIONS
|
||||
TLSX_FreeAll(ctx->extensions, ctx->heap);
|
||||
|
||||
#ifndef NO_WOLFSSL_SERVER
|
||||
|
||||
#if defined(HAVE_CERTIFICATE_STATUS_REQUEST) \
|
||||
|| defined(HAVE_CERTIFICATE_STATUS_REQUEST_V2)
|
||||
if (ctx->certOcspRequest) {
|
||||
@@ -1473,29 +1472,28 @@ void SSL_CtxResourceFree(WOLFSSL_CTX* ctx)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_CERTIFICATE_STATUS_REQUEST_V2)
|
||||
#ifdef HAVE_CERTIFICATE_STATUS_REQUEST_V2
|
||||
for (i = 0; i < MAX_CHAIN_DEPTH; i++) {
|
||||
if (ctx->chainOcspRequest[i]) {
|
||||
FreeOcspRequest(ctx->chainOcspRequest[i]);
|
||||
XFREE(ctx->chainOcspRequest[i], ctx->heap, DYNAMIC_TYPE_OCSP_REQUEST);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* NO_WOLFSSL_SERVER */
|
||||
#endif /* HAVE_CERTIFICATE_STATUS_REQUEST_V2 */
|
||||
#endif /* !NO_WOLFSSL_SERVER */
|
||||
|
||||
#endif /* HAVE_TLS_EXTENSIONS */
|
||||
|
||||
#ifdef WOLFSSL_STATIC_MEMORY
|
||||
if (ctx->heap != NULL) {
|
||||
#ifdef WOLFSSL_HEAP_TEST
|
||||
/* avoid derefrencing a test value */
|
||||
if (ctx->heap != (void*)WOLFSSL_HEAP_TEST) {
|
||||
if (ctx->heap != (void*)WOLFSSL_HEAP_TEST)
|
||||
#endif
|
||||
WOLFSSL_HEAP_HINT* hint = (WOLFSSL_HEAP_HINT*)(ctx->heap);
|
||||
wc_FreeMutex(&((WOLFSSL_HEAP*)(hint->memory))->memory_mutex);
|
||||
#ifdef WOLFSSL_HEAP_TEST
|
||||
{
|
||||
WOLFSSL_HEAP_HINT* hint = (WOLFSSL_HEAP_HINT*)(ctx->heap);
|
||||
wc_FreeMutex(&((WOLFSSL_HEAP*)(hint->memory))->memory_mutex);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif /* WOLFSSL_STATIC_MEMORY */
|
||||
}
|
||||
|
@@ -19931,8 +19931,9 @@ WOLFSSL_X509* wolfSSL_get_chain_X509(WOLFSSL_X509_CHAIN* chain, int idx)
|
||||
InitDecodedCert(cert, chain->certs[idx].buffer,
|
||||
chain->certs[idx].length, NULL);
|
||||
|
||||
if ((ret = ParseCertRelative(cert, CERT_TYPE, 0, NULL)) != 0)
|
||||
if ((ret = ParseCertRelative(cert, CERT_TYPE, 0, NULL)) != 0) {
|
||||
WOLFSSL_MSG("Failed to parse cert");
|
||||
}
|
||||
else {
|
||||
x509 = (WOLFSSL_X509*)XMALLOC(sizeof(WOLFSSL_X509), NULL,
|
||||
DYNAMIC_TYPE_X509);
|
||||
@@ -20730,7 +20731,7 @@ int wolfSSL_PEM_write_bio_X509(WOLFSSL_BIO *bp, WOLFSSL_X509 *x) {
|
||||
}
|
||||
|
||||
|
||||
#ifndef NO_DH
|
||||
#if defined(OPENSSL_EXTRA) && !defined(NO_DH)
|
||||
/* Intialize ctx->dh with dh's params. Return SSL_SUCCESS on ok */
|
||||
long wolfSSL_CTX_set_tmp_dh(WOLFSSL_CTX* ctx, WOLFSSL_DH* dh)
|
||||
{
|
||||
@@ -20771,7 +20772,7 @@ long wolfSSL_CTX_set_tmp_dh(WOLFSSL_CTX* ctx, WOLFSSL_DH* dh)
|
||||
|
||||
return pSz > 0 && gSz > 0 ? ret : SSL_FATAL_ERROR;
|
||||
}
|
||||
#endif /* NO_DH */
|
||||
#endif /* OPENSSL_EXTRA && !NO_DH */
|
||||
#endif /* HAVE_LIGHTY || HAVE_STUNNEL || WOLFSSL_MYSQL_COMPATIBLE */
|
||||
|
||||
|
||||
|
@@ -3855,9 +3855,9 @@ int wc_ecc_export_x963_ex(ecc_key* key, byte* out, word32* outLen,
|
||||
#ifdef HAVE_COMP_KEY
|
||||
else
|
||||
return wc_ecc_export_x963_compressed(key, out, outLen);
|
||||
#endif
|
||||
|
||||
#else
|
||||
return NOT_COMPILED_IN;
|
||||
#endif
|
||||
}
|
||||
#endif /* HAVE_ECC_KEY_EXPORT */
|
||||
|
||||
@@ -5221,7 +5221,8 @@ static int add_entry(int idx, ecc_point *g)
|
||||
static int build_lut(int idx, mp_int* a, mp_int* modulus, mp_digit mp,
|
||||
mp_int* mu)
|
||||
{
|
||||
unsigned x, y, err, bitlen, lut_gap;
|
||||
int err;
|
||||
unsigned x, y, bitlen, lut_gap;
|
||||
mp_int tmp;
|
||||
|
||||
if (mp_init(&tmp) != MP_OKAY)
|
||||
@@ -5367,8 +5368,8 @@ static int accel_fp_mul(int idx, mp_int* k, ecc_point *R, mp_int* a,
|
||||
#else
|
||||
unsigned char kb[KB_SIZE];
|
||||
#endif
|
||||
int x;
|
||||
unsigned y, z = 0, err, bitlen, bitpos, lut_gap, first;
|
||||
int x, err;
|
||||
unsigned y, z = 0, bitlen, bitpos, lut_gap, first;
|
||||
mp_int tk, order;
|
||||
|
||||
if (mp_init_multi(&tk, &order, NULL, NULL, NULL, NULL) != MP_OKAY)
|
||||
@@ -5516,8 +5517,8 @@ static int accel_fp_mul2add(int idx1, int idx2,
|
||||
#else
|
||||
unsigned char kb[2][KB_SIZE];
|
||||
#endif
|
||||
int x;
|
||||
unsigned y, z, err, bitlen, bitpos, lut_gap, first, zA, zB;
|
||||
int x, err;
|
||||
unsigned y, z, bitlen, bitpos, lut_gap, first, zA, zB;
|
||||
mp_int tka, tkb, order;
|
||||
|
||||
if (mp_init_multi(&tka, &tkb, &order, NULL, NULL, NULL) != MP_OKAY)
|
||||
|
@@ -812,13 +812,13 @@ int wc_HKDF(int type, const byte* inKey, word32 inKeySz,
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
tmp = (byte*)XMALLOC(MAX_DIGEST_SIZE, myHmac.heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
tmp = (byte*)XMALLOC(MAX_DIGEST_SIZE, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (tmp == NULL)
|
||||
return MEMORY_E;
|
||||
|
||||
prk = (byte*)XMALLOC(MAX_DIGEST_SIZE, myHmac.heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
prk = (byte*)XMALLOC(MAX_DIGEST_SIZE, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (prk == NULL) {
|
||||
XFREE(tmp, myHmac.heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(tmp, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
return MEMORY_E;
|
||||
}
|
||||
#endif
|
||||
@@ -870,8 +870,8 @@ int wc_HKDF(int type, const byte* inKey, word32 inKeySz,
|
||||
}
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(tmp, myHmac.heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(prk, myHmac.heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(tmp, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(prk, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
|
@@ -50,6 +50,12 @@
|
||||
|
||||
#else
|
||||
|
||||
|
||||
#if defined(__ICCARM__)
|
||||
#include <intrinsics.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef INTEL_INTRINSICS
|
||||
|
||||
#include <stdlib.h> /* get intrinsic definitions */
|
||||
|
@@ -3562,9 +3562,9 @@ static int wc_PKCS7_DecodeUnprotectedAttributes(PKCS7* pkcs7, byte* pkiMsg,
|
||||
|
||||
/* save attribute value bytes and size */
|
||||
if (GetSet(pkiMsg, &idx, &length, pkiMsgSz) < 0) {
|
||||
return ASN_PARSE_E;
|
||||
XFREE(attrib->oid, pkcs7->heap, DYNAMIC_TYPE_PKCS);
|
||||
XFREE(attrib, pkcs7->heap, DYNAMIC_TYPE_PKCS);
|
||||
return ASN_PARSE_E;
|
||||
}
|
||||
|
||||
if ((pkiMsgSz - idx) < (word32)length) {
|
||||
|
Reference in New Issue
Block a user