VxWorks support.

This commit is contained in:
Dr. Stephen Henson 2011-09-25 18:11:42 +00:00
parent 8de14571d6
commit 0b603bcc34
8 changed files with 99 additions and 8 deletions

View file

@ -524,6 +524,8 @@ my %table=(
"OS2-EMX", "gcc::::::::", "OS2-EMX", "gcc::::::::",
##### VxWorks for various targets ##### 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:::linux_ppc32.o:::::::::::::::ranlibppc:",
"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:::linux_ppc32.o:::::::::::::::ranlibppc:",
"vxworks-ppc405","ccppc:-g -msoft-float -mlongcall -DCPU=PPC405 -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::", "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","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 -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DDEBUG -g:::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 -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DDEBUG -g:::VXWORKS:-r:::::",

View file

@ -254,7 +254,7 @@
# endif # endif
#endif #endif
#if !defined(OPENSSL_SYS_VMS) && !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MACINTOSH_CLASSIC) && !defined(OPENSSL_SYS_OS2) && !defined(OPENSSL_SYS_NETWARE) #if !defined(OPENSSL_SYS_VMS) && !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MACINTOSH_CLASSIC) && !defined(OPENSSL_SYS_OS2) && !defined(OPENSSL_SYS_NETWARE) && !defined(OPENSSL_SYS_VXWORKS)
# define HAVE_FORK 1 # define HAVE_FORK 1
#endif #endif

6
config
View file

@ -362,6 +362,10 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
NONSTOP_KERNEL*) NONSTOP_KERNEL*)
echo "nsr-tandem-nsk"; exit 0; echo "nsr-tandem-nsk"; exit 0;
;; ;;
vxworks*)
echo "${MACHINE}-whatever-vxworks"; exit 0;
;;
esac esac
# #
@ -524,6 +528,8 @@ case "$GUESSOS" in
OUT="linux-ppc64" OUT="linux-ppc64"
;; ;;
ppc-*-linux2) OUT="linux-ppc" ;; ppc-*-linux2) OUT="linux-ppc" ;;
ppc60x-*-vxworks*) OUT="vxworks-ppc60x" ;;
ppcgen-*-vxworks*) OUT="vxworks-ppcgen" ;;
ia64-*-linux?) OUT="linux-ia64" ;; ia64-*-linux?) OUT="linux-ia64" ;;
sparc64-*-linux2) sparc64-*-linux2)
OUT="linux64-sparcv9" ;; OUT="linux64-sparcv9" ;;

View file

@ -323,8 +323,43 @@ int RAND_poll(void)
#if defined(OPENSSL_SYS_VXWORKS) #if defined(OPENSSL_SYS_VXWORKS)
/* Note: the existence of /dev/urandom on VxWorks platforms is uncommon
* however we check for one and use it if found for those cases where
* it is present. */
int RAND_poll(void) int RAND_poll(void)
{ {
return 0; unsigned long l;
} #ifdef DEVRANDOM
unsigned char buf[ENTROPY_NEEDED];
int n = 0, r, fd;
if ((fd = open("/dev/urandom", O_RDONLY, 0)) >= 0)
{
do
{
r = read(fd,(unsigned char *)buf+n, ENTROPY_NEEDED-n);
if (r > 0)
n += r;
}
while ((r > 0 || errno == EINTR) && n < ENTROPY_NEEDED);
close(fd);
}
if (n > 0)
{
RAND_add(buf,sizeof buf,(double)n);
OPENSSL_cleanse(buf,n);
}
#endif
l=time(NULL);
RAND_add(&l,sizeof(l),0.0);
#if defined(DEVRANDOM)
return 1;
#else
return 0;
#endif
}
#endif #endif

View file

