Hello! This patch set includes a port of OpenSSL to LynxOS, and some further work on the VxWorks port. The libraries and test programs now build and run on both platforms; the patches were made against the 0.9.6g version of OpenSSL. I have submitted a TSA notification as outlined in the README file and the Bureau of Industry and Security web site.
I'd greatly appreciate it if you would include these changes in the future releases of OpenSSL. Thanks, Matt Titus [EMAIL PROTECTED]
diff -ur openssl-orig/Configure openssl-work/Configure --- openssl-orig/Configure Thu Aug 8 13:12:40 2002 +++ openssl-work/Configure Fri Nov 22 18:43:02 2002 @@ -501,6 +501,9 @@ ##### VxWorks for various targets "vxworks-ppc405","ccppc:-g -msoft-float -mlongcall -DVXWORKS -DCPU=PPC405 -I\$(WIND_BASE)/target/h:::-r:::::", +##### LynxOS 3.0.1 +"lynxos-x86","gcc:-DL_ENDIAN -DTERMIO -DLYNXOS -O -fomit-frame-pointer -m486 +-Wall::-D_REENTRANT:-L/lib/thread -L/sys/lib -lbsd -lmisc:BN_LLONG ${x86_gcc_des} +${x86_gcc_opts}:::::", + ); my @WinTargets=qw(VC-NT VC-WIN32 VC-WIN16 VC-W31-16 VC-W31-32 VC-MSDOS BC-32 diff -ur openssl-orig/Makefile openssl-work/Makefile --- openssl-orig/Makefile Fri Aug 9 03:45:26 2002 +++ openssl-work/Makefile Fri Nov 22 21:06:14 2002 @@ -12,9 +12,9 @@ SHLIB_MAJOR=0 SHLIB_MINOR=9.6 SHLIB_EXT= -PLATFORM=dist +PLATFORM=lynxos-x86 OPTIONS= -CONFIGURE_ARGS=dist +CONFIGURE_ARGS=lynxos-x86 SHLIB_TARGET= # INSTALL_PREFIX is for package builders so that they can configure @@ -55,16 +55,16 @@ # equal 4. # PKCS1_CHECK - pkcs1 tests. -CC= cc +CC= gcc #CFLAG= -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall -Wuninitialized -DSHA1_ASM -DMD5_ASM -DRMD160_ASM -CFLAG= -O +CFLAG= -DTHREADS -D_REENTRANT -DL_ENDIAN -DTERMIO -DLYNXOS -O -fomit-frame-pointer +-m486 -Wall DEPFLAG= PEX_LIBS= -EX_LIBS= +EX_LIBS= -L/lib/thread -L/sys/lib -lbsd -lmisc EXE_EXT= AR=ar r -RANLIB= /usr/bin/ranlib -PERL= /usr/local/bin/perl +RANLIB= true +PERL= /usr/bin/perl5 TAR= tar TARFLAGS= --no-recursion diff -ur openssl-orig/Makefile.ssl openssl-work/Makefile.ssl --- openssl-orig/Makefile.ssl Fri Aug 9 03:45:26 2002 +++ openssl-work/Makefile.ssl Fri Nov 22 21:06:14 2002 @@ -12,9 +12,9 @@ SHLIB_MAJOR=0 SHLIB_MINOR=9.6 SHLIB_EXT= -PLATFORM=dist +PLATFORM=lynxos-x86 OPTIONS= -CONFIGURE_ARGS=dist +CONFIGURE_ARGS=lynxos-x86 SHLIB_TARGET= # INSTALL_PREFIX is for package builders so that they can configure @@ -55,16 +55,16 @@ # equal 4. # PKCS1_CHECK - pkcs1 tests. -CC= cc +CC= gcc #CFLAG= -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall -Wuninitialized -DSHA1_ASM -DMD5_ASM -DRMD160_ASM -CFLAG= -O +CFLAG= -DTHREADS -D_REENTRANT -DL_ENDIAN -DTERMIO -DLYNXOS -O -fomit-frame-pointer +-m486 -Wall DEPFLAG= PEX_LIBS= -EX_LIBS= +EX_LIBS= -L/lib/thread -L/sys/lib -lbsd -lmisc EXE_EXT= AR=ar r -RANLIB= /usr/bin/ranlib -PERL= /usr/local/bin/perl +RANLIB= true +PERL= /usr/bin/perl5 TAR= tar TARFLAGS= --no-recursion diff -ur openssl-orig/apps/CA.pl openssl-work/apps/CA.pl --- openssl-orig/apps/CA.pl Fri Aug 9 03:45:32 2002 +++ openssl-work/apps/CA.pl Fri Nov 22 21:06:21 2002 @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl +#!/usr/bin/perl5 # # CA - wrapper around ca to make it easier to use ... basically ca requires # some setup stuff to be done before you can use it and this makes diff -ur openssl-orig/apps/Makefile openssl-work/apps/Makefile --- openssl-orig/apps/Makefile Thu Aug 8 13:13:36 2002 +++ openssl-work/apps/Makefile Fri Aug 30 21:37:56 2002 @@ -16,6 +16,7 @@ PERL= perl RM= rm -f + PEX_LIBS= EX_LIBS= EXE_EXT= @@ -135,7 +136,7 @@ $(PROGRAM): progs.h $(E_OBJ) $(PROGRAM).o $(DLIBCRYPTO) $(DLIBSSL) $(RM) $(PROGRAM) - $(CC) -o $(PROGRAM) $(CFLAGS) $(PROGRAM).o $(E_OBJ) $(PEX_LIBS) $(LIBSSL) $(LIBCRYPTO) $(EX_LIBS) + $(CC) -o $(PROGRAM) $(cFLAGS) $(PROGRAM).o $(E_OBJ) $(PEX_LIBS) $(LIBSSL) +$(LIBCRYPTO) $(EX_LIBS) -(cd ..; OPENSSL="`pwd`/apps/openssl"; export OPENSSL; $(PERL) tools/c_rehash certs) progs.h: progs.pl diff -ur openssl-orig/apps/Makefile.ssl openssl-work/apps/Makefile.ssl --- openssl-orig/apps/Makefile.ssl Thu Aug 8 13:13:36 2002 +++ openssl-work/apps/Makefile.ssl Fri Aug 30 21:37:56 2002 @@ -16,6 +16,7 @@ PERL= perl RM= rm -f + PEX_LIBS= EX_LIBS= EXE_EXT= @@ -135,7 +136,7 @@ $(PROGRAM): progs.h $(E_OBJ) $(PROGRAM).o $(DLIBCRYPTO) $(DLIBSSL) $(RM) $(PROGRAM) - $(CC) -o $(PROGRAM) $(CFLAGS) $(PROGRAM).o $(E_OBJ) $(PEX_LIBS) $(LIBSSL) $(LIBCRYPTO) $(EX_LIBS) + $(CC) -o $(PROGRAM) $(cFLAGS) $(PROGRAM).o $(E_OBJ) $(PEX_LIBS) $(LIBSSL) +$(LIBCRYPTO) $(EX_LIBS) -(cd ..; OPENSSL="`pwd`/apps/openssl"; export OPENSSL; $(PERL) tools/c_rehash certs) progs.h: progs.pl diff -ur openssl-orig/apps/ca.c openssl-work/apps/ca.c --- openssl-orig/apps/ca.c Thu Aug 8 13:13:47 2002 +++ openssl-work/apps/ca.c Fri Aug 30 18:19:25 2002 @@ -606,12 +606,14 @@ 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 -ur openssl-orig/apps/der_chop openssl-work/apps/der_chop --- openssl-orig/apps/der_chop Fri Aug 9 03:45:32 2002 +++ openssl-work/apps/der_chop Fri Nov 22 21:06:21 2002 @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl +#!/usr/bin/perl5 # # der_chop ... this is one total hack that Eric is really not proud of # so don't look at it and don't ask for support diff -ur openssl-orig/apps/s_server.c openssl-work/apps/s_server.c --- openssl-orig/apps/s_server.c Fri Mar 30 23:47:32 2001 +++ openssl-work/apps/s_server.c Fri Aug 30 18:20:33 2002 @@ -1250,7 +1250,7 @@ else { BIO_printf(bio_s_out,"read R BLOCK\n"); -#ifndef MSDOS +#if !defined(MSDOS) && !defined(VXWORKS) sleep(1); #endif continue; diff -ur openssl-orig/apps/s_time.c openssl-work/apps/s_time.c --- openssl-orig/apps/s_time.c Thu Feb 14 07:36:34 2002 +++ openssl-work/apps/s_time.c Fri Aug 30 18:22:09 2002 @@ -116,6 +116,10 @@ #include <sys/param.h> #endif +#ifdef VXWORKS +#include <tickLib.h> +#endif + /* The following if from times(3) man page. It may need to be changed */ #ifndef HZ diff -ur openssl-orig/apps/speed.c openssl-work/apps/speed.c --- openssl-orig/apps/speed.c Sat Apr 6 01:57:52 2002 +++ openssl-work/apps/speed.c Fri Aug 30 18:24:41 2002 @@ -125,6 +125,11 @@ #include <sys/param.h> #endif +#ifdef VXWORKS +#include <tickLib.h> +#undef SIGALRM +#endif + #ifndef NO_DES #include <openssl/des.h> #endif Only in openssl-work/apps: trace.Configure Only in openssl-work/certs: .0 diff -ur openssl-orig/crypto/des/enc_writ.c openssl-work/crypto/des/enc_writ.c --- openssl-orig/crypto/des/enc_writ.c Thu Jun 1 14:17:55 2000 +++ openssl-work/crypto/des/enc_writ.c Fri Aug 30 20:25:47 2002 @@ -57,7 +57,9 @@ */ #include <errno.h> +#ifndef _IRIX #include <time.h> +#endif #include <stdio.h> #include "cryptlib.h" #include "des_locl.h" diff -ur openssl-orig/crypto/opensslconf.h openssl-work/crypto/opensslconf.h --- openssl-orig/crypto/opensslconf.h Fri Aug 9 03:45:26 2002 +++ openssl-work/crypto/opensslconf.h Fri Nov 22 21:06:14 2002 @@ -6,6 +6,9 @@ /* no ciphers excluded */ #endif #ifdef OPENSSL_THREAD_DEFINES +# ifndef THREADS +# define THREADS +# endif #endif #ifdef OPENSSL_OTHER_DEFINES #endif @@ -66,7 +69,7 @@ #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) #define CONFIG_HEADER_BN_H -#undef BN_LLONG +#define BN_LLONG /* Should we define BN_DIV2W here? */ @@ -85,7 +88,7 @@ #define CONFIG_HEADER_RC4_LOCL_H /* if this is defined data[i] is used instead of *data, this is a %20 * speedup on x86 */ -#undef RC4_INDEX +#define RC4_INDEX #endif #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) @@ -99,14 +102,14 @@ /* the following is tweaked from a config script, that is why it is a * protected undef/define */ #ifndef DES_PTR -#undef DES_PTR +#define DES_PTR #endif /* This helps C compiler generate the correct code for multiple functional * units. It reduces register dependancies at the expense of 2 more * registers */ #ifndef DES_RISC1 -#undef DES_RISC1 +#define DES_RISC1 #endif #ifndef DES_RISC2 @@ -120,7 +123,7 @@ /* Unroll the inner loop, this sometimes helps, sometimes hinders. * Very mucy CPU dependant */ #ifndef DES_UNROLL -#undef DES_UNROLL +#define DES_UNROLL #endif /* These default values were supplied by diff -ur openssl-orig/crypto/rand/rand_egd.c openssl-work/crypto/rand/rand_egd.c --- openssl-orig/crypto/rand/rand_egd.c Thu Feb 14 07:36:16 2002 +++ openssl-work/crypto/rand/rand_egd.c Fri Aug 30 18:31:00 2002 @@ -59,7 +59,7 @@ /* Query the EGD <URL: http://www.lothar.com/tech/crypto/>. */ -#if defined(WIN32) || defined(VMS) || defined(__VMS) +#if defined(WIN32) || defined(VMS) || defined(__VMS) || defined(VXWORKS) int RAND_egd(const char *path) { return(-1); diff -ur openssl-orig/crypto/rand/rand_win.c openssl-work/crypto/rand/rand_win.c --- openssl-orig/crypto/rand/rand_win.c Thu Feb 21 04:56:50 2002 +++ openssl-work/crypto/rand/rand_win.c Fri Aug 30 18:35:13 2002 @@ -718,8 +718,11 @@ /* 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); Only in openssl-work/crypto/threads: lynxos.sh Only in openssl-work/crypto/threads: mttest diff -ur openssl-orig/crypto/threads/mttest.c openssl-work/crypto/threads/mttest.c --- openssl-orig/crypto/threads/mttest.c Thu Jun 1 14:18:50 2000 +++ openssl-work/crypto/threads/mttest.c Fri Aug 30 18:45:18 2002 @@ -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 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; @@ -1058,6 +1064,43 @@ } } +#ifdef LYNXOS +void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx) + { + int i; + SSL_CTX *ssl_ctx[2]; + pthread_t thread_ctx[MAX_THREAD_NUMBER]; + pthread_attr_t thread_attr[MAX_THREAD_NUMBER]; + memset((void *)thread_attr, 0, sizeof(thread_attr)); + + ssl_ctx[0]=s_ctx; + ssl_ctx[1]=c_ctx; + + /* + thr_setconcurrency(thread_number); + */ + for (i=0; i<thread_number; i++) + { + thread_attr[i].pthread_attr_stacksize = 20000; + thread_attr[i].pthread_attr_prio = 100; + thread_attr[i].pthread_attr_inheritsched = 1; + + pthread_create(&(thread_ctx[i]), thread_attr[i], + (void *(*)())ndoit, (void *)ssl_ctx); + } + + printf("reaping\n"); + for (i=0; i<thread_number; i++) + { + pthread_join(thread_ctx[i],NULL); + } + + printf("pthreads threads done (%d,%d)\n", + s_ctx->references,c_ctx->references); + } + +#else + void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx) { SSL_CTX *ssl_ctx[2]; @@ -1086,6 +1129,8 @@ s_ctx->references,c_ctx->references); } +#endif + unsigned long pthreads_thread_id(void) { unsigned long ret; @@ -1097,4 +1142,119 @@ #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 */ Only in openssl-work/crypto/threads: randthread.c diff -ur openssl-orig/crypto/tmdiff.c openssl-work/crypto/tmdiff.c --- openssl-orig/crypto/tmdiff.c Fri Mar 1 06:01:27 2002 +++ openssl-work/crypto/tmdiff.c Fri Aug 30 18:50:29 2002 @@ -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 -ur openssl-orig/crypto/uid.c openssl-work/crypto/uid.c --- openssl-orig/crypto/uid.c Mon Feb 19 16:38:02 2001 +++ openssl-work/crypto/uid.c Fri Aug 30 18:57:11 2002 @@ -64,7 +64,7 @@ return issetugid(); } -#elif defined(WIN32) +#elif defined(WIN32) || defined (VXWORKS) int OPENSSL_issetugid(void) { diff -ur openssl-orig/crypto/x509/by_dir.c openssl-work/crypto/x509/by_dir.c --- openssl-orig/crypto/x509/by_dir.c Fri Oct 27 12:09:11 2000 +++ openssl-work/crypto/x509/by_dir.c Fri Aug 30 21:02:37 2002 @@ -60,8 +60,6 @@ #include <time.h> #include <errno.h> -#include "cryptlib.h" - #ifndef NO_SYS_TYPES_H # include <sys/types.h> #endif @@ -70,6 +68,8 @@ #else # include <sys/stat.h> #endif + +#include "cryptlib.h" #include <openssl/lhash.h> #include <openssl/x509.h> diff -ur openssl-orig/e_os.h openssl-work/e_os.h --- openssl-orig/e_os.h Thu Aug 8 13:13:14 2002 +++ openssl-work/e_os.h Fri Nov 22 18:45:47 2002 @@ -162,6 +162,31 @@ #define closesocket(s) close(s) #define readsocket(s,b,n) recv((s),(b),(n),0) #define writesocket(s,b,n) send((s),(b),(n),0) +#elif defined(VXWORKS) +#include <ioLib.h> +#include <sockLib.h> +#include <hostLib.h> +#include <sysLib.h> +#undef m_len +#undef BUFSIZE +#undef DEVRANDOM +/* While VxWorks has libraries that implement host name resolution, + * (hostLib and resolvLib) using them is more involved than it is + * on UNIX variants, and they don't provide the gethost* or getserv* functions. + * The #defines below are sufficient to allow the test suite to run. +*/ +#define gethostbyname(a) NULL +#define gethostbyaddr(a,b,c) NULL +#define getservbyname(a,b) NULL +#define write(s,b,n) write(s,(char *)b,n) +#define stat(f,s) stat((char *)f,s) +#define opendir(d) opendir((char *)d) +#define get_last_socket_error() errno +#define clear_socket_error() errno=0 +#define ioctlsocket(a,b,c) ioctl(a,b,(int)c); +#define closesocket(s) close(s) +#define readsocket(s,b,n) read((s),(b),(n)) +#define writesocket(s,b,n) write((s),(b),(n)) #else #define get_last_socket_error() errno #define clear_socket_error() errno=0 @@ -324,6 +349,11 @@ # endif # endif +#ifdef VXWORKS +#include <taskLib.h> +#define getpid() taskIdSelf() +#endif + # define SSLeay_getpid() getpid() #endif @@ -357,6 +387,21 @@ # define SHUTDOWN(fd) MacSocket_close(fd) # define SHUTDOWN2(fd) MacSocket_close(fd) +# elif defined(LYNXOS) +# include <param.h> +# include <time.h> +# include <netdb.h> +# include <socket.h> +# include <netinet/in.h> +# include <arpa/inet.h> +# include <sys/ioctl.h> +# define gethostbyname(a) gethostbyname((char *)(a)) +# define SSLeay_Read(a,b,c) read((a),(b),(c)) +# define SSLeay_Write(a,b,c) write((a),(b),(c)) +# define SHUTDOWN(fd) { shutdown((fd),0); closesocket((fd)); } +# define SHUTDOWN2(fd) { shutdown((fd),2); closesocket((fd)); } +# define INVALID_SOCKET (-1) + # else # ifndef NO_SYS_PARAM_H @@ -462,6 +507,11 @@ #endif #ifdef SNI #define IRIX_CC_BUG /* CDS++ up to V2.0Bsomething suffered from the same bug.*/ +#endif + +#ifdef LYNXOS +#define gmtime_r(a,b) gmtime_r((b),(a)) +#define localtime_r(a,b) localtime_r((b),(a)) #endif #ifdef NO_MD2 diff -ur openssl-orig/include/openssl/e_os.h openssl-work/include/openssl/e_os.h --- openssl-orig/include/openssl/e_os.h Thu Aug 8 13:13:14 2002 +++ openssl-work/include/openssl/e_os.h Fri Nov 22 18:45:47 2002 @@ -162,6 +162,31 @@ #define closesocket(s) close(s) #define readsocket(s,b,n) recv((s),(b),(n),0) #define writesocket(s,b,n) send((s),(b),(n),0) +#elif defined(VXWORKS) +#include <ioLib.h> +#include <sockLib.h> +#include <hostLib.h> +#include <sysLib.h> +#undef m_len +#undef BUFSIZE +#undef DEVRANDOM +/* While VxWorks has libraries that implement host name resolution, + * (hostLib and resolvLib) using them is more involved than it is + * on UNIX variants, and they don't provide the gethost* or getserv* functions. + * The #defines below are sufficient to allow the test suite to run. +*/ +#define gethostbyname(a) NULL +#define gethostbyaddr(a,b,c) NULL +#define getservbyname(a,b) NULL +#define write(s,b,n) write(s,(char *)b,n) +#define stat(f,s) stat((char *)f,s) +#define opendir(d) opendir((char *)d) +#define get_last_socket_error() errno +#define clear_socket_error() errno=0 +#define ioctlsocket(a,b,c) ioctl(a,b,(int)c); +#define closesocket(s) close(s) +#define readsocket(s,b,n) read((s),(b),(n)) +#define writesocket(s,b,n) write((s),(b),(n)) #else #define get_last_socket_error() errno #define clear_socket_error() errno=0 @@ -324,6 +349,11 @@ # endif # endif +#ifdef VXWORKS +#include <taskLib.h> +#define getpid() taskIdSelf() +#endif + # define SSLeay_getpid() getpid() #endif @@ -357,6 +387,21 @@ # define SHUTDOWN(fd) MacSocket_close(fd) # define SHUTDOWN2(fd) MacSocket_close(fd) +# elif defined(LYNXOS) +# include <param.h> +# include <time.h> +# include <netdb.h> +# include <socket.h> +# include <netinet/in.h> +# include <arpa/inet.h> +# include <sys/ioctl.h> +# define gethostbyname(a) gethostbyname((char *)(a)) +# define SSLeay_Read(a,b,c) read((a),(b),(c)) +# define SSLeay_Write(a,b,c) write((a),(b),(c)) +# define SHUTDOWN(fd) { shutdown((fd),0); closesocket((fd)); } +# define SHUTDOWN2(fd) { shutdown((fd),2); closesocket((fd)); } +# define INVALID_SOCKET (-1) + # else # ifndef NO_SYS_PARAM_H @@ -462,6 +507,11 @@ #endif #ifdef SNI #define IRIX_CC_BUG /* CDS++ up to V2.0Bsomething suffered from the same bug.*/ +#endif + +#ifdef LYNXOS +#define gmtime_r(a,b) gmtime_r((b),(a)) +#define localtime_r(a,b) localtime_r((b),(a)) #endif #ifdef NO_MD2 diff -ur openssl-orig/include/openssl/opensslconf.h openssl-work/include/openssl/opensslconf.h --- openssl-orig/include/openssl/opensslconf.h Fri Aug 9 03:45:26 2002 +++ openssl-work/include/openssl/opensslconf.h Fri Nov 22 21:06:14 2002 @@ -6,6 +6,9 @@ /* no ciphers excluded */ #endif #ifdef OPENSSL_THREAD_DEFINES +# ifndef THREADS +# define THREADS +# endif #endif #ifdef OPENSSL_OTHER_DEFINES #endif @@ -66,7 +69,7 @@ #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) #define CONFIG_HEADER_BN_H -#undef BN_LLONG +#define BN_LLONG /* Should we define BN_DIV2W here? */ @@ -85,7 +88,7 @@ #define CONFIG_HEADER_RC4_LOCL_H /* if this is defined data[i] is used instead of *data, this is a %20 * speedup on x86 */ -#undef RC4_INDEX +#define RC4_INDEX #endif #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) @@ -99,14 +102,14 @@ /* the following is tweaked from a config script, that is why it is a * protected undef/define */ #ifndef DES_PTR -#undef DES_PTR +#define DES_PTR #endif /* This helps C compiler generate the correct code for multiple functional * units. It reduces register dependancies at the expense of 2 more * registers */ #ifndef DES_RISC1 -#undef DES_RISC1 +#define DES_RISC1 #endif #ifndef DES_RISC2 @@ -120,7 +123,7 @@ /* Unroll the inner loop, this sometimes helps, sometimes hinders. * Very mucy CPU dependant */ #ifndef DES_UNROLL -#undef DES_UNROLL +#define DES_UNROLL #endif /* These default values were supplied by diff -ur openssl-orig/ssl/ssl_cert.c openssl-work/ssl/ssl_cert.c --- openssl-orig/ssl/ssl_cert.c Thu May 9 15:07:46 2002 +++ openssl-work/ssl/ssl_cert.c Fri Aug 30 21:05:20 2002 @@ -106,8 +106,6 @@ #include <stdio.h> -#include "openssl/e_os.h" - #ifndef NO_SYS_TYPES_H # include <sys/types.h> #endif @@ -120,6 +118,8 @@ #include <sys/dir.h> #define dirent direct #endif + +#include "openssl/e_os.h" #include <openssl/objects.h> #include <openssl/bio.h> diff -ur openssl-orig/ssl/ssl_locl.h openssl-work/ssl/ssl_locl.h --- openssl-orig/ssl/ssl_locl.h Thu Aug 8 13:18:07 2002 +++ openssl-work/ssl/ssl_locl.h Fri Aug 30 20:27:55 2002 @@ -112,7 +112,9 @@ #ifndef HEADER_SSL_LOCL_H #define HEADER_SSL_LOCL_H #include <stdlib.h> +#ifndef _IRIX #include <time.h> +#endif #include <string.h> #include <errno.h> diff -ur openssl-orig/test/Makefile openssl-work/test/Makefile --- openssl-orig/test/Makefile Thu Aug 8 13:18:13 2002 +++ openssl-work/test/Makefile Wed Sep 4 19:46:01 2002 @@ -7,6 +7,7 @@ CC= cc INCLUDES= -I../include CFLAG= -g +CFLAG= -DTHREADS -D_REENTRANT -DL_ENDIAN -DTERMIO -DLYNXOS -O -fomit-frame-pointer +-m486 -Wall INSTALL_PREFIX= OPENSSLDIR= /usr/local/ssl INSTALLTOP= /usr/local/ssl @@ -100,7 +101,7 @@ tags: ctags $(SRC) -tests: exe apps \ +tests: \ test_des test_idea test_sha test_md4 test_md5 test_hmac \ test_md2 test_mdc2 \ test_rmd test_rc2 test_rc4 test_rc5 test_bf test_cast \ @@ -187,11 +188,14 @@ @sh ./tpkcs7d 2>/dev/null test_bn: - @echo starting big number library test, could take a while... - @./$(BNTEST) >tmp.bntest - @echo quit >>tmp.bntest + #@echo starting big number library test, could take a while... + #@./$(BNTEST) >tmp.bntest + #@echo quit >>tmp.bntest @echo "running bc" + @echo "Perl not available; postprocess tmp.bntest elsewhere" @<tmp.bntest sh -c "`sh ./bctest ignore`" | $(PERL) -e '$$i=0; while (<STDIN>) {if (/^test (.*)/) {print STDERR "\nverify $$1";} elsif (!/^0$$/) {die "\nFailed! bc: $$_";} else {print STDERR "."; $$i++;}} print STDERR "\n$$i tests passed\n"' + +test_exp: @echo 'test a^b%c implementations' ./$(EXPTEST) @@ -247,6 +251,9 @@ $(DLIBCRYPTO): (cd ../crypto; $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' TESTS='${TESTS}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}') + +randit: randit.o $(DLIBCRYPTO) + $(CC) -o randit $(CFLAGS) randit.o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) $(RSATEST): $(RSATEST).o $(DLIBCRYPTO) $(CC) -o $(RSATEST) $(CFLAGS) $(RSATEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) diff -ur openssl-orig/test/Makefile.ssl openssl-work/test/Makefile.ssl --- openssl-orig/test/Makefile.ssl Thu Aug 8 13:18:13 2002 +++ openssl-work/test/Makefile.ssl Wed Sep 4 19:46:01 2002 @@ -7,6 +7,7 @@ CC= cc INCLUDES= -I../include CFLAG= -g +CFLAG= -DTHREADS -D_REENTRANT -DL_ENDIAN -DTERMIO -DLYNXOS -O -fomit-frame-pointer +-m486 -Wall INSTALL_PREFIX= OPENSSLDIR= /usr/local/ssl INSTALLTOP= /usr/local/ssl @@ -100,7 +101,7 @@ tags: ctags $(SRC) -tests: exe apps \ +tests: \ test_des test_idea test_sha test_md4 test_md5 test_hmac \ test_md2 test_mdc2 \ test_rmd test_rc2 test_rc4 test_rc5 test_bf test_cast \ @@ -187,11 +188,14 @@ @sh ./tpkcs7d 2>/dev/null test_bn: - @echo starting big number library test, could take a while... - @./$(BNTEST) >tmp.bntest - @echo quit >>tmp.bntest + #@echo starting big number library test, could take a while... + #@./$(BNTEST) >tmp.bntest + #@echo quit >>tmp.bntest @echo "running bc" + @echo "Perl not available; postprocess tmp.bntest elsewhere" @<tmp.bntest sh -c "`sh ./bctest ignore`" | $(PERL) -e '$$i=0; while (<STDIN>) {if (/^test (.*)/) {print STDERR "\nverify $$1";} elsif (!/^0$$/) {die "\nFailed! bc: $$_";} else {print STDERR "."; $$i++;}} print STDERR "\n$$i tests passed\n"' + +test_exp: @echo 'test a^b%c implementations' ./$(EXPTEST) @@ -247,6 +251,9 @@ $(DLIBCRYPTO): (cd ../crypto; $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' TESTS='${TESTS}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}') + +randit: randit.o $(DLIBCRYPTO) + $(CC) -o randit $(CFLAGS) randit.o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) $(RSATEST): $(RSATEST).o $(DLIBCRYPTO) $(CC) -o $(RSATEST) $(CFLAGS) $(RSATEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) Only in openssl-work/test: certCA.srl Only in openssl-work/test: randit Only in openssl-work/test: randit.c Only in openssl-work/test: testkey.pem Only in openssl-work/test: testreq.pem Only in openssl-work/test: trace diff -ur openssl-orig/tools/c_rehash openssl-work/tools/c_rehash --- openssl-orig/tools/c_rehash Fri Aug 9 03:45:32 2002 +++ openssl-work/tools/c_rehash Fri Nov 22 21:06:21 2002 @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl +#!/usr/bin/perl5 # Perl c_rehash script, scan all files in a directory