Hi, I have a patch to allow openssl to be built for a VxWorks target. Specifically a PowerPC 405 target, but changing targets should be a matter of adding a line in the Configure file.
I am primarily concerned with the libcrypt functionality and have not ported all of the apps code (although it does build). The config script doesn't seem to pick up cross compiling environments, so you have to start with "./Configure vxworks-ppc405" instead. A pretty simple port job, beats paying $30K US for a commercial port of the same code... bill -- Bill Pitts Senior Software Engineer Wave7 Optics [EMAIL PROTECTED] ---------------- patchfile ------------------------------------------------------------------------ ---------- diff -r -u -x Make* ./openssl-0.9.6c/Configure ./openssl-0.9.6c-vxworks/Configure --- ./openssl-0.9.6c/Configure Thu Dec 6 08:11:39 2001 +++ ./openssl-0.9.6c-vxworks/Configure Tue Feb 5 14:00:07 2002 @@ -480,6 +480,9 @@ ##### Sony NEWS-OS 4.x "newsos4-gcc","gcc:-O -DB_ENDIAN -DNEWS4::(unknown):-lmld -liberty:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::", +##### VxWorks for various targets +"vxworks-ppc405","ccppc:-g -msoft-float -mlongcall -DVXWORKS -DCPU=PPC405 -I\$(WIND_BASE)/target/h:::-r:::::", + ); my @WinTargets=qw(VC-NT VC-WIN32 VC-WIN16 VC-W31-16 VC-W31-32 VC-MSDOS BC-32 diff -r -u -x Make* ./openssl-0.9.6c/apps/ca.c ./openssl-0.9.6c-vxworks/apps/ca.c --- ./openssl-0.9.6c/apps/ca.c Tue May 22 08:48:14 2001 +++ ./openssl-0.9.6c-vxworks/apps/ca.c Tue Feb 5 10:44:04 2002 @@ -82,7 +82,7 @@ # else # include <unixlib.h> # endif -# else +# elif !defined(VXWORKS) # include <sys/file.h> # endif #endif diff -r -u -x Make* ./openssl-0.9.6c/apps/s_server.c ./openssl-0.9.6c-vxworks/apps/s_server.c --- ./openssl-0.9.6c/apps/s_server.c Sat Mar 31 02:47:32 2001 +++ ./openssl-0.9.6c-vxworks/apps/s_server.c Tue Feb 5 13:08:18 2002 @@ -62,6 +62,7 @@ #include <string.h> #include <sys/types.h> #include <sys/stat.h> + #ifdef NO_STDIO #define APPS_WIN16 #endif @@ -77,6 +78,7 @@ #include <openssl/lhash.h> #include <openssl/bn.h> + #define USE_SOCKETS #include "apps.h" #include <openssl/err.h> diff -r -u -x Make* ./openssl-0.9.6c/apps/s_time.c ./openssl-0.9.6c-vxworks/apps/s_time.c --- ./openssl-0.9.6c/apps/s_time.c Fri Feb 11 04:46:55 2000 +++ ./openssl-0.9.6c-vxworks/apps/s_time.c Tue Feb 5 13:56:50 2002 @@ -82,7 +82,7 @@ #include "wintext.h" #endif -#if !defined(MSDOS) && (!defined(VMS) || defined(__DECC)) +#if !defined(MSDOS) && !defined(VXWORKS) && (!defined(VMS) || defined(__DECC)) #define TIMES #endif @@ -102,7 +102,7 @@ #undef TIMES #endif -#ifndef TIMES +#if !defined(TIMES) && !defined(VXWORKS) #include <sys/timeb.h> #endif @@ -139,6 +139,14 @@ #undef BUFSIZZ #define BUFSIZZ 1024*10 +#ifdef min +#undef min +#endif + +#ifdef max +#undef max +#endif + #define min(a,b) (((a) < (b)) ? (a) : (b)) #define max(a,b) (((a) > (b)) ? (a) : (b)) @@ -368,6 +376,22 @@ ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ; return((ret == 0.0)?1e-6:ret); } +#elif defined(VXWORKS) + { + static unsigned long tick_start, tick_end; + + if( s == START ) + { + tick_start = tickGet(); + return 0; + } + else + { + tick_end = tickGet(); + ret = (double)(tick_end - tick_start) / (double)sysClkRateGet(); + return((ret == 0.0)?1e-6:ret); + } + } #else /* !times() */ static struct timeb tstart,tend; long i; diff -r -u -x Make* ./openssl-0.9.6c/apps/speed.c ./openssl-0.9.6c-vxworks/apps/speed.c --- ./openssl-0.9.6c/apps/speed.c Wed Apr 11 06:06:44 2001 +++ ./openssl-0.9.6c-vxworks/apps/speed.c Tue Feb 5 13:51:54 2002 @@ -84,10 +84,10 @@ #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) # define USE_TOD -#elif !defined(MSDOS) && (!defined(VMS) || defined(__DECC)) +#elif !defined(MSDOS) && !defined(VXWORKS) && (!defined(VMS) || defined(__DECC)) # define TIMES #endif -#if !defined(_UNICOS) && !defined(__OpenBSD__) && !defined(sgi) && !defined(__FreeBSD__) && !(defined(__bsdi) || defined(__bsdi__)) && !defined(_AIX) && !defined(MPE) && !defined(__NetBSD__) +#if !defined(_UNICOS) && !defined(__OpenBSD__) && !defined(sgi) && !defined(__FreeBSD__) && !(defined(__bsdi) || defined(__bsdi__)) && !defined(_AIX) && !defined(MPE) && !defined(__NetBSD__) && !defined(VXWORKS) # define TIMEB #endif @@ -115,7 +115,7 @@ #include <sys/timeb.h> #endif -#if !defined(TIMES) && !defined(TIMEB) && !defined(USE_TOD) +#if !defined(TIMES) && !defined(TIMEB) && !defined(USE_TOD) && !defined(VXWORKS) #error "It seems neither struct tms nor struct timeb is supported in this platform!" #endif @@ -303,6 +303,25 @@ } } # endif + +# ifdef VXWORKS + { + static unsigned long tick_start, tick_end; + + if( s == START ) + { + tick_start = tickGet(); + return 0; + } + else + { + tick_end = tickGet(); + ret = (double)(tick_end - tick_start) / (double)sysClkRateGet(); + return((ret < 0.001)?0.001:ret); + } + } +# endif + #endif } diff -r -u -x Make* ./openssl-0.9.6c/crypto/bio/bss_bio.c ./openssl-0.9.6c-vxworks/crypto/bio/bss_bio.c --- ./openssl-0.9.6c/crypto/bio/bss_bio.c Thu Aug 16 11:30:37 2001 +++ ./openssl-0.9.6c-vxworks/crypto/bio/bss_bio.c Tue Feb 5 10:04:21 2002 @@ -23,8 +23,13 @@ #include <openssl/crypto.h> #include "openssl/e_os.h" -#ifndef SSIZE_MAX + +/* VxWorks defines SSiZE_MAX with an empty value causing compile errors */ +#if defined(VXWORKS) +# undef SSIZE_MAX # define SSIZE_MAX INT_MAX +#elif !defined(SSIZE_MAX) +# define SSIZE_MAX _INT_MAX #endif static int bio_new(BIO *bio); @@ -255,7 +260,7 @@ ssize_t num, available; if (num_ > SSIZE_MAX) - num = SSIZE_MAX; + num = SSIZE_MAX; else num = (ssize_t)num_; diff -r -u -x Make* ./openssl-0.9.6c/crypto/bio/bss_log.c ./openssl-0.9.6c-vxworks/crypto/bio/bss_log.c --- ./openssl-0.9.6c/crypto/bio/bss_log.c Thu Aug 17 19:15:53 2000 +++ ./openssl-0.9.6c-vxworks/crypto/bio/bss_log.c Tue Feb 5 09:42:52 2002 @@ -75,7 +75,7 @@ # include <starlet.h> #elif defined(__ultrix) # include <sys/syslog.h> -#elif !defined(MSDOS) /* Unix */ +#elif !defined(MSDOS) && !defined(VXWORKS) /* Unix */ # include <syslog.h> #endif diff -r -u -x Make* ./openssl-0.9.6c/crypto/des/read_pwd.c ./openssl-0.9.6c-vxworks/crypto/des/read_pwd.c --- ./openssl-0.9.6c/crypto/des/read_pwd.c Thu Sep 21 01:42:00 2000 +++ ./openssl-0.9.6c-vxworks/crypto/des/read_pwd.c Tue Feb 5 09:32:41 2002 @@ -56,7 +56,7 @@ * [including the GNU Public Licence.] */ -#if !defined(MSDOS) && !defined(VMS) && !defined(WIN32) +#if !defined(MSDOS) && !defined(VMS) && !defined(WIN32) && !defined(VXWORKS) #include <openssl/opensslconf.h> #ifdef OPENSSL_UNISTD # include OPENSSL_UNISTD @@ -133,6 +133,12 @@ #define SGTTY #endif +#if defined(VXWORKS) +#undef TERMIOS +#undef TERMIO +#undef SGTTY +#endif + #ifdef TERMIOS #include <termios.h> #define TTY_STRUCT struct termios @@ -240,7 +246,7 @@ long status; unsigned short channel = 0; #else -#ifndef MSDOS +#if !defined(MSDOS) && !defined(VXWORKS) TTY_STRUCT tty_orig,tty_new; #endif #endif @@ -268,7 +274,7 @@ #ifdef MSDOS if ((tty=fopen("con","r")) == NULL) tty=stdin; -#elif defined(MAC_OS_pre_X) +#elif defined(MAC_OS_pre_X) || defined(VXWORKS) tty=stdin; #else #ifndef MPE diff -r -u -x Make* ./openssl-0.9.6c/crypto/opensslconf.h ./openssl-0.9.6c-vxworks/crypto/opensslconf.h --- ./openssl-0.9.6c/crypto/opensslconf.h Thu Dec 20 21:54:43 2001 +++ ./openssl-0.9.6c-vxworks/crypto/opensslconf.h Tue Feb 5 14:00:25 2002 @@ -6,6 +6,9 @@ /* no ciphers excluded */ #endif #ifdef OPENSSL_THREAD_DEFINES +# ifndef THREADS +# define THREADS +# endif #endif #ifdef OPENSSL_OTHER_DEFINES #endif diff -r -u -x Make* ./openssl-0.9.6c/crypto/rand/rand_egd.c ./openssl-0.9.6c-vxworks/crypto/rand/rand_egd.c --- ./openssl-0.9.6c/crypto/rand/rand_egd.c Wed Mar 21 09:10:47 2001 +++ ./openssl-0.9.6c-vxworks/crypto/rand/rand_egd.c Tue Feb 5 10:06:59 2002 @@ -75,7 +75,11 @@ #include <sys/types.h> #include <sys/socket.h> #ifndef NO_SYS_UN_H -#include <sys/un.h> +# ifdef VXWORKS +# include <streams/un.h> +# else +# include <sys/un.h> +# endif #else struct sockaddr_un { short sun_family; /* AF_UNIX */ diff -r -u -x Make* ./openssl-0.9.6c/crypto/rsa/rsa.h ./openssl-0.9.6c-vxworks/crypto/rsa/rsa.h --- ./openssl-0.9.6c/crypto/rsa/rsa.h Mon Dec 17 14:24:20 2001 +++ ./openssl-0.9.6c-vxworks/crypto/rsa/rsa.h Tue Feb 5 13:18:44 2002 @@ -101,9 +101,14 @@ * compatibility this functionality is only enabled if the RSA_FLAG_SIGN_VER * option is set in 'flags'. */ - int (*rsa_sign)(int type, unsigned char *m, unsigned int m_len, + +/* changed m_len to m_length to avoid a conflict with a #define in + vxworks for m_len for the mbuf code. This only shows up in apps + that have USE_SOCKETS defined */ + + int (*rsa_sign)(int type, unsigned char *m, unsigned int m_length, unsigned char *sigret, unsigned int *siglen, RSA *rsa); - int (*rsa_verify)(int dtype, unsigned char *m, unsigned int m_len, + int (*rsa_verify)(int dtype, unsigned char *m, unsigned int m_length, unsigned char *sigbuf, unsigned int siglen, RSA *rsa); } RSA_METHOD; @@ -226,16 +231,16 @@ /* The following 2 functions sign and verify a X509_SIG ASN1 object * inside PKCS#1 padded RSA encryption */ -int RSA_sign(int type, unsigned char *m, unsigned int m_len, +int RSA_sign(int type, unsigned char *m, unsigned int m_length, unsigned char *sigret, unsigned int *siglen, RSA *rsa); -int RSA_verify(int type, unsigned char *m, unsigned int m_len, +int RSA_verify(int type, unsigned char *m, unsigned int m_length, unsigned char *sigbuf, unsigned int siglen, RSA *rsa); /* The following 2 function sign and verify a ASN1_OCTET_STRING * object inside PKCS#1 padded RSA encryption */ -int RSA_sign_ASN1_OCTET_STRING(int type, unsigned char *m, unsigned int m_len, +int RSA_sign_ASN1_OCTET_STRING(int type, unsigned char *m, unsigned int m_length, unsigned char *sigret, unsigned int *siglen, RSA *rsa); -int RSA_verify_ASN1_OCTET_STRING(int type, unsigned char *m, unsigned int m_len, +int RSA_verify_ASN1_OCTET_STRING(int type, unsigned char *m, unsigned int m_length, unsigned char *sigbuf, unsigned int siglen, RSA *rsa); int RSA_blinding_on(RSA *rsa, BN_CTX *ctx); diff -r -u -x Make* ./openssl-0.9.6c/crypto/tmdiff.c ./openssl-0.9.6c-vxworks/crypto/tmdiff.c --- ./openssl-0.9.6c/crypto/tmdiff.c Thu Jun 1 18:16:23 2000 +++ ./openssl-0.9.6c-vxworks/crypto/tmdiff.c Tue Feb 5 09:19:23 2002 @@ -67,9 +67,11 @@ #ifndef MSDOS # ifndef WIN32 +# ifndef VXWORKS # if !defined(VMS) || defined(__DECC) # define TIMES # endif +# endif # endif #endif @@ -95,7 +97,7 @@ #include <sys/param.h> #endif -#ifndef TIMES +#if !defined(TIMES) && !defined(VXWORKS) #include <sys/timeb.h> #endif @@ -125,7 +127,11 @@ HANDLE thread_id; FILETIME ms_win32; # else +# ifdef VXWORKS + unsigned long ticks; +# else struct timeb ms_timeb; +# endif # endif #endif } MS_TM; @@ -163,7 +169,11 @@ # ifdef WIN32 GetThreadTimes(tm->thread_id,&tmpa,&tmpb,&tmpc,&(tm->ms_win32)); # else +# ifdef VXWORKS + tm->ticks = tickGet(); +# else ftime(&tm->ms_timeb); +# endif # endif #endif } @@ -193,10 +203,14 @@ ret=((double)(lb-la))/1e7; } # else +# ifdef VXWORKS + ret = (double)(b->ticks - a->ticks) / (double)sysClkRateGet(); +# else ret= (double)(b->ms_timeb.time-a->ms_timeb.time)+ (((double)b->ms_timeb.millitm)- ((double)a->ms_timeb.millitm))/1000.0; # endif +# endif #endif return((ret < 0.0000001)?0.0000001:ret); } @@ -214,9 +228,13 @@ d =(b->ms_win32.dwHighDateTime&0x000fffff)*10+b->ms_win32.dwLowDateTime/1e 7; d-=(a->ms_win32.dwHighDateTime&0x000fffff)*10+a->ms_win32.dwLowDateTime/ 1e7; # else +# ifdef VXWORKS + d = (b->ticks - a->ticks); +# else d= (double)(b->ms_timeb.time-a->ms_timeb.time)+ (((double)b->ms_timeb.millitm)-(double)a->ms_timeb.millitm)/1000.0; # endif +# endif #endif if (d == 0.0) ret=0; diff -r -u -x Make* ./openssl-0.9.6c/e_os.h ./openssl-0.9.6c-vxworks/e_os.h --- ./openssl-0.9.6c/e_os.h Thu Nov 8 09:36:49 2001 +++ ./openssl-0.9.6c-vxworks/e_os.h Tue Feb 5 13:18:50 2002 @@ -82,6 +82,12 @@ #define DEVRANDOM "/dev/urandom" #endif +#if defined(VXWORKS) +# define NO_SYS_PARAM_H +# define NO_CHMOD +# define NO_SYSLOG +#endif + #if defined(__MWERKS__) && defined(macintosh) # if macintosh==1 # ifndef MAC_OS_GUSI_SOURCE @@ -348,7 +354,9 @@ # ifndef NO_SYS_PARAM_H # include <sys/param.h> # endif -# ifndef MPE +# ifdef VXWORKS +# include <time.h> +# elif defined(MPE) # include <sys/time.h> /* Needed under linux for FD_XXX */ # endif ---------------- patchfile end ------------------------------------------------------------------------ ------ ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]