no realloc, adjustable static test size, fsl RTC

This commit is contained in:
JacobBarthelmeh
2022-08-26 09:15:33 -06:00
parent 60437bba6e
commit b3fa6f654e
5 changed files with 32 additions and 2 deletions

View File

@ -1286,7 +1286,9 @@ static THREAD_LS_T byte* bench_key = NULL;
static THREAD_LS_T byte* bench_iv = NULL;
#ifdef WOLFSSL_STATIC_MEMORY
#ifdef BENCH_EMBEDDED
#ifdef WOLFSSL_STATIC_MEMORY_TEST_SZ
static byte gBenchMemory[WOLFSSL_STATIC_MEMORY_TEST_SZ];
#elif defined(BENCH_EMBEDDED)
static byte gBenchMemory[50000];
#else
static byte gBenchMemory[400000];

View File

@ -7497,12 +7497,22 @@ static int PopulateRSAEvpPkeyDer(WOLFSSL_EVP_PKEY *pkey)
return WOLFSSL_FAILURE;
}
#ifdef WOLFSSL_NO_REALLOC
derBuf = (byte*)XMALLOC(derSz, pkey->heap, DYNAMIC_TYPE_DER);
if (derBuf != NULL) {
XMEMCPY(derBuf, pkey->pkey.ptr, pkey->pkey_sz);
XFREE(pkey->pkey.ptr, pkey->heap, DYNAMIC_TYPE_DER);
pkey->pkey.ptr = NULL;
}
#else
derBuf = (byte*)XREALLOC(pkey->pkey.ptr, derSz,
pkey->heap, DYNAMIC_TYPE_DER);
#endif
if (derBuf == NULL) {
WOLFSSL_MSG("PopulateRSAEvpPkeyDer malloc failed");
return WOLFSSL_FAILURE;
}
/* Old pointer is invalid from this point on */
pkey->pkey.ptr = (char*)derBuf;

View File

@ -2462,6 +2462,15 @@ time_t deos_time(time_t* timer)
}
#endif /* WOLFSSL_DEOS */
#if defined(FREESCALE_RTC)
#include "fsl_rtc.h"
time_t fsl_time(time_t* t)
{
*t = RTC_GetSecondsTimerCount(RTC);
return *t;
}
#endif
#if defined(MICRIUM)
time_t micrium_time(time_t* timer)

View File

@ -626,7 +626,9 @@ static void myFipsCb(int ok, int err, const char* hash)
#endif /* HAVE_FIPS && !WOLFSSL_LINUXKM */
#ifdef WOLFSSL_STATIC_MEMORY
#ifdef BENCH_EMBEDDED
#if defined(WOLFSSL_STATIC_MEMORY_TEST_SZ)
static byte gTestMemory[WOLFSSL_STATIC_MEMORY_TEST_SZ];
#elif defined(BENCH_EMBEDDED)
static byte gTestMemory[14000];
#elif defined(WOLFSSL_CERT_EXT)
static byte gTestMemory[140000];

View File

@ -779,6 +779,13 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
#define XTIME(t1) pic32_time((t1))
#define XGMTIME(c, t) gmtime((c))
#elif defined(FREESCALE_RTC)
#include <time.h>
#include "fsl_rtc.h"
#ifndef XTIME
#define XTIME(t1) fsl_time((t1))
#endif
#elif defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX)
#ifdef FREESCALE_MQX_4_0
#include <time.h>