Add a few more VxWorks targets.
authorRichard Levitte <levitte@openssl.org>
Wed, 9 Oct 2002 13:41:31 +0000 (13:41 +0000)
committerRichard Levitte <levitte@openssl.org>
Wed, 9 Oct 2002 13:41:31 +0000 (13:41 +0000)
Correct misspelled VXWORKS macros.
Add VXWORKS identifying macros to e_os2.h.
Add required inclusions and mappings for VxWorks in e_os.h.
A few small modifications to make OpenSSL build and work on VxWorks.
PR: 253, except for the  change that was handled in an earlier
         commit, and a request for easy build of just parts of OpenSSL.

Configure
crypto/bio/bss_bio.c
crypto/conf/conf_def.c
crypto/des/read_pwd.c
crypto/rand/rand_egd.c
crypto/rand/rand_unix.c
crypto/tmdiff.c
crypto/ui/ui_openssl.c
crypto/uid.c
e_os.h
e_os2.h

index 292ca877c6525cab1c4c93e5c74ecc58720dfcef..f29b957d129762c44d2cb90a9db187f54e0f5e01 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -558,6 +558,8 @@ my %table=(
 
 ##### VxWorks for various targets
 "vxworks-ppc405","ccppc:-g -msoft-float -mlongcall -DCPU=PPC405 -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::",
+"vxworks-ppc750","ccppc:-ansi -nostdinc -DPPC750 -D_REENTRANT -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall -DCPU=PPC604 -I\$(WIND_BASE)/target/h \$(DEBUG_FLAG):::VXWORKS:-r:::::",
+"vxworks-ppc750-debug","ccppc:-ansi -nostdinc -DPPC750 -D_REENTRANT -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall -DCPU=PPC604 -I\$(WIND_BASE)/target/h -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DDEBUG -g:::VXWORKS:-r:::::",
 
 );
 
index 1c485a4479ae62705710ac9856ba455aa6876e14..67b1279b99a790ef520b79638b9c3cb37d9f7796 100644 (file)
@@ -34,7 +34,7 @@
 #include "e_os.h"
 
 /* VxWorks defines SSIZE_MAX with an empty value causing compile errors */
-#if defined(OPENSSL_SYS_VSWORKS)
+#if defined(OPENSSL_SYS_VXWORKS)
 # undef SSIZE_MAX
 #endif
 #ifndef SSIZE_MAX
