EBSnet RTIP support

This commit is contained in:
Chris Conlon 2012-08-13 17:10:05 -06:00
parent bfd510b919
commit 7ec04c16b6
8 changed files with 121 additions and 17 deletions

View File

@ -41,7 +41,9 @@
#else #else
#ifndef NO_DEV_RANDOM #ifndef NO_DEV_RANDOM
#include <fcntl.h> #include <fcntl.h>
#ifndef EBSNET
#include <unistd.h> #include <unistd.h>
#endif
#else #else
/* include headers that may be needed to get good seed */ /* include headers that may be needed to get good seed */
#endif #endif
@ -101,7 +103,7 @@ int GenerateSeed(OS_Seed* os, byte* output, word32 sz)
} }
#elif defined(THREADX) #elif defined(THREADX) || defined(EBSNET)
#include "rtprand.h" /* rtp_rand () */ #include "rtprand.h" /* rtp_rand () */
#include "rtptime.h" /* rtp_get_system_msec() */ #include "rtptime.h" /* rtp_get_system_msec() */

View File

@ -51,6 +51,9 @@
/* Uncomment next line if using FreeRTOS Windows Simulator */ /* Uncomment next line if using FreeRTOS Windows Simulator */
/* #define FREERTOS_WINSIM */ /* #define FREERTOS_WINSIM */
/* Uncomment next line if using RTIP */
/* #define EBSNET */
/* Uncomment next line if using lwip */ /* Uncomment next line if using lwip */
/* #define CYASSL_LWIP */ /* #define CYASSL_LWIP */
@ -103,6 +106,39 @@
#endif #endif
#endif #endif
#ifdef EBSNET
#include "rtip.h"
/* #define DEBUG_CYASSL */
#define NO_CYASSL_DIR /* tbd */
#if (POLLOS)
#define SINGLE_THREADED
#endif
#if (RTPLATFORM)
#if (!RTP_LITTLE_ENDIAN)
#define BIG_ENDIAN_ORDER
#endif
#else
#if (!KS_LITTLE_ENDIAN)
#define BIG_ENDIAN_ORDER
#endif
#endif
#if (WINMSP3)
#undef SIZEOF_LONG
#define SIZEOF_LONG_LONG 8
#else
#sslpro: settings.h - please implement SIZEOF_LONG and SIZEOF_LONG_LONG
#endif
#define XMALLOC(s, h, type) ((void *)rtp_malloc((s), SSL_PRO_MALLOC))
#define XFREE(p, h, type) (rtp_free(p))
#define XREALLOC(p, n, h, t) realloc((p), (n))
#endif /* EBSNET */
#ifdef CYASSL_GAME_BUILD #ifdef CYASSL_GAME_BUILD
#define SIZEOF_LONG_LONG 8 #define SIZEOF_LONG_LONG 8
#if defined(__PPU) || defined(__XENON) #if defined(__PPU) || defined(__XENON)

View File

@ -132,7 +132,8 @@ enum {
/* 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(EBSNET)
#define USE_WINDOWS_API #define USE_WINDOWS_API
#endif #endif
@ -147,7 +148,7 @@ enum {
extern void *XMALLOC(size_t n, void* heap, int type); extern void *XMALLOC(size_t n, void* heap, int type);
extern void *XREALLOC(void *p, size_t n, void* heap, int type); extern void *XREALLOC(void *p, size_t n, void* heap, int type);
extern void XFREE(void *p, void* heap, int type); extern void XFREE(void *p, void* heap, int type);
#elif !defined(MICRIUM_MALLOC) #elif !defined(MICRIUM_MALLOC) && !defined(EBSNET)
/* default C runtime, can install different routines at runtime */ /* default C runtime, can install different routines at runtime */
#include <cyassl/ctaocrypt/memory.h> #include <cyassl/ctaocrypt/memory.h>
#define XMALLOC(s, h, t) CyaSSL_Malloc((s)) #define XMALLOC(s, h, t) CyaSSL_Malloc((s))

View File

@ -71,6 +71,8 @@
/* do nothing, just don't pick Unix */ /* do nothing, just don't pick Unix */
#elif defined(FREERTOS) #elif defined(FREERTOS)
/* do nothing */ /* do nothing */
#elif defined(EBSNET)
/* do nothing */
#else #else
#ifndef SINGLE_THREADED #ifndef SINGLE_THREADED
#define CYASSL_PTHREADS #define CYASSL_PTHREADS
@ -678,6 +680,8 @@ struct CYASSL_CIPHER {
typedef TX_MUTEX CyaSSL_Mutex; typedef TX_MUTEX CyaSSL_Mutex;
#elif defined(MICRIUM) #elif defined(MICRIUM)
typedef OS_MUTEX CyaSSL_Mutex; typedef OS_MUTEX CyaSSL_Mutex;
#elif defined(EBSNET)
typedef RTP_MUTEX CyaSSL_Mutex;
#else #else
#error Need a mutex type in multithreaded mode #error Need a mutex type in multithreaded mode
#endif /* USE_WINDOWS_API */ #endif /* USE_WINDOWS_API */

View File

@ -7098,5 +7098,35 @@ int UnLockMutex(CyaSSL_Mutex* m)
} }
#elif defined(EBSNET)
int InitMutex(CyaSSL_Mutex* m)
{
if (rtp_sig_mutex_alloc(m, "CyaSSL Mutex") == -1)
return BAD_MUTEX_ERROR;
else
return 0;
}
int FreeMutex(CyaSSL_Mutex* m)
{
rtp_sig_mutex_free(*m);
return 0;
}
int LockMutex(CyaSSL_Mutex* m)
{
if (rtp_sig_mutex_claim_timed(*m, RTIP_INF) == 0)
return 0;
else
return BAD_MUTEX_ERROR;
}
int UnlockMutex(CyaSSL_Mutex* m)
{
rtp_sig_mutex_release(*m);
return 0;
}
#endif /* USE_WINDOWS_API */ #endif /* USE_WINDOWS_API */
#endif /* SINGLE_THREADED */ #endif /* SINGLE_THREADED */

