The attached patch includes VxWorks improvements (MIPS support and other
additions) detailed below. The patch was diff'd against
"openssl-0.9.7-stable-SNAP-20030928.tar.gz", which I thought was the same as
the OpenSSL_0_9_7-stable branch (at the time).

Added support for building OpenSSL for VxWorks for MIPS32 little endian
(only MIPS platform I am able to try, but I suspect big endian would just
need the endian flags set to BE/MIPSBE). Added -nostdinc to the
vxworks-ppc860 Configure line (I am not able to test the other
configurations so I didn't touch them) to avoid problems picking up system
headers instead of the VxWorks versions if you have both installed.

Added VxWorks section to e_os.h for socket-related macros to override the
defaults: Change writesocket to cast the buffer parameter to char * to avoid
const char * -> char * warnings due to VxWorks headers prototyping write to
take a char * (write doesn't modify the buffer).

Changed the ioctlsocket macro to cast its argument to an int instead of
dereferencing it. My previous patch fixed compilation problems, but kept the
same semantics (dereferencing). This patch changes the semantics, but I
think it is more correct because the original implementation made it
difficult to use value-result parameters (e.g. FIONREAD, which takes an int
* so you had to pass ioctlsocket an int ** for it work, unlike other
platforms). This change basically makes ioctlsocket for VxWorks work like
all other platforms. If people were using ioctlsocket on VxWorks with
arguments and relying on the dereference, they will need to change to not
doubly take the address after this patch. I suspect people are not using it
in this manner because the original version would not compile in that case.
Please let me know if you feel I am incorrect about this.

diff -ur openssl-orig/Configure openssl-work/Configure --- openssl-orig/Configure 2003-09-27 01:01:28.000000000 -0700 +++ openssl-work/Configure 2003-09-28 06:12:02.000000000 -0700 @@ -560,7 +560,8 @@ "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:::::", -"vxworks-ppc860","ccppc:-g -msoft-float -DCPU=PPC860 -DNO_STRINGS_H -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::", +"vxworks-ppc860","ccppc:-nostdinc -msoft-float -DCPU=PPC860 -DNO_STRINGS_H -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::", +"vxworks-mipsle","ccmips:-B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -DL_ENDIAN -EL -Wl,-EL -mips2 -mno-branch-likely -G 0 -fno-builtin -msoft-float -DCPU=MIPS32 -DMIPSEL -DNO_STRINGS_H -I\$(WIND_BASE)/target/h:::VXWORKS:-r::::::::::::::::ranlibmips:", ##### Compaq Non-Stop Kernel (Tandem) "tandem-c89","c89:-Ww -D__TANDEM -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -D_TANDEM_SOURCE -DB_ENDIAN::(unknown):::THIRTY_TWO_BIT:::", diff -ur openssl-orig/e_os.h openssl-work/e_os.h --- openssl-orig/e_os.h 2003-09-27 01:01:28.000000000 -0700 +++ openssl-work/e_os.h 2003-09-28 06:12:54.000000000 -0700 @@ -174,6 +174,13 @@ #define closesocket(s) close(s) #define readsocket(s,b,n) recv((s),(b),(n),0) #define writesocket(s,b,n) send((s),(b),(n),0) +#elif defined(OPENSSL_SYS_VXWORKS) +#define get_last_socket_error() errno +#define clear_socket_error() errno=0 +#define ioctlsocket(a,b,c) ioctl((a),(b),(int)(c)) +#define closesocket(s) close(s) +#define readsocket(s,b,n) read((s),(b),(n)) +#define writesocket(s,b,n) write((s),(char *)(b),(n)) #else #define get_last_socket_error() errno #define clear_socket_error() errno=0 @@ -519,10 +526,6 @@ #define TTY_STRUCT int #define sleep(a) taskDelay((a) * sysClkRateGet()) -#if defined(ioctlsocket) -#undef ioctlsocket -#endif -#define ioctlsocket(a,b,c) ioctl((a),(b),*(int*)(c)) #include #include

Reply via email to