index 5e194de60e940b9a1d3cf5fe034f1cddb388a30d..80ac97526db3fe877e245bad142d7458bb95f8cf 100644 (file)
@@ -208,7 +208,8 @@ static int def_load(CONF *conf, const char *name, long *line)
 
 static int def_load_bio(CONF *conf, BIO *in, long *line)
        {
-#define BUFSIZE        512
+/* The macro BUFSIZE conflicts with a system macro in VxWorks */
+#define CONFBUFSIZE    512
        int bufnum=0,i,ii;
        BUF_MEM *buff=NULL;
        char *s,*p,*end;
@@ -255,15 +256,15 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
        for (;;)
                {
                again=0;
-               if (!BUF_MEM_grow(buff,bufnum+BUFSIZE))
+               if (!BUF_MEM_grow(buff,bufnum+CONFBUFSIZE))
                        {
                        CONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_BUF_LIB);
                        goto err;
                        }
                p= &(buff->data[bufnum]);
                *p='\0';
-               BIO_gets(in, p, BUFSIZE-1);
-               p[BUFSIZE-1]='\0';
+               BIO_gets(in, p, CONFBUFSIZE-1);
+               p[CONFBUFSIZE-1]='\0';
                ii=i=strlen(p);
                if (i == 0) break;
                while (i > 0)
index 9061935f217623506f2f058c3d14119d42586aaf..b893a1b03a3ed8af121de384f81c31e0a68d41de 100644 (file)
 #define SGTTY
 #endif
 
-#if defined(OPENSSL_SYS_VSWORKS)
+#if defined(OPENSSL_SYS_VXWORKS)
 #undef TERMIOS
 #undef TERMIO
 #undef SGTTY
@@ -274,7 +274,7 @@ int des_read_pw(char *buf, char *buff, int size, const char *prompt,
 #ifdef OPENSSL_SYS_MSDOS
        if ((tty=fopen("con","r")) == NULL)
                tty=stdin;
-#elif defined(MAC_OS_pre_X) || defined(OPENSSL_SYS_VSWORKS)
+#elif defined(MAC_OS_pre_X) || defined(OPENSSL_SYS_VXWORKS)
        tty=stdin;
 #else
 #ifndef OPENSSL_SYS_MPE
index 668c785f00700f18e06389059f0abaa74746330d..d7dad3efd02c239e37ed520d6e39938618b86051 100644 (file)
@@ -114,7 +114,7 @@ int RAND_egd_bytes(const char *path,int bytes)
 #include <sys/types.h>
 #include <sys/socket.h>
 #ifndef NO_SYS_UN_H
-# ifdef OPENSSL_SYS_VSWORKS
+# ifdef OPENSSL_SYS_VXWORKS
 #   include <streams/un.h>
 # else
 #   include <sys/un.h>
index ec09d74603c672b82edb994cbc9f08838cf3f06e..7de21d37d07acd88f9f566371c1c1579af566e0d 100644 (file)
 #include <openssl/rand.h>
 #include "rand_lcl.h"
 
-#if !(defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2))
+#if !(defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_VXWORKS))
 
 #include <sys/types.h>
 #include <sys/time.h>
index 7ebf2b202a08096ad7d221b7c1ef5a321fae5241..8d76314120eb7474eb2730a932c34b3f670d28b4 100644 (file)
@@ -65,7 +65,7 @@
 #undef TIMES
 #endif
 
-#if !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN32) && !defined(OPENSSL_SYS_VMS) || defined(__DECC) && !defined(OPENSSL_SYS_MACOSX) && !defined(OPENSSL_SYS_VXWORKS)
+#if !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN32) && !(defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) && !defined(OPENSSL_SYS_VXWORKS)
 # define TIMES
 #endif
 
@@ -121,7 +121,7 @@ typedef struct ms_tm
        HANDLE thread_id;
        FILETIME ms_win32;
 #  else
-#    ifdef OPENSSL_SYS_VSWORKS
+#    ifdef OPENSSL_SYS_VXWORKS
           unsigned long ticks;
 #    else
        struct timeb ms_timeb;
@@ -163,7 +163,7 @@ void ms_time_get(char *a)
 #  ifdef OPENSSL_SYS_WIN32
        GetThreadTimes(tm->thread_id,&tmpa,&tmpb,&tmpc,&(tm->ms_win32));
 #  else
-#    ifdef OPENSSL_SYS_VSWORKS
+#    ifdef OPENSSL_SYS_VXWORKS
         tm->ticks = tickGet();
 #    else
        ftime(&tm->ms_timeb);
@@ -197,7 +197,7 @@ double ms_time_diff(char *ap, char *bp)
        ret=((double)(lb-la))/1e7;
        }
 # else
-#  ifdef OPENSSL_SYS_VSWORKS
+#  ifdef OPENSSL_SYS_VXWORKS
         ret = (double)(b->ticks - a->ticks) / (double)sysClkRateGet();
 #  else
        ret=     (double)(b->ms_timeb.time-a->ms_timeb.time)+
@@ -222,7 +222,7 @@ int ms_time_cmp(char *ap, char *bp)
        d =(b->ms_win32.dwHighDateTime&0x000fffff)*10+b->ms_win32.dwLowDateTime/1e7;
        d-=(a->ms_win32.dwHighDateTime&0x000fffff)*10+a->ms_win32.dwLowDateTime/1e7;
 # else
-#  ifdef OPENSSL_SYS_VSWORKS
+#  ifdef OPENSSL_SYS_VXWORKS
         d = (b->ticks - a->ticks);
 #  else
        d=       (double)(b->ms_timeb.time-a->ms_timeb.time)+
index f47ed31cb02476344f1bd000b6a4b12356fffc0a..f967ba75d02f84ca52b0c9c824442c3fd89c6d7a 100644 (file)
 # define SGTTY
 #endif
 
-#if defined(OPENSSL_SYS_VSWORKS)
+#if defined(OPENSSL_SYS_VXWORKS)
 #undef TERMIOS
 #undef TERMIO
 #undef SGTTY
@@ -450,7 +450,7 @@ static int open_console(UI *ui)
        CRYPTO_w_lock(CRYPTO_LOCK_UI);
        is_a_tty = 1;
 
-#if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VSWORKS)
+#if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS)
        tty_in=stdin;
        tty_out=stderr;
 #else
index d3d249c36fd5cd406fd28935712e4cb93ac1012f..73205a4baa93cefa7e9089215a513d6888b2a407 100644 (file)
@@ -65,7 +65,7 @@ int OPENSSL_issetugid(void)
        return issetugid();
        }
 
-#elif defined(OPENSSL_SYS_WIN32)
+#elif defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VXWORKS)
 
 int OPENSSL_issetugid(void)
        {
diff --git a/e_os.h b/e_os.h
index 00edebe6d47c568e12fcc871c9d7356d751df770..6d326e54e3e01d3dffe6d65ffe589885e9605cf0 100644 (file)
--- a/e_os.h
+++ b/e_os.h
@@ -485,6 +485,36 @@ extern char *sys_errlist[]; extern int sys_nerr;
 # define strcasecmp stricmp
 #endif
 
+/* vxworks */
+#if defined(OPENSSL_SYS_VXWORKS)
+#include <ioLib.h>
+#include <tickLib.h>
+#include <sysLib.h>
+
+#define TTY_STRUCT int
+
+#define sleep(a) taskDelay((a) * sysClkRateGet())
+#if defined(ioctlsocket)
+#undef ioctlsocket
+#endif
+#define ioctlsocket(a,b,c) ioctl((a),(b),*(c))
+
+#include <vxWorks.h>
+#include <sockLib.h>
+#include <taskLib.h>
+
+#define getpid taskIdSelf
+
+/* NOTE: these are implemented by helpers in database app!
+ * if the database is not linked, we need to implement them
+ * elswhere */
+struct hostent *gethostbyname(const char *name);
+struct hostent *gethostbyaddr(const char *addr, int length, int type);
+struct servent *getservbyname(const char *name, const char *proto);
+
+#endif
+/* end vxworks */
+
 #ifdef  __cplusplus
 }
 #endif
diff --git a/e_os2.h b/e_os2.h
index ff68d5b94aae707c5a8180a9b6d39a21fb3e46a2..8db74f830084a193470b38b501d3a0f235ae3386 100644 (file)
--- a/e_os2.h
+++ b/e_os2.h
@@ -178,6 +178,11 @@ extern "C" {
 # endif
 #endif
 
+/* ------------------------------- VxWorks --------------------------------- */
+#ifdef OPENSSL_SYSNAME_VXWORKS
+# define OPENSSL_SYS_VXWORKS
+#endif
+
 /**
  * That's it for OS-specific stuff
  *****************************************************************************/