@ -56,8 +56,6 @@
* [including the GNU Public Licence.] * [including the GNU Public Licence.]
*/ */
/* We need to define this to get macros like S_IFBLK and S_IFCHR */
#define _XOPEN_SOURCE 500
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
@ -69,6 +67,10 @@
#include <openssl/rand.h> #include <openssl/rand.h>
#include <openssl/buffer.h> #include <openssl/buffer.h>
#if !defined(OPENSSL_SYS_VXWORKS)
/* We need to define this to get macros like S_IFBLK and S_IFCHR */
# define _XOPEN_SOURCE 500
#endif
#ifdef OPENSSL_SYS_VMS #ifdef OPENSSL_SYS_VMS
#include <unixio.h> #include <unixio.h>
#endif #endif

View file

@ -122,7 +122,9 @@
* sigaction and fileno included. -pedantic would be more appropriate for * sigaction and fileno included. -pedantic would be more appropriate for
* the intended purposes, but we can't prevent users from adding -ansi. * the intended purposes, but we can't prevent users from adding -ansi.
*/ */
#define _POSIX_C_SOURCE 1 #if !defined(OPENSSL_SYS_VXWORKS)
# define _POSIX_C_SOURCE 1
#endif
#include <signal.h> #include <signal.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>

View file

@ -174,6 +174,8 @@ void *FIPS_ref_point()
# else # else
return (void *)FIPS_ref_point; return (void *)FIPS_ref_point;
# endif # endif
#elif defined(__vxworks)
return (void *)FIPS_ref_point;
/* /*
* In case you wonder why there is no #ifdef __linux. All Linux targets * In case you wonder why there is no #ifdef __linux. All Linux targets
* are GCC-based and therefore are covered by instruction_pointer above * are GCC-based and therefore are covered by instruction_pointer above

View file

@ -294,6 +294,10 @@ foreach (@ARGV)
{ {
$win32 = 1; $win32 = 1;
} }
if ($_ eq "--vxworks")
{
$vxworks = 1;
}
elsif ($_ eq "--onedir") elsif ($_ eq "--onedir")
{ {
$onedir = 1; $onedir = 1;
@ -332,6 +336,11 @@ foreach (@ARGV)
} }
} }
if ($win32 && $vxworks) {
print STDERR "Can't specify both --win32 and --vxworks\n";
exit(1);
}
$tvdir = "." unless defined $tvdir; $tvdir = "." unless defined $tvdir;
if ($win32) if ($win32)
@ -356,6 +365,21 @@ rem Test vector run script
rem Auto generated by mkfipsscr.pl script rem Auto generated by mkfipsscr.pl script
rem Do not edit rem Do not edit
END
}
elsif ($vxworks)
{
# Always assume onedir.
$tprefix = "" unless defined $tprefix;
$outfile = "fipstests" unless defined $outfile;
open(OUT, ">$outfile");
print OUT <<END;
# Test vector run script
# Auto generated by mkfipsscr.pl script
# Do not edit
END END
} }
@ -457,6 +481,16 @@ sub test_dir
echo Running tests in $req echo Running tests in $req
if exist "$rsp" rd /s /q "$rsp" if exist "$rsp" rd /s /q "$rsp"
md "$rsp" md "$rsp"
END
}
elsif ($vxworks)
{
print OUT <<END;
echo Running tests in "$req"
rm -r "$rsp"
mkdir "$rsp"
END END
} }
else else
@ -484,6 +518,10 @@ sub test_line
$rsp =~ tr|/|\\|; $rsp =~ tr|/|\\|;
print OUT "$tprefix$tcmd \"$req\" \"$rsp\"\n"; print OUT "$tprefix$tcmd \"$req\" \"$rsp\"\n";
} }
elsif ($vxworks)
{
print OUT "run $tprefix$tcmd \"$req\" \"$rsp\"\n";
}
else else
{ {
print OUT <<END; print OUT <<END;
@ -518,7 +556,11 @@ END
{ {
$req =~ tr|/|\\|; $req =~ tr|/|\\|;
$rsp =~ tr|/|\\|; $rsp =~ tr|/|\\|;
print OUT "$tprefix$tcmd < \"$req\" > \"$rsp\"\n"; print OUT "$tprefix$tcmd < \"$req\" > \"$rsp\"\n";
}
elsif ($vxworks)
{
print OUT "run $tprefix$tcmd \"$req\" \"$rsp\"\n";
} }
else else
{ {