create WOLFSSL_NUCLEUS_1_2 for older 1.2 version

pull/1686/head
Chris Conlon 2018-07-19 11:43:48 -06:00
parent 213f79f06f
commit 7f19f914c0
8 changed files with 26 additions and 18 deletions

View File

@ -6067,7 +6067,7 @@ ProtocolVersion MakeDTLSv1_2(void)
return (word32)(uTaskerSystemTick / TICK_RESOLUTION);
}
#elif defined(WOLFSSL_NUCLEUS)
#elif defined(WOLFSSL_NUCLEUS_1_2)
#define NU_TICKS_PER_SECOND 100

View File

@ -143,6 +143,7 @@ int wc_RNG_GenerateByte(WC_RNG* rng, byte* b)
#elif defined(WOLFSSL_EMBOS)
#elif defined(MICRIUM)
#elif defined(WOLFSSL_NUCLEUS)
#elif defined(WOLFSSL_PB)
#else
/* include headers that may be needed to get good seed */
#include <fcntl.h>

View File

@ -287,7 +287,7 @@ static WC_INLINE void AddLength(wc_Sha* sha, word32 len)
#define f3(x,y,z) (((x)&(y))|((z)&((x)|(y))))
#define f4(x,y,z) ((x)^(y)^(z))
#ifdef WOLFSSL_NUCLEUS
#ifdef WOLFSSL_NUCLEUS_1_2
/* nucleus.h also defines R1-R4 */
#undef R1
#undef R2

View File

@ -221,7 +221,7 @@ int wolfCrypt_Cleanup(void)
}
#if !defined(NO_FILESYSTEM) && !defined(NO_WOLFSSL_DIR) && \
!defined(WOLFSSL_NUCLEUS)
!defined(WOLFSSL_NUCLEUS) && !defined(WOLFSSL_NUCLEUS_1_2)
/* File Handling Helpers */
/* returns 0 if file found, -1 if no files or negative error */
@ -1255,7 +1255,7 @@ int wolfSSL_CryptHwMutexUnLock(void) {
return ret;
}
#elif defined(WOLFSSL_NUCLEUS)
#elif defined(WOLFSSL_NUCLEUS_1_2)
int wc_InitMutex(wolfSSL_Mutex* m)
{
@ -1526,7 +1526,7 @@ char* mystrnstr(const char* s1, const char* s2, unsigned int n)
#endif
/* custom memory wrappers */
#ifdef WOLFSSL_NUCLEUS
#ifdef WOLFSSL_NUCLEUS_1_2
/* system memory pool */
extern NU_MEMORY_POOL System_Memory;
@ -1583,7 +1583,7 @@ char* mystrnstr(const char* s1, const char* s2, unsigned int n)
NU_Deallocate_Memory(ptr);
}
#endif /* WOLFSSL_NUCLEUS */
#endif /* WOLFSSL_NUCLEUS_1_2 */
#if defined(WOLFSSL_TI_CRYPT) || defined(WOLFSSL_TI_HASH)
#include <wolfcrypt/src/port/ti/ti-ccm.c> /* initialize and Mutex for TI Crypt Engine */

View File

@ -159,7 +159,7 @@
/* do nothing */
#elif defined(INTIME_RTOS)
#include <rt.h>
#elif defined(WOLFSSL_NUCLEUS)
#elif defined(WOLFSSL_NUCLEUS_1_2)
/* do nothing */
#else
#ifndef SINGLE_THREADED

View File

@ -162,8 +162,8 @@
/* Uncomment next line if building for using XILINX */
/* #define WOLFSSL_XILINX */
/* Uncomment next line if building for Nucleus */
/* #define WOLFSSL_NUCLEUS */
/* Uncomment next line if building for Nucleus 1.2 */
/* #define WOLFSSL_NUCLEUS_1_2 */
#include <wolfssl/wolfcrypt/visibility.h>
@ -450,7 +450,13 @@
#include "wolfssl_chibios.h"
#endif
#ifdef WOLFSSL_NUCLEUS
#ifdef WOLFSSL_PB
/* PB is using older 1.2 version of Nucleus */
#undef WOLFSSL_NUCLEUS
#define WOLFSSL_NUCLEUS_1_2
#endif
#ifdef WOLFSSL_NUCLEUS_1_2
#define NO_WRITEV
#define NO_WOLFSSL_DIR

