aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2002-12-04 23:13:07 +0000
committerRichard Levitte <levitte@openssl.org>2002-12-04 23:13:07 +0000
commite5040378dfb831e7cb6ba020f20e42b53ed0053e (patch)
treee162e3156988a276ebac8b0c8e08eb1da18267e5
parent0b7497310d08c8a1a0c65a3e3fb9a116ee2ba211 (diff)
downloadopenssl-e5040378dfb831e7cb6ba020f20e42b53ed0053e.tar.gz
Fixes for VxWorks. Are these needed for 0.9.7 and up as well?
PR: 374
-rw-r--r--apps/ca.c2
-rw-r--r--apps/s_server.c2
-rw-r--r--apps/s_time.c5
-rw-r--r--crypto/rand/rand_egd.c2
-rw-r--r--crypto/rand/rand_win.c2
-rw-r--r--crypto/threads/mttest.c121
-rw-r--r--crypto/tmdiff.c5
-rw-r--r--crypto/uid.c2
8 files changed, 138 insertions, 3 deletions
diff --git a/apps/ca.c b/apps/ca.c
index 7e64a75e8d..b8487208c6 100644
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -606,12 +606,14 @@ bad:
that to access(). However, time's too short to do that just
now.
*/
+#ifndef VXWORKS
if (access(outdir,R_OK|W_OK|X_OK) != 0)
{
BIO_printf(bio_err,"I am unable to access the %s directory\n",outdir);
perror(outdir);
goto err;
}
+#endif
if (stat(outdir,&sb) != 0)
{
diff --git a/apps/s_server.c b/apps/s_server.c
index 0839ac07da..e6ecafd4ed 100644
--- a/apps/s_server.c
+++ b/apps/s_server.c
@@ -1250,7 +1250,7 @@ static int www_body(char *hostname, int s, unsigned char *context)
else
{
BIO_printf(bio_s_out,"read R BLOCK\n");
-#ifndef MSDOS
+#if !defined(MSDOS) && !defined(VXWORKS)
sleep(1);
#endif
continue;
diff --git a/apps/s_time.c b/apps/s_time.c
index c8719a6a22..895741d4cd 100644
--- a/apps/s_time.c
+++ b/apps/s_time.c
@@ -116,6 +116,11 @@
#include <sys/param.h>
#endif
+#ifdef VXWORKS
+#include <tickLib.h>
+#undef SIGALRM
+#endif
+
/* The following if from times(3) man page. It may need to be changed
*/
#ifndef HZ
diff --git a/crypto/rand/rand_egd.c b/crypto/rand/rand_egd.c
index e17060fe90..ce16936785 100644
--- a/crypto/rand/rand_egd.c
+++ b/crypto/rand/rand_egd.c
@@ -59,7 +59,7 @@
/* Query the EGD <URL: http://www.lothar.com/tech/crypto/>.
*/
-#if defined(WIN32) || defined(MSDOS) || defined(VMS) || defined(__VMS)
+#if defined(WIN32) || defined(MSDOS) || defined(VMS) || defined(__VMS) || defined(VXWORKS)
int RAND_egd(const char *path)
{
return(-1);
diff --git a/crypto/rand/rand_win.c b/crypto/rand/rand_win.c
index 92befcd798..3e148ad4d2 100644
--- a/crypto/rand/rand_win.c
+++ b/crypto/rand/rand_win.c
@@ -732,8 +732,10 @@ int RAND_poll(void)
/* put in some default random data, we need more than just this */
l=curr_pid;
RAND_add(&l,sizeof(l),0);
+#ifndef VXWORKS
l=getuid();
RAND_add(&l,sizeof(l),0);
+#endif
l=time(NULL);
RAND_add(&l,sizeof(l),0);
diff --git a/crypto/threads/mttest.c b/crypto/threads/mttest.c
index 100165948c..3d1b212b1c 100644
--- a/crypto/threads/mttest.c
+++ b/crypto/threads/mttest.c
@@ -77,6 +77,10 @@
#ifdef PTHREADS
#include <pthread.h>
#endif
+#ifdef VXWORKS
+#include <taskLib.h>
+#include <semLib.h>
+#endif
#include <openssl/lhash.h>
#include <openssl/crypto.h>
#include <openssl/buffer.h>
@@ -105,10 +109,12 @@ void irix_locking_callback(int mode,int type,char *file,int line);
void solaris_locking_callback(int mode,int type,char *file,int line);
void win32_locking_callback(int mode,int type,char *file,int line);
void pthreads_locking_callback(int mode,int type,char *file,int line);
+void vxworks_locking_callback(int mode,int type,char *file,int line);
unsigned long irix_thread_id(void );
unsigned long solaris_thread_id(void );
unsigned long pthreads_thread_id(void );
+unsigned long vxworks_thread_id(void );
BIO *bio_err=NULL;
BIO *bio_stdout=NULL;
@@ -1097,4 +1103,119 @@ unsigned long pthreads_thread_id(void)
#endif /* PTHREADS */
+#ifdef VXWORKS
+
+#define DEFAULT_TASK_NAME NULL
+#define DEFAULT_TASK_PRIORITY 100
+#define DEFAULT_TASK_OPTIONS 0
+#define DEFAULT_TASK_STACK_BYTES 32768
+
+static SEM_ID *lock_cs;
+static long *lock_count;
+
+extern int sysClkRateGet();
+
+void thread_setup(void)
+ {
+ int i;
+
+ lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(SEM_ID));
+ lock_count=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long));
+ for (i=0; i<CRYPTO_num_locks(); i++)
+ {
+ lock_count[i]=0;
+ lock_cs[i] = semMCreate(SEM_Q_PRIORITY | SEM_INVERSION_SAFE);
+ }
+
+ CRYPTO_set_id_callback((unsigned long (*)())vxworks_thread_id);
+ CRYPTO_set_locking_callback((void (*)())vxworks_locking_callback);
+ }
+
+void thread_cleanup(void)
+ {
+ int i;
+
+ CRYPTO_set_locking_callback(NULL);
+ fprintf(stderr,"cleanup\n");
+ for (i=0; i<CRYPTO_num_locks(); i++)
+ {
+ semDelete(lock_cs[i]);
+ fprintf(stderr,"%8ld:%s\n",lock_count[i],
+ CRYPTO_get_lock_name(i));
+ }
+ OPENSSL_free(lock_cs);
+ OPENSSL_free(lock_count);
+
+ fprintf(stderr,"done cleanup\n");
+ }
+
+void vxworks_locking_callback(int mode, int type, char *file, int line)
+ {
+#ifdef undef
+ fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n",
+ CRYPTO_thread_id(),
+ (mode&CRYPTO_LOCK)?"l":"u",
+ (type&CRYPTO_READ)?"r":"w",file,line);
+#endif
+/*
+ if (CRYPTO_LOCK_SSL_CERT == type)
+ fprintf(stderr,"(t,m,f,l) %ld %d %s %d\n",
+ CRYPTO_thread_id(),
+ mode,file,line);
+*/
+ if (mode & CRYPTO_LOCK)
+ {
+ semTake(lock_cs[type], WAIT_FOREVER);
+ lock_count[type]++;
+ }
+ else
+ {
+ semGive(lock_cs[type]);
+ }
+ }
+
+
+void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx)
+ {
+ SSL_CTX *ssl_ctx[2];
+ int thread_ctx[MAX_THREAD_NUMBER];
+ int i;
+
+ ssl_ctx[0]=s_ctx;
+ ssl_ctx[1]=c_ctx;
+
+ /*
+ thr_setconcurrency(thread_number);
+ */
+ for (i=0; i<thread_number; i++)
+ {
+ thread_ctx[i] = taskSpawn(DEFAULT_TASK_NAME,
+ DEFAULT_TASK_PRIORITY,
+ DEFAULT_TASK_OPTIONS,
+ DEFAULT_TASK_STACK_BYTES,
+ (FUNCPTR)ndoit,
+ (int)ssl_ctx, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+
+ printf("Spawned task %d (%x)\n", i, thread_ctx[i]);
+ }
+
+ printf("reaping\n");
+ for (i=0; i<thread_number; i++)
+ {
+ while(taskIdVerify(thread_ctx[i]) != ERROR)
+ {
+ taskDelay(sysClkRateGet()/10);
+ }
+ printf("Reaped task %d (%x)\n", i, thread_ctx[i]);
+ }
+
+ printf("vxworks threads done (%d,%d)\n",
+ s_ctx->references,c_ctx->references);
+ }
+
+unsigned long vxworks_thread_id(void)
+ {
+ return((unsigned long)taskIdSelf());
+ }
+#endif /* VXWORKS */
diff --git a/crypto/tmdiff.c b/crypto/tmdiff.c
index 830092210f..fc38e139a7 100644
--- a/crypto/tmdiff.c
+++ b/crypto/tmdiff.c
@@ -105,6 +105,11 @@
#include <windows.h>
#endif
+#ifdef VXWORKS
+#include <tickLib.h>
+#include <drv/timer/timerDev.h>
+#endif
+
/* The following if from times(3) man page. It may need to be changed */
#ifndef HZ
# ifndef CLK_TCK
diff --git a/crypto/uid.c b/crypto/uid.c
index b5b61b76d4..4bd283592c 100644
--- a/crypto/uid.c
+++ b/crypto/uid.c
@@ -64,7 +64,7 @@ int OPENSSL_issetugid(void)
return issetugid();
}
-#elif defined(WIN32)
+#elif defined(WIN32) || defined(VXWORKS)
int OPENSSL_issetugid(void)
{