Fixed several compiler warnings with inline variable declaration, deprecated func decl and small stack use of invaid memory (heap). Thanks @douzzer for these.

This commit is contained in:
David Garske
2020-08-20 15:13:43 -07:00
parent 92cf0d7b10
commit dd517fd81c
3 changed files with 9 additions and 9 deletions

View File

@@ -6196,15 +6196,15 @@ int GetAsnTimeString(void* currTime, byte* buf, word32 len)
{
struct tm* ts = NULL;
struct tm* tmpTime = NULL;
byte* data_ptr = buf;
word32 data_len = 0;
int year, mon, day, hour, mini, sec;
#if defined(NEED_TMP_TIME)
struct tm tmpTimeStorage;
tmpTime = &tmpTimeStorage;
#else
(void)tmpTime;
#endif
byte* data_ptr = buf;
word32 data_len = 0;
int year, mon, day, hour, mini, sec;
WOLFSSL_ENTER("SetAsnTimeString");
@@ -11682,7 +11682,7 @@ static int SetEd25519PublicKey(byte* output, ed25519_key* key, int with_header)
idx = wc_ed25519_export_public(key, pub, &pubSz);
if (idx != 0) {
#ifdef WOLFSSL_SMALL_STACK
XFREE(pub, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
XFREE(pub, NULL, DYNAMIC_TYPE_TMP_BUFFER);
#endif
return idx;
}
@@ -11692,7 +11692,7 @@ static int SetEd25519PublicKey(byte* output, ed25519_key* key, int with_header)
#ifdef WOLFSSL_SMALL_STACK
algo = (byte*)XMALLOC(MAX_ALGO_SZ, NULL, DYNAMIC_TYPE_TMP_BUFFER);
if (algo == NULL) {
XFREE(pub, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
XFREE(pub, NULL, DYNAMIC_TYPE_TMP_BUFFER);
return MEMORY_E;
}
#endif
@@ -11786,7 +11786,7 @@ static int SetEd448PublicKey(byte* output, ed448_key* key, int with_header)
idx = wc_ed448_export_public(key, pub, &pubSz);
if (idx != 0) {
#ifdef WOLFSSL_SMALL_STACK
XFREE(pub, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
XFREE(pub, NULL, DYNAMIC_TYPE_TMP_BUFFER);
#endif
return idx;
}
@@ -11796,7 +11796,7 @@ static int SetEd448PublicKey(byte* output, ed448_key* key, int with_header)
#ifdef WOLFSSL_SMALL_STACK
algo = (byte*)XMALLOC(MAX_ALGO_SZ, NULL, DYNAMIC_TYPE_TMP_BUFFER);
if (algo == NULL) {
XFREE(pub, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
XFREE(pub, NULL, DYNAMIC_TYPE_TMP_BUFFER);
return MEMORY_E;
}
#endif

View File

@@ -9238,6 +9238,7 @@ static int wc_PKCS7_DecryptKari(PKCS7* pkcs7, byte* in, word32 inSz,
switch (pkcs7->state) {
case WC_PKCS7_DECRYPT_KARI: {
WC_PKCS7_KARI* kari;
#ifndef NO_PKCS7_STREAM
/* @TODO for now just get full buffer, needs divided up */
if ((ret = wc_PKCS7_AddDataToStream(pkcs7, in, inSz,
@@ -9254,7 +9255,6 @@ static int wc_PKCS7_DecryptKari(PKCS7* pkcs7, byte* in, word32 inSz,
}
pkiMsgSz = (word32)rc;
#endif
WC_PKCS7_KARI* kari;
kari = wc_PKCS7_KariNew(pkcs7, WC_PKCS7_DECODE);
if (kari == NULL)

View File

@@ -341,7 +341,7 @@ static int InitSha512(wc_Sha512* sha512)
#define Transform_Sha512_Len(sha512, len) \
(*Transform_Sha512_Len_p)(sha512, len)
static void Sha512_SetTransform()
static void Sha512_SetTransform(void)
{
if (transform_check)
return;