Add support for VxWorks 6.x
Use rand_r and define SEM_ID_NULL Fix redefinition of typedef 'SOCKADDR'
This commit is contained in:
parent
0554b02215
commit
cd008aac6a
@ -2206,30 +2206,49 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
|
||||
return 0;
|
||||
}
|
||||
#elif defined(WOLFSSL_VXWORKS)
|
||||
#ifdef WOLFSSL_VXWORKS_6_x
|
||||
#include "stdlib.h"
|
||||
#warning "potential for not enough entropy, currently being used for testing"
|
||||
int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
|
||||
{
|
||||
int i;
|
||||
unsigned int seed = (unsigned int)XTIME(0);
|
||||
(void)os;
|
||||
|
||||
#include <randomNumGen.h>
|
||||
|
||||
int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz) {
|
||||
STATUS status;
|
||||
|
||||
#ifdef VXWORKS_SIM
|
||||
/* cannot generate true entropy with VxWorks simulator */
|
||||
#warning "not enough entropy, simulator for testing only"
|
||||
int i = 0;
|
||||
|
||||
for (i = 0; i < 1000; i++) {
|
||||
randomAddTimeStamp();
|
||||
for (i = 0; i < sz; i++ ) {
|
||||
output[i] = rand_r(&seed) % 256;
|
||||
if ((i % 8) == 7) {
|
||||
seed = (unsigned int)XTIME(0);
|
||||
rand_r(&seed);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
status = randBytes (output, sz);
|
||||
if (status == ERROR) {
|
||||
return RNG_FAILURE_E;
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#include <randomNumGen.h>
|
||||
|
||||
return 0;
|
||||
}
|
||||
int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz) {
|
||||
STATUS status;
|
||||
|
||||
#ifdef VXWORKS_SIM
|
||||
/* cannot generate true entropy with VxWorks simulator */
|
||||
#warning "not enough entropy, simulator for testing only"
|
||||
int i = 0;
|
||||
|
||||
for (i = 0; i < 1000; i++) {
|
||||
randomAddTimeStamp();
|
||||
}
|
||||
#endif
|
||||
|
||||
status = randBytes (output, sz);
|
||||
if (status == ERROR) {
|
||||
return RNG_FAILURE_E;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#elif defined(WOLFSSL_NRF51) || defined(WOLFSSL_NRF5x)
|
||||
#include "app_error.h"
|
||||
#include "nrf_drv_rng.h"
|
||||
|
@ -104,7 +104,11 @@
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/time.h>
|
||||
#ifdef WOLFSSL_VXWORKS_6_x
|
||||
#include <time.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <netdb.h>
|
||||
#include <pthread.h>
|
||||
#define SOCKET_T int
|
||||
|
@ -565,8 +565,6 @@
|
||||
/* #define WOLFSSL_PTHREADS */
|
||||
#define WOLFSSL_HAVE_MIN
|
||||
#define WOLFSSL_HAVE_MAX
|
||||
#define USE_FAST_MATH
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#define NO_MAIN_DRIVER
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_WRITEV
|
||||
|
@ -100,6 +100,11 @@
|
||||
#include "fsl_os_abstraction.h"
|
||||
#elif defined(WOLFSSL_VXWORKS)
|
||||
#include <semLib.h>
|
||||
#ifdef WOLFSSL_VXWORKS_6_x
|
||||
#ifndef SEM_ID_NULL
|
||||
#define SEM_ID_NULL ((SEM_ID)NULL)
|
||||
#endif
|
||||
#endif
|
||||
#elif defined(WOLFSSL_uITRON4)
|
||||
#include "stddef.h"
|
||||
#include "kernel.h"
|
||||
|
@ -312,6 +312,9 @@
|
||||
#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))
|
||||
#elif defined(WOLFSSL_VXWORKS)
|
||||
/*socket.h already has "typedef struct sockaddr SOCKADDR;"
|
||||
so don't redefine it in wolfSSL */
|
||||
#define HAVE_SOCKADDR_DEFINED
|
||||
#define SEND_FUNCTION send
|
||||
#define RECV_FUNCTION recv
|
||||
#elif defined(WOLFSSL_NUCLEUS_1_2)
|
||||
@ -364,7 +367,9 @@
|
||||
|
||||
/* Socket Addr Support */
|
||||
#ifdef HAVE_SOCKADDR
|
||||
#ifndef HAVE_SOCKADDR_DEFINED
|
||||
typedef struct sockaddr SOCKADDR;
|
||||
#endif
|
||||
typedef struct sockaddr_storage SOCKADDR_S;
|
||||
typedef struct sockaddr_in SOCKADDR_IN;
|
||||
#ifdef WOLFSSL_IPV6
|
||||
|
Loading…
x
Reference in New Issue
Block a user