forked from wolfSSL/wolfssl
Merge branch 'FreeRTOS_TCP' of https://github.com/kojo1/wolfssl into freertos-tcp
This commit is contained in:
13
src/io.c
13
src/io.c
@ -77,6 +77,8 @@
|
|||||||
static int errno;
|
static int errno;
|
||||||
#elif defined(WOLFSSL_TIRTOS)
|
#elif defined(WOLFSSL_TIRTOS)
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
#elif defined(FREERTOS_TCP)
|
||||||
|
#include "FreeRTOS_Sockets.h"
|
||||||
#elif defined(WOLFSSL_IAR_ARM)
|
#elif defined(WOLFSSL_IAR_ARM)
|
||||||
/* nothing */
|
/* nothing */
|
||||||
#else
|
#else
|
||||||
@ -178,6 +180,14 @@
|
|||||||
#define SOCKET_EPIPE PICO_ERR_EIO
|
#define SOCKET_EPIPE PICO_ERR_EIO
|
||||||
#define SOCKET_ECONNREFUSED PICO_ERR_ECONNREFUSED
|
#define SOCKET_ECONNREFUSED PICO_ERR_ECONNREFUSED
|
||||||
#define SOCKET_ECONNABORTED PICO_ERR_ESHUTDOWN
|
#define SOCKET_ECONNABORTED PICO_ERR_ESHUTDOWN
|
||||||
|
#elif defined(FREERTOS_TCP)
|
||||||
|
#define SOCKET_EWOULDBLOCK FREERTOS_EWOULDBLOCK
|
||||||
|
#define SOCKET_EAGAIN FREERTOS_EWOULDBLOCK
|
||||||
|
#define SOCKET_ECONNRESET FREERTOS_SOCKET_ERROR
|
||||||
|
#define SOCKET_EINTR FREERTOS_SOCKET_ERROR
|
||||||
|
#define SOCKET_EPIPE FREERTOS_SOCKET_ERROR
|
||||||
|
#define SOCKET_ECONNREFUSED FREERTOS_SOCKET_ERROR
|
||||||
|
#define SOCKET_ECONNABORTED FREERTOS_SOCKET_ERROR
|
||||||
#else
|
#else
|
||||||
#define SOCKET_EWOULDBLOCK EWOULDBLOCK
|
#define SOCKET_EWOULDBLOCK EWOULDBLOCK
|
||||||
#define SOCKET_EAGAIN EAGAIN
|
#define SOCKET_EAGAIN EAGAIN
|
||||||
@ -201,6 +211,9 @@
|
|||||||
#elif defined(WOLFSSL_PICOTCP)
|
#elif defined(WOLFSSL_PICOTCP)
|
||||||
#define SEND_FUNCTION pico_send
|
#define SEND_FUNCTION pico_send
|
||||||
#define RECV_FUNCTION pico_recv
|
#define RECV_FUNCTION pico_recv
|
||||||
|
#elif defined(FREERTOS_TCP)
|
||||||
|
#define RECV_FUNCTION(a,b,c,d) FreeRTOS_recv((Socket_t)(a),(void*)(b), (size_t)(c), (BaseType_t)(d))
|
||||||
|
#define SEND_FUNCTION(a,b,c,d) FreeRTOS_send((Socket_t)(a),(void*)(b), (size_t)(c), (BaseType_t)(d))
|
||||||
#else
|
#else
|
||||||
#define SEND_FUNCTION send
|
#define SEND_FUNCTION send
|
||||||
#define RECV_FUNCTION recv
|
#define RECV_FUNCTION recv
|
||||||
|
@ -102,7 +102,7 @@ int wc_RNG_GenerateByte(WC_RNG* rng, byte* b)
|
|||||||
#include <wincrypt.h>
|
#include <wincrypt.h>
|
||||||
#else
|
#else
|
||||||
#if !defined(NO_DEV_RANDOM) && !defined(CUSTOM_RAND_GENERATE) && \
|
#if !defined(NO_DEV_RANDOM) && !defined(CUSTOM_RAND_GENERATE) && \
|
||||||
!defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_IAR_ARM)
|
!defined(WOLFSSL_GENSEED_FORTEST) && !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_IAR_ARM)
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#ifndef EBSNET
|
#ifndef EBSNET
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -1185,7 +1185,11 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
|
|||||||
|| defined(WOLFSSL_uITRON4) || defined(WOLFSSL_uTKERNEL2)\
|
|| defined(WOLFSSL_uITRON4) || defined(WOLFSSL_uTKERNEL2)\
|
||||||
|| defined(WOLFSSL_GENSEED_FORTEST)
|
|| defined(WOLFSSL_GENSEED_FORTEST)
|
||||||
|
|
||||||
|
#ifndef _MSC_VER
|
||||||
#warning "write a real random seed!!!!, just for testing now"
|
#warning "write a real random seed!!!!, just for testing now"
|
||||||
|
#else
|
||||||
|
#pragma message("Warning: write a real random seed!!!!, just for testing now")
|
||||||
|
#endif
|
||||||
|
|
||||||
int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
|
int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,7 @@ int UnLockMutex(wolfSSL_Mutex *m)
|
|||||||
|
|
||||||
#else /* MULTI_THREAD */
|
#else /* MULTI_THREAD */
|
||||||
|
|
||||||
#if defined(FREERTOS)
|
#if defined(FREERTOS) || defined(FREERTOS_TCP)
|
||||||
|
|
||||||
int InitMutex(wolfSSL_Mutex* m)
|
int InitMutex(wolfSSL_Mutex* m)
|
||||||
{
|
{
|
||||||
|
@ -115,7 +115,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#elif defined(MICRIUM)
|
#elif defined(MICRIUM)
|
||||||
/* do nothing, just don't pick Unix */
|
/* do nothing, just don't pick Unix */
|
||||||
#elif defined(FREERTOS) || defined(WOLFSSL_SAFERTOS)
|
#elif defined(FREERTOS) || defined(FREERTOS_TCP) || defined(WOLFSSL_SAFERTOS)
|
||||||
/* do nothing */
|
/* do nothing */
|
||||||
#elif defined(EBSNET)
|
#elif defined(EBSNET)
|
||||||
/* do nothing */
|
/* do nothing */
|
||||||
|
@ -57,6 +57,9 @@
|
|||||||
/* Uncomment next line if using FreeRTOS */
|
/* Uncomment next line if using FreeRTOS */
|
||||||
/* #define FREERTOS */
|
/* #define FREERTOS */
|
||||||
|
|
||||||
|
/* Uncomment next line if using FreeRTOS+ TCP */
|
||||||
|
/* #define FREERTOS_TCP */
|
||||||
|
|
||||||
/* Uncomment next line if using FreeRTOS Windows Simulator */
|
/* Uncomment next line if using FreeRTOS Windows Simulator */
|
||||||
/* #define FREERTOS_WINSIM */
|
/* #define FREERTOS_WINSIM */
|
||||||
|
|
||||||
@ -305,7 +308,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/* Micrium will use Visual Studio for compilation but not the Win32 API */
|
/* Micrium will use Visual Studio for compilation but not the Win32 API */
|
||||||
#if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) \
|
#if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) && !defined(FREERTOS_TCP)\
|
||||||
&& !defined(EBSNET) && !defined(WOLFSSL_EROAD)
|
&& !defined(EBSNET) && !defined(WOLFSSL_EROAD)
|
||||||
#define USE_WINDOWS_API
|
#define USE_WINDOWS_API
|
||||||
#endif
|
#endif
|
||||||
@ -406,6 +409,24 @@ static char *fgets(char *buff, int sz, FILE *fp)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef FREERTOS_TCP
|
||||||
|
|
||||||
|
#if !defined(NO_WOLFSSL_MEMORY) && !defined(XMALLOC_USER)
|
||||||
|
#define XMALLOC(s, h, type) pvPortMalloc((s))
|
||||||
|
#define XFREE(p, h, type) vPortFree((p))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define WOLFSSL_GENSEED_FORTEST
|
||||||
|
|
||||||
|
#define NO_WOLFSSL_DIR
|
||||||
|
#define NO_WRITEV
|
||||||
|
#define WOLFSSL_HAVE_MIN
|
||||||
|
#define USE_FAST_MATH
|
||||||
|
#define TFM_TIMING_REGISTANT
|
||||||
|
#define NO_MAIN_DRIVER
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef WOLFSSL_TIRTOS
|
#ifdef WOLFSSL_TIRTOS
|
||||||
#define SIZEOF_LONG_LONG 8
|
#define SIZEOF_LONG_LONG 8
|
||||||
#define NO_WRITEV
|
#define NO_WRITEV
|
||||||
|
@ -155,7 +155,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/* Micrium will use Visual Studio for compilation but not the Win32 API */
|
/* Micrium will use Visual Studio for compilation but not the Win32 API */
|
||||||
#if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) \
|
#if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) && !defined(FREERTOS_TCP) \
|
||||||
&& !defined(EBSNET)
|
&& !defined(EBSNET)
|
||||||
#define USE_WINDOWS_API
|
#define USE_WINDOWS_API
|
||||||
#endif
|
#endif
|
||||||
@ -180,7 +180,7 @@
|
|||||||
#elif !defined(MICRIUM_MALLOC) && !defined(EBSNET) \
|
#elif !defined(MICRIUM_MALLOC) && !defined(EBSNET) \
|
||||||
&& !defined(WOLFSSL_SAFERTOS) && !defined(FREESCALE_MQX) \
|
&& !defined(WOLFSSL_SAFERTOS) && !defined(FREESCALE_MQX) \
|
||||||
&& !defined(FREESCALE_KSDK_MQX) && !defined(FREESCALE_FREE_RTOS) \
|
&& !defined(FREESCALE_KSDK_MQX) && !defined(FREESCALE_FREE_RTOS) \
|
||||||
&& !defined(WOLFSSL_LEANPSK) && !defined(FREERTOS) \
|
&& !defined(WOLFSSL_LEANPSK) && !defined(FREERTOS) && !defined(FREERTOS_TCP)\
|
||||||
&& !defined(WOLFSSL_uITRON4) && !defined(WOLFSSL_uTKERNEL2)
|
&& !defined(WOLFSSL_uITRON4) && !defined(WOLFSSL_uTKERNEL2)
|
||||||
/* default C runtime, can install different routines at runtime via cbs */
|
/* default C runtime, can install different routines at runtime via cbs */
|
||||||
#include <wolfssl/wolfcrypt/memory.h>
|
#include <wolfssl/wolfcrypt/memory.h>
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#elif defined(MICRIUM)
|
#elif defined(MICRIUM)
|
||||||
/* do nothing, just don't pick Unix */
|
/* do nothing, just don't pick Unix */
|
||||||
#elif defined(FREERTOS) || defined(WOLFSSL_SAFERTOS)
|
#elif defined(FREERTOS) || defined(FREERTOS_TCP) || defined(WOLFSSL_SAFERTOS)
|
||||||
/* do nothing */
|
/* do nothing */
|
||||||
#elif defined(EBSNET)
|
#elif defined(EBSNET)
|
||||||
/* do nothing */
|
/* do nothing */
|
||||||
@ -87,8 +87,12 @@
|
|||||||
typedef int wolfSSL_Mutex;
|
typedef int wolfSSL_Mutex;
|
||||||
#else /* MULTI_THREADED */
|
#else /* MULTI_THREADED */
|
||||||
/* FREERTOS comes first to enable use of FreeRTOS Windows simulator only */
|
/* FREERTOS comes first to enable use of FreeRTOS Windows simulator only */
|
||||||
#ifdef FREERTOS
|
#if defined(FREERTOS)
|
||||||
typedef xSemaphoreHandle wolfSSL_Mutex;
|
typedef xSemaphoreHandle wolfSSL_Mutex;
|
||||||
|
#elif defined(FREERTOS_TCP)
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "semphr.h"
|
||||||
|
typedef SemaphoreHandle_t wolfSSL_Mutex;
|
||||||
#elif defined(WOLFSSL_SAFERTOS)
|
#elif defined(WOLFSSL_SAFERTOS)
|
||||||
typedef struct wolfSSL_Mutex {
|
typedef struct wolfSSL_Mutex {
|
||||||
signed char mutexBuffer[portQUEUE_OVERHEAD_BYTES];
|
signed char mutexBuffer[portQUEUE_OVERHEAD_BYTES];
|
||||||
|
Reference in New Issue
Block a user