EBSnet RTIP support
This commit is contained in:
parent
bfd510b919
commit
7ec04c16b6
@ -41,7 +41,9 @@
|
||||
#else
|
||||
#ifndef NO_DEV_RANDOM
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#ifndef EBSNET
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#else
|
||||
/* include headers that may be needed to get good seed */
|
||||
#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 "rtptime.h" /* rtp_get_system_msec() */
|
||||
|
@ -51,6 +51,9 @@
|
||||
/* Uncomment next line if using FreeRTOS Windows Simulator */
|
||||
/* #define FREERTOS_WINSIM */
|
||||
|
||||
/* Uncomment next line if using RTIP */
|
||||
/* #define EBSNET */
|
||||
|
||||
/* Uncomment next line if using lwip */
|
||||
/* #define CYASSL_LWIP */
|
||||
|
||||
@ -103,6 +106,39 @@
|
||||
#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
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#if defined(__PPU) || defined(__XENON)
|
||||
|
@ -132,7 +132,8 @@ enum {
|
||||
|
||||
|
||||
/* 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
|
||||
#endif
|
||||
|
||||
@ -147,7 +148,7 @@ enum {
|
||||
extern void *XMALLOC(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);
|
||||
#elif !defined(MICRIUM_MALLOC)
|
||||
#elif !defined(MICRIUM_MALLOC) && !defined(EBSNET)
|
||||
/* default C runtime, can install different routines at runtime */
|
||||
#include <cyassl/ctaocrypt/memory.h>
|
||||
#define XMALLOC(s, h, t) CyaSSL_Malloc((s))
|
||||
|
@ -71,6 +71,8 @@
|
||||
/* do nothing, just don't pick Unix */
|
||||
#elif defined(FREERTOS)
|
||||
/* do nothing */
|
||||
#elif defined(EBSNET)
|
||||
/* do nothing */
|
||||
#else
|
||||
#ifndef SINGLE_THREADED
|
||||
#define CYASSL_PTHREADS
|
||||
@ -678,6 +680,8 @@ struct CYASSL_CIPHER {
|
||||
typedef TX_MUTEX CyaSSL_Mutex;
|
||||
#elif defined(MICRIUM)
|
||||
typedef OS_MUTEX CyaSSL_Mutex;
|
||||
#elif defined(EBSNET)
|
||||
typedef RTP_MUTEX CyaSSL_Mutex;
|
||||
#else
|
||||
#error Need a mutex type in multithreaded mode
|
||||
#endif /* USE_WINDOWS_API */
|
||||
|
@ -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 /* SINGLE_THREADED */
|
||||
|
12
src/io.c
12
src/io.c
@ -49,9 +49,11 @@
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#ifndef EBSNET
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
#if !(defined(DEVKITPRO) || defined(THREADX))
|
||||
#if !(defined(DEVKITPRO) || defined(THREADX)) || defined(EBSNET)
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
@ -65,6 +67,10 @@
|
||||
#ifdef THREADX
|
||||
#include <socket.h>
|
||||
#endif
|
||||
#ifdef EBSNET
|
||||
#include "rtipapi.h" /* errno */
|
||||
#include "socket.h"
|
||||
#endif
|
||||
#endif
|
||||
#endif /* USE_WINDOWS_API */
|
||||
|
||||
@ -113,6 +119,8 @@ static INLINE int LastError(void)
|
||||
{
|
||||
#ifdef USE_WINDOWS_API
|
||||
return WSAGetLastError();
|
||||
#elif defined(EBSNET)
|
||||
return un_getlasterror();
|
||||
#else
|
||||
return errno;
|
||||
#endif
|
||||
|
26
src/ocsp.c
26
src/ocsp.c
@ -25,21 +25,29 @@
|
||||
|
||||
#ifdef HAVE_OCSP
|
||||
|
||||
#ifdef EBSNET
|
||||
#include "rtip.h"
|
||||
#include "socket.h"
|
||||
#endif
|
||||
|
||||
#include <cyassl/error.h>
|
||||
#include <cyassl/ocsp.h>
|
||||
#include <cyassl/internal.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#ifndef EBSNET
|
||||
#include <unistd.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
|
||||
CYASSL_API int ocsp_test(unsigned char* buf, int sz);
|
||||
|
19
src/ssl.c
19
src/ssl.c
@ -61,9 +61,14 @@
|
||||
#endif
|
||||
|
||||
#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>
|
||||
#endif
|
||||
#ifdef EBSNET
|
||||
#include "vfapi.h"
|
||||
#include "vfile.h"
|
||||
#endif
|
||||
#endif /* NO_FILESYSTEM */
|
||||
|
||||
|
||||
@ -1200,7 +1205,17 @@ static int ProcessChainBuffer(CYASSL_CTX* ctx, const unsigned char* buff,
|
||||
|
||||
#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 XFOPEN fopen
|
||||
#define XFSEEK fseek
|
||||
|
Loading…
Reference in New Issue
Block a user