Additional vxWorks target.
authorAndy Polyakov <appro@openssl.org>
Mon, 11 May 2015 09:56:30 +0000 (11:56 +0200)
committerAndy Polyakov <appro@openssl.org>
Wed, 13 May 2015 14:47:43 +0000 (16:47 +0200)
Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
Configure
config
test/fips_algvs.c

index 1959f98c67110183f6184f3f37eae39306c25db0..f51f7214288f337312b77d680746f43d78cbfd9f 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -605,6 +605,7 @@ my %table=(
 ##### 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-ppcgen-kernel","ccppc:-D_REENTRANT -msoft-float -mstrict-align -O1 -fno-builtin -fno-strict-aliasing -Wall -DCPU=PPC32 -DTOOL_FAMILY=gnu -DTOOL=gnu -I\$(WIND_BASE)/target/h -I\$(WIND_BASE)/target/h/wrn/coreip:::VXWORKS::::::",
 "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 db5fc82bcba3dbadc7348764ecd47ba0d5b86df3..07e231739267c33b7bd400dfca1a7d286c2eaf92 100755 (executable)
--- a/config
+++ b/config
@@ -383,6 +383,10 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
        echo "nsr-tandem-nsk"; exit 0;
        ;;
 
+    vxworks:kernel*)
+       echo "${MACHINE}-kernel-vxworks"; exit 0;
+       ;;
+
     vxworks*)
        echo "${MACHINE}-whatever-vxworks"; exit 0;
        ;;
@@ -613,6 +617,7 @@ case "$GUESSOS" in
        ;;
   ppc-*-linux2) OUT="linux-ppc" ;;
   ppc60x-*-vxworks*) OUT="vxworks-ppc60x" ;;
+  ppcgen-kernel-vxworks*) OUT="vxworks-ppcgen-kernel" ;;
   ppcgen-*-vxworks*) OUT="vxworks-ppcgen" ;;
   pentium-*-vxworks*) OUT="vxworks-pentium" ;;
   simlinux-*-vxworks*) OUT="vxworks-simlinux" ;;
index d47fb27dccbeb5481342fffa63a26c11edefbd61..170295f0b37fedbc5392e9a5197c95cba32a0da8 100644 (file)
@@ -70,6 +70,67 @@ int main(int argc, char **argv)
 }
 #else
 
+#if defined(__vxworks)
+
+#include <taskLibCommon.h>
+#include <string.h>
+
+int fips_algvs_main(int argc, char **argv);
+#define main fips_algvs_main
+
+static int fips_algvs_argv(char *a0)
+{
+       char *argv[32] = { "fips_algvs" };
+       int argc = 1;
+       int main_ret;
+
+       if (a0) {
+               char *scan = a0, *arg = a0;
+
+               while (*scan) {
+                       if (*scan++ == ' ') {
+                               scan[-1] = '\0';
+                               argv[argc++] = arg;
+                               if (argc == (sizeof(argv)/sizeof(argv[0])-1))
+                                       break;
+
+                               while (*scan == ' ') scan++;
+                               arg = scan;
+                       }
+               }
+               if (*scan == '\0') argv[argc++] = arg;
+       }
+
+       argv[argc] = NULL;
+
+       main_ret = fips_algvs_main(argc, argv);
+
+       if (a0) free(a0);
+
+       return main_ret;
+}
+
+int fips_algvs(int a0)
+{
+       return taskSpawn("fips_algvs", 100, (VX_FP_TASK | VX_SPE_TASK), 100000,
+                       (FUNCPTR)fips_algvs_argv,
+                       a0 ? strdup(a0) : 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+}
+
+static FILE *fips_fopen(const char *path, const char *mode)
+{
+       char fips_path [256];
+
+       if (path[0] != '/' && strlen(path) < (sizeof(fips_path)-8)) {
+               strcpy(fips_path,"/fips0/");
+               strcat(fips_path,path);
+               return fopen(fips_path,mode);
+       }
+       return fopen(path,mode);
+}
+#define fopen fips_fopen
+#endif
+
 #define FIPS_ALGVS
 
 extern int fips_aesavs_main(int argc, char **argv);