forked from wolfSSL/wolfssl
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:
@@ -6196,15 +6196,15 @@ int GetAsnTimeString(void* currTime, byte* buf, word32 len)
|
|||||||
{
|
{
|
||||||
struct tm* ts = NULL;
|
struct tm* ts = NULL;
|
||||||
struct tm* tmpTime = 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)
|
#if defined(NEED_TMP_TIME)
|
||||||
struct tm tmpTimeStorage;
|
struct tm tmpTimeStorage;
|
||||||
tmpTime = &tmpTimeStorage;
|
tmpTime = &tmpTimeStorage;
|
||||||
#else
|
#else
|
||||||
(void)tmpTime;
|
(void)tmpTime;
|
||||||
#endif
|
#endif
|
||||||
byte* data_ptr = buf;
|
|
||||||
word32 data_len = 0;
|
|
||||||
int year, mon, day, hour, mini, sec;
|
|
||||||
|
|
||||||
WOLFSSL_ENTER("SetAsnTimeString");
|
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);
|
idx = wc_ed25519_export_public(key, pub, &pubSz);
|
||||||
if (idx != 0) {
|
if (idx != 0) {
|
||||||
#ifdef WOLFSSL_SMALL_STACK
|
#ifdef WOLFSSL_SMALL_STACK
|
||||||
XFREE(pub, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
XFREE(pub, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
#endif
|
#endif
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
@@ -11692,7 +11692,7 @@ static int SetEd25519PublicKey(byte* output, ed25519_key* key, int with_header)
|
|||||||
#ifdef WOLFSSL_SMALL_STACK
|
#ifdef WOLFSSL_SMALL_STACK
|
||||||
algo = (byte*)XMALLOC(MAX_ALGO_SZ, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
algo = (byte*)XMALLOC(MAX_ALGO_SZ, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
if (algo == NULL) {
|
if (algo == NULL) {
|
||||||
XFREE(pub, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
XFREE(pub, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
return MEMORY_E;
|
return MEMORY_E;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -11786,7 +11786,7 @@ static int SetEd448PublicKey(byte* output, ed448_key* key, int with_header)
|
|||||||
idx = wc_ed448_export_public(key, pub, &pubSz);
|
idx = wc_ed448_export_public(key, pub, &pubSz);
|
||||||
if (idx != 0) {
|
if (idx != 0) {
|
||||||
#ifdef WOLFSSL_SMALL_STACK
|
#ifdef WOLFSSL_SMALL_STACK
|
||||||
XFREE(pub, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
XFREE(pub, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
#endif
|
#endif
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
@@ -11796,7 +11796,7 @@ static int SetEd448PublicKey(byte* output, ed448_key* key, int with_header)
|
|||||||
#ifdef WOLFSSL_SMALL_STACK
|
#ifdef WOLFSSL_SMALL_STACK
|
||||||
algo = (byte*)XMALLOC(MAX_ALGO_SZ, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
algo = (byte*)XMALLOC(MAX_ALGO_SZ, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
if (algo == NULL) {
|
if (algo == NULL) {
|
||||||
XFREE(pub, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
XFREE(pub, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
return MEMORY_E;
|
return MEMORY_E;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -9238,6 +9238,7 @@ static int wc_PKCS7_DecryptKari(PKCS7* pkcs7, byte* in, word32 inSz,
|
|||||||
|
|
||||||
switch (pkcs7->state) {
|
switch (pkcs7->state) {
|
||||||
case WC_PKCS7_DECRYPT_KARI: {
|
case WC_PKCS7_DECRYPT_KARI: {
|
||||||
|
WC_PKCS7_KARI* kari;
|
||||||
#ifndef NO_PKCS7_STREAM
|
#ifndef NO_PKCS7_STREAM
|
||||||
/* @TODO for now just get full buffer, needs divided up */
|
/* @TODO for now just get full buffer, needs divided up */
|
||||||
if ((ret = wc_PKCS7_AddDataToStream(pkcs7, in, inSz,
|
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;
|
pkiMsgSz = (word32)rc;
|
||||||
#endif
|
#endif
|
||||||
WC_PKCS7_KARI* kari;
|
|
||||||
|
|
||||||
kari = wc_PKCS7_KariNew(pkcs7, WC_PKCS7_DECODE);
|
kari = wc_PKCS7_KariNew(pkcs7, WC_PKCS7_DECODE);
|
||||||
if (kari == NULL)
|
if (kari == NULL)
|
||||||
|
@@ -341,7 +341,7 @@ static int InitSha512(wc_Sha512* sha512)
|
|||||||
#define Transform_Sha512_Len(sha512, len) \
|
#define Transform_Sha512_Len(sha512, len) \
|
||||||
(*Transform_Sha512_Len_p)(sha512, len)
|
(*Transform_Sha512_Len_p)(sha512, len)
|
||||||
|
|
||||||
static void Sha512_SetTransform()
|
static void Sha512_SetTransform(void)
|
||||||
{
|
{
|
||||||
if (transform_check)
|
if (transform_check)
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user