From 292c1f34ec27f95fdc3c9dfa5c2df93dde7861e0 Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Mon, 11 May 2015 11:56:30 +0200 Subject: [PATCH] Additional vxWorks target. Reviewed-by: Dr. Stephen Henson (cherry picked from commit 50e2a0ea4615124aa159e8f43317dedcf0cfcaa2) --- Configure | 1 + config | 5 ++++ test/fips_algvs.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+) diff --git a/Configure b/Configure index 65e06f330a..38119577be 100755 --- a/Configure +++ b/Configure @@ -615,6 +615,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 12f903048a..5c8053946b 100755 --- a/config +++ b/config @@ -375,6 +375,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; ;; @@ -605,6 +609,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" ;; diff --git a/test/fips_algvs.c b/test/fips_algvs.c index ed0350720a..1b463ea039 100644 --- a/test/fips_algvs.c +++ b/test/fips_algvs.c @@ -70,6 +70,67 @@ int main(int argc, char **argv) } #else +#if defined(__vxworks) + +#include +#include + +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); -- 2.25.1