Fixes to resolve possible build issues with SafeRTOS.

* Support for building `WOLFSSL_SAFERTOS` without heap.
* Allows `XSTRNCASECMP` macro to be customized.
* USER_TIME supports checks for existing `strct tm` and `time_t`.
This commit is contained in:
David Garske 2019-01-18 10:02:20 -08:00
parent d07cf53bb1
commit f2732a4ecd
3 changed files with 20 additions and 8 deletions

View File

@ -784,11 +784,17 @@ extern void uITRON4_free(void *p) ;
#ifndef SINGLE_THREADED #ifndef SINGLE_THREADED
#include "SafeRTOS/semphr.h" #include "SafeRTOS/semphr.h"
#endif #endif
#ifndef WOLFSSL_NO_MALLOC
#include "SafeRTOS/heap.h" #include "SafeRTOS/heap.h"
#define XMALLOC(s, h, type) pvPortMalloc((s)) #endif
#define XFREE(p, h, type) vPortFree((p)) #if !defined(XMALLOC_USER) && !defined(NO_WOLFSSL_MEMORY) && \
#define XREALLOC(p, n, h, t) pvPortRealloc((p), (n)) !defined(WOLFSSL_STATIC_MEMORY)
#define XMALLOC(s, h, type) pvPortMalloc((s))
#define XFREE(p, h, type) vPortFree((p))
#endif
#if !defined(USE_FAST_MATH) || defined(HAVE_ED25519)
#define XREALLOC(p, n, h, t) pvPortRealloc((p), (n))
#endif
#endif #endif
#ifdef WOLFSSL_LOW_MEMORY #ifdef WOLFSSL_LOW_MEMORY

View File

@ -345,6 +345,7 @@
#define XSTRSEP(s1,d) strsep((s1),(d)) #define XSTRSEP(s1,d) strsep((s1),(d))
#endif #endif
#ifndef XSTRNCASECMP
#if defined(MICROCHIP_PIC32) || defined(WOLFSSL_TIRTOS) #if defined(MICROCHIP_PIC32) || defined(WOLFSSL_TIRTOS)
/* XC32 does not support strncasecmp, so use case sensitive one */ /* XC32 does not support strncasecmp, so use case sensitive one */
#define XSTRNCASECMP(s1,s2,n) strncmp((s1),(s2),(n)) #define XSTRNCASECMP(s1,s2,n) strncmp((s1),(s2),(n))
@ -357,6 +358,7 @@
#endif #endif
#define XSTRNCASECMP(s1,s2,n) strncasecmp((s1),(s2),(n)) #define XSTRNCASECMP(s1,s2,n) strncasecmp((s1),(s2),(n))
#endif #endif
#endif /* !XSTRNCASECMP */
/* snprintf is used in asn.c for GetTimeString, PKCS7 test, and when /* snprintf is used in asn.c for GetTimeString, PKCS7 test, and when
debugging is turned on */ debugging is turned on */

View File

@ -390,8 +390,12 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
time_t XTIME(time_t * timer) {} time_t XTIME(time_t * timer) {}
*/ */
#define WOLFSSL_GMTIME #define WOLFSSL_GMTIME
#define USE_WOLF_TM #ifndef HAVE_TM_TYPE
#define USE_WOLF_TIME_T #define USE_WOLF_TM
#endif
#ifndef HAVE_TIME_T_TYPE
#define USE_WOLF_TIME_T
#endif
#elif defined(TIME_OVERRIDES) #elif defined(TIME_OVERRIDES)
/* Override XTIME() and XGMTIME() functionality. /* Override XTIME() and XGMTIME() functionality.
@ -491,7 +495,7 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
#ifdef TIME_T_NOT_LONG #ifdef TIME_T_NOT_LONG
/* one old reference to TIME_T_NOT_LONG in GCC-ARM example README /* one old reference to TIME_T_NOT_LONG in GCC-ARM example README
* this keeps support for the old macro name */ * this keeps support for the old macro name */
#undef TIME_T_NOT_64BIT #undef TIME_T_NOT_64BIT
#define TIME_T_NOT_64BIT #define TIME_T_NOT_64BIT
#endif #endif