Some changes to support VxWorks in the validted module.
authorDr. Stephen Henson <steve@openssl.org>
Sun, 1 May 2011 15:36:54 +0000 (15:36 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Sun, 1 May 2011 15:36:54 +0000 (15:36 +0000)
Configure
config
fips/fips_canister.c
fips/rand/fips_rand.c

index ffb9018..b429f78 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -591,6 +591,8 @@ my %table=(
 "OS2-EMX", "gcc::::::::",
 
 ##### VxWorks for various targets
+"vxworks-ppc60x","ccppc:-D_REENTRANT -mrtp -mhard-float -mstrict-align -fno-implicit-fp -DPPC32_fp60x -O2 -fstrength-reduce -fno-builtin -fno-strict-aliasing -Wall -DCPU=PPC32 -DTOOL_FAMILY=gnu -DTOOL=gnu -I\$(WIND_BASE)/target/usr/h -I\$(WIND_BASE)/target/usr/h/wrn/coreip:::VXWORKS:-Wl,--defsym,__wrs_rtp_base=0xe0000000 -L \$(WIND_BASE)/target/usr/lib/ppc/PPC32/common:::::",
+"vxworks-ppcgen","ccppc:-D_REENTRANT -mrtp -msoft-float -mstrict-align -O1 -fno-builtin -fno-strict-aliasing -Wall -DCPU=PPC32 -DTOOL_FAMILY=gnu -DTOOL=gnu -I\$(WIND_BASE)/target/usr/h -I\$(WIND_BASE)/target/usr/h/wrn/coreip:::VXWORKS:-Wl,--defsym,__wrs_rtp_base=0xe0000000 -L \$(WIND_BASE)/target/usr/lib/ppc/PPC32/sfcommon:::::",
 "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:::::",
diff --git a/config b/config
index 74cda56..2827a45 100755 (executable)
--- a/config
+++ b/config
@@ -370,6 +370,10 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
     NONSTOP_KERNEL*)
        echo "nsr-tandem-nsk"; exit 0;
        ;;
+
+    vxworks*)
+       echo "${MACHINE}-whatever-vxworks"; exit 0;
+       ;;
 esac
 
 #
@@ -583,6 +587,8 @@ case "$GUESSOS" in
        OUT="linux-ppc"
        ;;
   ppc-*-linux2) OUT="linux-ppc" ;;
+  ppc60x-*-vxworks*) OUT="vxworks-ppc60x" ;;
+  ppcgen-*-vxworks*) OUT="vxworks-ppcgen" ;;
   ia64-*-linux?) OUT="linux-ia64" ;;
   sparc64-*-linux2)
        echo "WARNING! If you *know* that your GNU C supports 64-bit/V9 ABI"
index ea7ac76..0f6c63d 100644 (file)
@@ -177,6 +177,8 @@ const void *FIPS_ref_point()
 # else
     return (void *)FIPS_ref_point;
 # endif
+#elif  defined(__vxworks)
+    return (void *)FIPS_ref_point;
 /*
  * In case you wonder why there is no #ifdef __linux. All Linux targets
  * are GCC-based and therefore are covered by instruction_pointer above
index 2cbe16b..f8de942 100644 (file)
 #include <openssl/aes.h>
 #include <openssl/err.h>
 #include <openssl/fips_rand.h>
-#ifndef OPENSSL_SYS_WIN32
-#include <sys/time.h>
+#if !(defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VXWORKS))
+# include <sys/time.h>
+#endif
+#if defined(OPENSSL_SYS_VXWORKS)
+# include <time.h>
 #endif
 #include <assert.h>
 #ifndef OPENSSL_SYS_WIN32
@@ -225,6 +228,8 @@ void FIPS_get_timevec(unsigned char *buf, unsigned long *pctr)
        {
 #ifdef OPENSSL_SYS_WIN32
        FILETIME ft;
+#elif defined(OPENSSL_SYS_VXWORKS)
+        struct timespec ts;
 #else
        struct timeval tv;
 #endif
@@ -243,6 +248,16 @@ void FIPS_get_timevec(unsigned char *buf, unsigned long *pctr)
        buf[5] = (unsigned char) ((ft.dwLowDateTime >> 8) & 0xff);
        buf[6] = (unsigned char) ((ft.dwLowDateTime >> 16) & 0xff);
        buf[7] = (unsigned char) ((ft.dwLowDateTime >> 24) & 0xff);
+#elif defined(OPENSSL_SYS_VXWORKS)
+       clock_gettime(CLOCK_REALTIME, &ts);
+       buf[0] = (unsigned char) (ts.tv_sec & 0xff);
+       buf[1] = (unsigned char) ((ts.tv_sec >> 8) & 0xff);
+       buf[2] = (unsigned char) ((ts.tv_sec >> 16) & 0xff);
+       buf[3] = (unsigned char) ((ts.tv_sec >> 24) & 0xff);
+       buf[4] = (unsigned char) (ts.tv_nsec & 0xff);
+       buf[5] = (unsigned char) ((ts.tv_nsec >> 8) & 0xff);
+       buf[6] = (unsigned char) ((ts.tv_nsec >> 16) & 0xff);
+       buf[7] = (unsigned char) ((ts.tv_nsec >> 24) & 0xff);
 #else
        gettimeofday(&tv,NULL);
        buf[0] = (unsigned char) (tv.tv_sec & 0xff);