mirror of https://github.com/wolfSSL/wolfssl.git
Merge pull request #272 from cconlon/ksdk-fixes
Update support for Freescale KSDK 1.3.0, fix Freescale+FreeRTOS buildpull/273/head
commit
18c25b5d04
|
@ -2816,7 +2816,7 @@ ProtocolVersion MakeDTLSv1_2(void)
|
|||
return (word32) mqxTime.SECONDS;
|
||||
}
|
||||
|
||||
#elif defined(FREESCALE_KSDK_BM)
|
||||
#elif defined(FREESCALE_KSDK_BM) || defined(FREESCALE_FREE_RTOS)
|
||||
|
||||
#include "fsl_pit_driver.h"
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <wolfssl/internal.h>
|
||||
#include <wolfssl/error-ssl.h>
|
||||
#if defined(SHOW_SECRETS) || defined(CHACHA_AEAD_TEST)
|
||||
#ifdef FREESCALE_MQX
|
||||
#if defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX)
|
||||
#if MQX_USE_IO_OLD
|
||||
#include <fio.h>
|
||||
#else
|
||||
|
|
|
@ -117,7 +117,7 @@
|
|||
#define XTIME(t1) mqx_time((t1))
|
||||
#define XGMTIME(c, t) mqx_gmtime((c), (t))
|
||||
#define XVALIDATE_DATE(d, f, t) ValidateDate((d), (f), (t))
|
||||
#elif defined(FREESCALE_KSDK_BM)
|
||||
#elif defined(FREESCALE_KSDK_BM) || defined(FREESCALE_FREE_RTOS)
|
||||
#include <time.h>
|
||||
#define XTIME(t1) ksdk_time((t1))
|
||||
#define XGMTIME(c, t) gmtime((c))
|
||||
|
@ -373,11 +373,7 @@ struct tm* mqx_gmtime(const time_t* clock, struct tm* tmpTime)
|
|||
|
||||
#endif /* FREESCALE_MQX */
|
||||
|
||||
#ifdef FREESCALE_KSDK_BM
|
||||
|
||||
/* setting for PIT timer */
|
||||
#define PIT_INSTANCE 0
|
||||
#define PIT_CHANNEL 0
|
||||
#if defined(FREESCALE_KSDK_BM) || defined(FREESCALE_FREE_RTOS)
|
||||
|
||||
#include "fsl_pit_driver.h"
|
||||
|
||||
|
@ -3010,7 +3006,8 @@ int ValidateDate(const byte* date, byte format, int dateType)
|
|||
int diffHH = 0 ; int diffMM = 0 ;
|
||||
int diffSign = 0 ;
|
||||
|
||||
#if defined(FREESCALE_MQX) || defined(TIME_OVERRIDES) || defined(NEED_TMP_TIME)
|
||||
#if defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX) || \
|
||||
defined(TIME_OVERRIDES) || defined(NEED_TMP_TIME)
|
||||
struct tm tmpTimeStorage;
|
||||
tmpTime = &tmpTimeStorage;
|
||||
#else
|
||||
|
@ -5999,7 +5996,7 @@ static int CopyValidity(byte* output, Cert* cert)
|
|||
/* for systems where mktime() doesn't normalize fully */
|
||||
static void RebuildTime(time_t* in, struct tm* out)
|
||||
{
|
||||
#ifdef FREESCALE_MQX
|
||||
#if defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX)
|
||||
out = localtime_r(in, out);
|
||||
#else
|
||||
(void)in;
|
||||
|
@ -6025,7 +6022,8 @@ static int SetValidity(byte* output, int daysValid)
|
|||
struct tm* tmpTime = NULL;
|
||||
struct tm local;
|
||||
|
||||
#if defined(FREESCALE_MQX) || defined(TIME_OVERRIDES) || defined(NEED_TMP_TIME)
|
||||
#if defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX) || \
|
||||
defined(TIME_OVERRIDES) || defined(NEED_TMP_TIME)
|
||||
/* for use with gmtime_r */
|
||||
struct tm tmpTimeStorage;
|
||||
tmpTime = &tmpTimeStorage;
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#endif
|
||||
|
||||
#ifdef SHOW_GEN
|
||||
#ifdef FREESCALE_MQX
|
||||
#if defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX)
|
||||
#if MQX_USE_IO_OLD
|
||||
#include <fio.h>
|
||||
#else
|
||||
|
|
|
@ -89,7 +89,7 @@ void wolfSSL_Debugging_OFF(void)
|
|||
|
||||
#ifdef DEBUG_WOLFSSL
|
||||
|
||||
#ifdef FREESCALE_MQX
|
||||
#if defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX)
|
||||
#if MQX_USE_IO_OLD
|
||||
#include <fio.h>
|
||||
#else
|
||||
|
|
|
@ -114,10 +114,6 @@ int wc_RNG_GenerateByte(WC_RNG* rng, byte* b)
|
|||
#ifndef EBSNET
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#elif defined(FREESCALE_TRNG)
|
||||
#define TRNG_INSTANCE (0)
|
||||
#include "fsl_device_registers.h"
|
||||
#include "fsl_trng_driver.h"
|
||||
#else
|
||||
/* include headers that may be needed to get good seed */
|
||||
#endif
|
||||
|
@ -1188,6 +1184,15 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#elif defined(FREESCALE_RNGA)
|
||||
|
||||
int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
|
||||
{
|
||||
RNGA_DRV_GetRandomData(RNGA_INSTANCE, output, sz);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
#warning "write a real random seed!!!!, just for testing now"
|
||||
|
||||
|
|
|
@ -138,7 +138,8 @@ int UnLockMutex(wolfSSL_Mutex *m)
|
|||
|
||||
#else /* MULTI_THREAD */
|
||||
|
||||
#if defined(FREERTOS) || defined(FREERTOS_TCP)
|
||||
#if defined(FREERTOS) || defined(FREERTOS_TCP) || \
|
||||
defined(FREESCALE_FREE_RTOS)
|
||||
|
||||
int InitMutex(wolfSSL_Mutex* m)
|
||||
{
|
||||
|
@ -390,7 +391,7 @@ int UnLockMutex(wolfSSL_Mutex *m)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#elif defined(FREESCALE_MQX)
|
||||
#elif defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX)
|
||||
|
||||
int InitMutex(wolfSSL_Mutex* m)
|
||||
{
|
||||
|
|
|
@ -119,7 +119,7 @@
|
|||
#include "cavium_ioctl.h"
|
||||
#endif
|
||||
|
||||
#ifdef FREESCALE_MQX
|
||||
#if defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX)
|
||||
#include <mqx.h>
|
||||
#include <stdlib.h>
|
||||
#if MQX_USE_IO_OLD
|
||||
|
|
|
@ -121,6 +121,8 @@
|
|||
/* do nothing */
|
||||
#elif defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX)
|
||||
/* do nothing */
|
||||
#elif defined(FREESCALE_FREE_RTOS)
|
||||
#include "fsl_os_abstraction.h"
|
||||
#elif defined(WOLFSSL_uITRON4)
|
||||
/* do nothing */
|
||||
#elif defined(WOLFSSL_uTKERNEL2)
|
||||
|
|
|
@ -610,6 +610,10 @@ static char *fgets(char *buff, int sz, FILE *fp)
|
|||
#define XMALLOC(s, h, t) (void *)_mem_alloc_system((s))
|
||||
#define XFREE(p, h, t) {void* xp = (p); if ((xp)) _mem_free((xp));}
|
||||
#define XREALLOC(p, n, h, t) _mem_realloc((p), (n)) /* since MQX 4.1.2 */
|
||||
|
||||
#define MQX_FILE_PTR FILE *
|
||||
#define IO_SEEK_SET SEEK_SET
|
||||
#define IO_SEEK_END SEEK_END
|
||||
#endif
|
||||
|
||||
#ifdef FREESCALE_KSDK_BM
|
||||
|
@ -624,9 +628,8 @@ static char *fgets(char *buff, int sz, FILE *fp)
|
|||
#define FREESCALE_COMMON
|
||||
#define NO_FILESYSTEM
|
||||
#define NO_MAIN_DRIVER
|
||||
#define XMALLOC(s, h, t) OSA_MemAlloc(s);
|
||||
#define XMALLOC(s, h, t) OSA_MemAlloc(s);(void)h;(void)t;
|
||||
#define XFREE(p, h, t) {void* xp = (p); if((xp)) OSA_MemFree((xp));}
|
||||
#define XREALLOC(p, n, h, t) ksdk_realloc((p), (n), (h), (t));
|
||||
#ifdef FREESCALE_KSDK_BM
|
||||
#error Baremetal and FreeRTOS cannot be both enabled at the same time!
|
||||
#endif
|
||||
|
@ -638,24 +641,46 @@ static char *fgets(char *buff, int sz, FILE *fp)
|
|||
|
||||
#ifdef FREESCALE_COMMON
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
|
||||
/* disable features */
|
||||
#define NO_WRITEV
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_RABBIT
|
||||
#define NO_WOLFSSL_DIR
|
||||
|
||||
/* enable features */
|
||||
#define USE_FAST_MATH
|
||||
|
||||
/* memory reduction */
|
||||
#define TFM_TIMING_RESISTANT
|
||||
|
||||
#if FSL_FEATURE_SOC_ENET_COUNT == 0
|
||||
#define WOLFSSL_USER_IO
|
||||
/* setting for PIT timer */
|
||||
#define PIT_INSTANCE 0
|
||||
#define PIT_CHANNEL 0
|
||||
|
||||
/* CW GCC workaround. gmtime() is not available */
|
||||
#if defined(__GNUC__)
|
||||
#define USER_TIME
|
||||
#endif
|
||||
|
||||
#if defined(FREESCALE_KSDK_MQX) || defined(FREESCALE_KSDK_BM) || \
|
||||
defined(FREESCALE_FREE_RTOS)
|
||||
#include "fsl_device_registers.h"
|
||||
#endif
|
||||
|
||||
/* random seed */
|
||||
#define NO_OLD_RNGNAME
|
||||
#if FSL_FEATURE_SOC_TRNG_COUNT > 0
|
||||
#if (FSL_FEATURE_SOC_TRNG_COUNT > 0)
|
||||
#define FREESCALE_TRNG
|
||||
#define TRNG_INSTANCE (0)
|
||||
#elif (FSL_FEATURE_SOC_RNG_COUNT > 0)
|
||||
#include "fsl_rnga_driver.h"
|
||||
#define FREESCALE_RNGA
|
||||
#define RNGA_INSTANCE (0)
|
||||
#elif !defined(FREESCALE_KSDK_BM) && !defined(FREESCALE_FREE_RTOS)
|
||||
#define FREESCALE_K70_RNGA
|
||||
/* defaulting to K70 RNGA, user should change if different */
|
||||
/* #define FREESCALE_K53_RNGB */
|
||||
#define FREESCALE_K70_RNGA
|
||||
#endif
|
||||
|
||||
/* HW crypto */
|
||||
|
|
|
@ -198,7 +198,7 @@ WOLFSSL_API int wolfCrypt_Init(void);
|
|||
#define XFCLOSE fs_close
|
||||
#define XSEEK_END 0
|
||||
#define XBADFILE NULL
|
||||
#elif defined(FREESCALE_MQX)
|
||||
#elif defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX)
|
||||
#define XFILE MQX_FILE_PTR
|
||||
#define XFOPEN fopen
|
||||
#define XFSEEK fseek
|
||||
|
|
Loading…
Reference in New Issue