From: Dr. Stephen Henson Date: Sun, 1 May 2011 15:36:54 +0000 (+0000) Subject: Some changes to support VxWorks in the validted module. X-Git-Tag: OpenSSL-fips-2_0-rc1~491 X-Git-Url: https://git.openssl.org/?p=openssl.git;a=commitdiff_plain;h=2f6efd6acbbf307787f54db637f250cb9c98dac6 Some changes to support VxWorks in the validted module. --- diff --git a/Configure b/Configure index ffb901898e..b429f78c39 100755 --- 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 74cda563e8..2827a458c0 100755 --- 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" diff --git a/fips/fips_canister.c b/fips/fips_canister.c index ea7ac764b0..0f6c63d22d 100644 --- a/fips/fips_canister.c +++ b/fips/fips_canister.c @@ -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 diff --git a/fips/rand/fips_rand.c b/fips/rand/fips_rand.c index 2cbe16bfd5..f8de94291d 100644 --- a/fips/rand/fips_rand.c +++ b/fips/rand/fips_rand.c @@ -66,8 +66,11 @@ #include #include #include -#ifndef OPENSSL_SYS_WIN32 -#include +#if !(defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VXWORKS)) +# include +#endif +#if defined(OPENSSL_SYS_VXWORKS) +# include #endif #include #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);