View File

@ -49,9 +49,11 @@
#else #else
#include <sys/types.h> #include <sys/types.h>
#include <errno.h> #include <errno.h>
#ifndef EBSNET
#include <unistd.h> #include <unistd.h>
#endif
#include <fcntl.h> #include <fcntl.h>
#if !(defined(DEVKITPRO) || defined(THREADX)) #if !(defined(DEVKITPRO) || defined(THREADX)) || defined(EBSNET)
#include <sys/socket.h> #include <sys/socket.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <netinet/in.h> #include <netinet/in.h>
@ -65,6 +67,10 @@
#ifdef THREADX #ifdef THREADX
#include <socket.h> #include <socket.h>
#endif #endif
#ifdef EBSNET
#include "rtipapi.h" /* errno */
#include "socket.h"
#endif
#endif #endif
#endif /* USE_WINDOWS_API */ #endif /* USE_WINDOWS_API */
@ -113,6 +119,8 @@ static INLINE int LastError(void)
{ {
#ifdef USE_WINDOWS_API #ifdef USE_WINDOWS_API
return WSAGetLastError(); return WSAGetLastError();
#elif defined(EBSNET)
return un_getlasterror();
#else #else
return errno; return errno;
#endif #endif

View File

@ -25,12 +25,19 @@
#ifdef HAVE_OCSP #ifdef HAVE_OCSP
#ifdef EBSNET
#include "rtip.h"
#include "socket.h"
#endif
#include <cyassl/error.h> #include <cyassl/error.h>
#include <cyassl/ocsp.h> #include <cyassl/ocsp.h>
#include <cyassl/internal.h> #include <cyassl/internal.h>
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
#ifndef EBSNET
#include <unistd.h> #include <unistd.h>
#include <netdb.h> #include <netdb.h>
#include <netinet/in.h> #include <netinet/in.h>
@ -40,6 +47,7 @@
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#endif
CYASSL_API int ocsp_test(unsigned char* buf, int sz); CYASSL_API int ocsp_test(unsigned char* buf, int sz);

View File

@ -61,9 +61,14 @@
#endif #endif
#ifndef NO_FILESYSTEM #ifndef NO_FILESYSTEM
#if !defined(USE_WINDOWS_API) && !defined(NO_CYASSL_DIR) #if !defined(USE_WINDOWS_API) && !defined(NO_CYASSL_DIR) \
&& !defined(EBSNET)
#include <dirent.h> #include <dirent.h>
#endif #endif
#ifdef EBSNET
#include "vfapi.h"
#include "vfile.h"
#endif
#endif /* NO_FILESYSTEM */ #endif /* NO_FILESYSTEM */
@ -1200,7 +1205,17 @@ static int ProcessChainBuffer(CYASSL_CTX* ctx, const unsigned char* buff,
#ifndef NO_FILESYSTEM #ifndef NO_FILESYSTEM
#ifndef MICRIUM #if defined(EBSNET)
#define XFILE int
#define XFOPEN(NAME, MODE) vf_open((const char *)NAME, VO_RDONLY, 0);
#define XFSEEK vf_lseek
#define XFTELL vf_tell
#define XREWIND vf_rewind
#define XFREAD(BUF, SZ, AMT, FD) vf_read(FD, BUF, SZ*AMT)
#define XFCLOSE vf_close
#define XSEEK_END VSEEK_END
#define XBADFILE -1
#elif !defined(MICRIUM)
#define XFILE FILE* #define XFILE FILE*
#define XFOPEN fopen #define XFOPEN fopen
#define XFSEEK fseek #define XFSEEK fseek