View File

@ -97,7 +97,7 @@
#elif defined(INTIME_RTOS)
#include <rt.h>
#include <io.h>
#elif defined(WOLFSSL_NUCLEUS)
#elif defined(WOLFSSL_NUCLEUS_1_2)
/* NU_DEBUG needed struct access in nucleus_realloc */
#define NU_DEBUG
#include "plus/nucleus.h"
@ -173,7 +173,7 @@
typedef mutex_t * wolfSSL_Mutex;
#elif defined(INTIME_RTOS)
typedef RTHANDLE wolfSSL_Mutex;
#elif defined(WOLFSSL_NUCLEUS)
#elif defined(WOLFSSL_NUCLEUS_1_2)
typedef NU_SEMAPHORE wolfSSL_Mutex;
#else
#error Need a mutex type in multithreaded mode
@ -280,7 +280,7 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
#define XSEEK_END FS_SEEK_END
#define XBADFILE NULL
#define XFGETS(b,s,f) -2 /* Not ported yet */
#elif defined(WOLFSSL_NUCLEUS)
#elif defined(WOLFSSL_NUCLEUS_1_2)
#include "fal/inc/fal.h"
#define XFILE FILE*
#define XFOPEN fopen
@ -313,7 +313,7 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
#define XFGETS fgets
#if !defined(USE_WINDOWS_API) && !defined(NO_WOLFSSL_DIR)\
&& !defined(WOLFSSL_NUCLEUS)
&& !defined(WOLFSSL_NUCLEUS) && !defined(WOLFSSL_NUCLEUS_1_2)
#include <dirent.h>
#include <unistd.h>
#include <sys/stat.h>
@ -327,7 +327,8 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
#define MAX_PATH 256
#endif
#if !defined(NO_WOLFSSL_DIR) && !defined(WOLFSSL_NUCLEUS)
#if !defined(NO_WOLFSSL_DIR) && !defined(WOLFSSL_NUCLEUS) && \
!defined(WOLFSSL_NUCLEUS_1_2)
typedef struct ReadDirCtx {
#ifdef USE_WINDOWS_API
WIN32_FIND_DATAA FindFileData;

View File

@ -80,7 +80,7 @@
#elif defined(WOLFSSL_VXWORKS)
#include <sockLib.h>
#include <errno.h>
#elif defined(WOLFSSL_NUCLEUS)
#elif defined(WOLFSSL_NUCLEUS_1_2)
#include <externs.h>
#include <errno.h>
#elif defined(WOLFSSL_ATMEL)
@ -201,7 +201,7 @@
#define SOCKET_EPIPE FREERTOS_SOCKET_ERROR
#define SOCKET_ECONNREFUSED FREERTOS_SOCKET_ERROR
#define SOCKET_ECONNABORTED FREERTOS_SOCKET_ERROR
#elif defined(WOLFSSL_NUCLEUS)
#elif defined(WOLFSSL_NUCLEUS_1_2)
#define SOCKET_EWOULDBLOCK NU_WOULD_BLOCK
#define SOCKET_EAGAIN NU_WOULD_BLOCK
#define SOCKET_ECONNRESET NU_NOT_CONNECTED
@ -255,7 +255,7 @@
#elif defined(WOLFSSL_VXWORKS)
#define SEND_FUNCTION send
#define RECV_FUNCTION recv
#elif defined(WOLFSSL_NUCLEUS)
#elif defined(WOLFSSL_NUCLEUS_1_2)
#define SEND_FUNCTION NU_Send
#define RECV_FUNCTION NU_Recv
#else