VxWorks support.
diff --git a/Configure b/Configure
index 0a8a27d..c857bed 100755
--- a/Configure
+++ b/Configure
@@ -524,6 +524,8 @@
 "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:::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-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:::::",
diff --git a/apps/speed.c b/apps/speed.c
index 85f559e..bfe9103 100644
--- a/apps/speed.c
+++ b/apps/speed.c
@@ -254,7 +254,7 @@
 # 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
 #endif
 
diff --git a/config b/config
index 91231f9..b8d81e4 100755
--- a/config
+++ b/config
@@ -362,6 +362,10 @@
     NONSTOP_KERNEL*)
        echo "nsr-tandem-nsk"; exit 0;
        ;;
+
+    vxworks*)
+       echo "${MACHINE}-whatever-vxworks"; exit 0;
+       ;;
 esac
 
 #
@@ -524,6 +528,8 @@
 	OUT="linux-ppc64"
 	;;
   ppc-*-linux2) OUT="linux-ppc" ;;
+  ppc60x-*-vxworks*) OUT="vxworks-ppc60x" ;;
+  ppcgen-*-vxworks*) OUT="vxworks-ppcgen" ;;
   ia64-*-linux?) OUT="linux-ia64" ;;
   sparc64-*-linux2)
 	OUT="linux64-sparcv9" ;;
diff --git a/crypto/rand/rand_unix.c b/crypto/rand/rand_unix.c
index 6c2be5c..41259f3 100644
--- a/crypto/rand/rand_unix.c
+++ b/crypto/rand/rand_unix.c
@@ -323,8 +323,43 @@
 
 
 #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)
-	{
+{
+	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
diff --git a/crypto/rand/randfile.c b/crypto/rand/randfile.c
index cec5880..abe580a 100644
--- a/crypto/rand/randfile.c
+++ b/crypto/rand/randfile.c
@@ -56,8 +56,6 @@
  * [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 <stdio.h>
@@ -69,6 +67,10 @@
 #include <openssl/rand.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
 #include <unixio.h>
 #endif
diff --git a/crypto/ui/ui_openssl.c b/crypto/ui/ui_openssl.c
index 1f23a45..10111ef 100644
--- a/crypto/ui/ui_openssl.c
+++ b/crypto/ui/ui_openssl.c
@@ -122,7 +122,9 @@
  * sigaction and fileno included. -pedantic would be more appropriate for
  * 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 <stdio.h>
 #include <string.h>
diff --git a/fips/fips_canister.c b/fips/fips_canister.c
index 1744661..4b0a9e8 100644
--- a/fips/fips_canister.c
+++ b/fips/fips_canister.c
@@ -174,6 +174,8 @@
 # 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/mkfipsscr.pl b/fips/mkfipsscr.pl
index 8f1275c..16d4842 100644
--- a/fips/mkfipsscr.pl
+++ b/fips/mkfipsscr.pl
@@ -294,6 +294,10 @@
 		{
 		$win32 = 1;
 		}
+	if ($_ eq "--vxworks")
+		{
+		$vxworks = 1;
+		}
 	elsif ($_ eq "--onedir")
 		{
 		$onedir = 1;
@@ -332,6 +336,11 @@
 		}
 	}
 
+if ($win32 && $vxworks) {
+    print STDERR "Can't specify both --win32 and --vxworks\n";
+    exit(1);
+}
+
 $tvdir = "." unless defined $tvdir;
 
 if ($win32)
@@ -359,6 +368,21 @@
 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
+
+	}
 else
 	{
 	if ($onedir)
@@ -459,6 +483,16 @@
 md "$rsp"
 END
 		}
+	elsif ($vxworks)
+		{
+		print OUT <<END;
+
+echo Running tests in "$req"
+rm -r "$rsp"
+mkdir "$rsp"
+
+END
+		}
 	else
 		{
 		print OUT <<END;
@@ -484,6 +518,10 @@
 			$rsp =~ tr|/|\\|;
 			print OUT "$tprefix$tcmd \"$req\" \"$rsp\"\n";
 			}
+		elsif ($vxworks)
+			{
+			print OUT "run $tprefix$tcmd \"$req\" \"$rsp\"\n";
+			}
 		else
 			{
 			print OUT <<END;
@@ -518,7 +556,11 @@
 		{
 		$req =~ 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
 		{