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 ffb901898e68781ffb9c7301d350751abe8d000b..b429f78c39b205bd724356fc927708b968263dcc 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 74cda563e8c7dd7ef72b551b27e5f7e42748468c..2827a458c0b92cf122f9900c474263dd0137ff9f 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 ea7ac764b06498dc095980116b4dea95491e9f6f..0f6c63d22d131a7c80408e0dc47766f941a9c5df 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 2cbe16bfd5fc4e8d36940ba8d90546549a703ae3..f8de94291dc73bacc5186d0aa9db13b24d5c1b55 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);