Hi, as offered in a previous discussion http://marc.info/?l=openssl-dev&m=122536319510494&w=2 I have updated the patch for Windows CE 5 and following support for the cvs repository, which represents the 0.9.9 version.
Please find attached the patch. I would like to give some additional comments on it: * The documentation file (INSTALL.WCE) states that there is another version available using a 'PortSDK'. Unfortunately all links referring to it are dead by now. I did not touch the documentation/code as I am unsure how the project is going to handle this situation (remove it or try to contact the author?) * I removed the statement that static linking is not possible for Windows CE as that is wrong and most people actually use static linking on Windows CE to avoid memory fragmentation. I do not know anything about the situation when using PortSDK though due to above reasons. * The change in dso_win32 is only to avoid a warning about a unused variable on Windows CE. * I needed to enable experimental-jpake support by default. The mkdef.pl script does not seem to be able to disable the functions and thus a .def file gets generated containing the declarations. As a consequence linking fails due to undefined references. Maybe someone with a deeper knowledge about this part can help me out, so that there is no need to auto-enable experimental parts. Note that the jpaketest.exe also reports error currently. * Unfortunately I needed to remove the /WX option as two warnings about implicit casts are reported during compilation. In case someone is interested in it, feel free to ask me, I can send you the compile output. Beside the jpaketest executable all other tests seem to pass. If you have any questions, feel free to contact me. Best Regards, Maurice Kalinowski -- Maurice Kalinowski - maurice.kalinowski (AT) nokia.com Software Engineer - Nokia, Qt Software Rudower Chaussee 13, 12489 Berlin, Germany
Index: INSTALL.WCE =================================================================== RCS file: /v/openssl/cvs/openssl/INSTALL.WCE,v retrieving revision 1.7 diff -d -u -r1.7 INSTALL.WCE --- INSTALL.WCE 6 Nov 2005 20:52:25 -0000 1.7 +++ INSTALL.WCE 21 Nov 2008 14:10:56 -0000 @@ -4,14 +4,16 @@ Building OpenSSL for Windows CE requires the following external tools: - * Microsoft eMbedded Visual C++ 3.0 or later + * Microsoft eMbedded Visual C++ 3.0 or Visual Studio 2005 and later * Appropriate SDK might be required * Perl for Win32 [commonly recommended ActiveState Perl is available - from http://www.activestate.com/Products/ActivePerl/] + from http://www.activestate.com/Products/ActivePerl/]. Note that + perl by MSYS does not create correct makefiles. * wcecompat compatibility library available at - http://www.essemer.com.au/windowsce/ - * Optionally ceutils for running automated tests (same location) + * www.essemer.com.au Windows CE 4.2 and earlier + * github.com/mauricek/wcecompat all Windows CE versions + * Optionally ceutils for running automated tests (www.essemer.com.au) _or_ @@ -20,11 +22,7 @@ * CMD command interpreter (same location) As Windows CE support in OpenSSL relies on 3rd party compatibility - library, it's appropriate to check corresponding URL for updates. For - example if you choose wcecompat, note that as for the moment of this - writing version 1.2 is available and actually required for WCE 4.2 - and newer platforms. All wcecompat issues should be directed to - www.essemer.com.au. + library, it's appropriate to check corresponding URL for updates. Why compatibility library at all? The C Runtime Library implementation for Windows CE that is included with Microsoft eMbedded Visual C++ is @@ -35,6 +33,10 @@ redirects IO to active sync link, while PortSDK - to NT-like console driver on the handheld itself. + With Windows CE 5 and following a lot of standard functionality has been + added to the core system, making some parts of the wcecompat lib deprecated. + More information is available at github.com/mauricek/wcecompat + Building -------- @@ -43,6 +45,10 @@ > "C:\Program Files\Microsoft eMbedded Tools\EVC\WCE300\BIN\WCEARM.BAT" + For Visual Studio 2005 and following there might be similar script depending + on the SDK OpenSSL is supposed to be build for. Follow the SDK documentation + to get more information how to setup a cross-compiler environment. + Next pick compatibility library according to your preferences. 1. To choose wcecompat set up WCECOMPAT environment variable pointing @@ -51,6 +57,10 @@ > set WCECOMPAT=C:\wcecompat > set PORTSDK_LIBPATH= + OpenSSL for Windows CE uses the same environment variables for compilation + as wcecompat does. Thus, there might be more settings needed. For more + information follow the wcecompat documentation. + 2. To choose PortSDK set up PORTSDK_LIBPATH to point at hardware- specific location where your portlib.lib is installed: @@ -75,10 +85,9 @@ > nmake -f ms\cedll.mak - [note that static builds are not supported under CE] - - If all is well it should compile and you will have some DLLs and executables - in out32dll*. + If all is well it should compile and you will have some static libraries and + executables in out32_xyz, or some DLLs and executables in out32dll_xyz where + xyz refers to the target processor architecture of the Windows CE SDK. <<< everyting below needs revision in respect to wcecompat vs. PortSDK >>> Index: e_os.h =================================================================== RCS file: /v/openssl/cvs/openssl/e_os.h,v retrieving revision 1.97 diff -d -u -r1.97 e_os.h --- e_os.h 3 Jan 2008 22:43:00 -0000 1.97 +++ e_os.h 21 Nov 2008 13:30:20 -0000 @@ -311,10 +311,6 @@ # include <io.h> # include <fcntl.h> -# ifdef OPENSSL_SYS_WINCE -# define OPENSSL_NO_POSIX_IO -# endif - # define ssize_t long # if defined (__BORLANDC__) @@ -459,7 +455,7 @@ /*************/ #ifdef USE_SOCKETS -# if defined(WINDOWS) || defined(MSDOS) +# if defined(WINDOWS) || defined(MSDOS) || defined(WINCE) /* windows world */ # ifdef OPENSSL_NO_SOCK @@ -468,7 +464,7 @@ # define SHUTDOWN(fd) close(fd) # define SHUTDOWN2(fd) close(fd) # elif !defined(__DJGPP__) -# if defined(_WIN32_WCE) && _WIN32_WCE<410 +# if defined(_WIN32_WCE) # define getservbyname _masked_declaration_getservbyname # endif # if !defined(IPPROTO_IP) @@ -640,7 +636,7 @@ #define IRIX_CC_BUG /* CDS++ up to V2.0Bsomething suffered from the same bug.*/ #endif -#if defined(OPENSSL_SYS_WINDOWS) +#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WINCE) # define strcasecmp _stricmp # define strncasecmp _strnicmp #elif defined(OPENSSL_SYS_VMS) Index: apps/apps.c =================================================================== RCS file: /v/openssl/cvs/openssl/apps/apps.c,v retrieving revision 1.131 diff -d -u -r1.131 apps.c --- apps/apps.c 16 Nov 2008 12:47:11 -0000 1.131 +++ apps/apps.c 21 Nov 2008 12:07:10 -0000 @@ -116,7 +116,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#ifndef OPENSSL_SYSNAME_WIN32 +#if !defined(OPENSSL_SYSNAME_WIN32) && !defined(OPENSSL_SYSNAME_WINCE) #include <strings.h> #endif #include <sys/types.h> Index: apps/ocsp.c =================================================================== RCS file: /v/openssl/cvs/openssl/apps/ocsp.c,v retrieving revision 1.52 diff -d -u -r1.52 ocsp.c --- apps/ocsp.c 5 Nov 2008 18:38:51 -0000 1.52 +++ apps/ocsp.c 21 Nov 2008 12:19:04 -0000 @@ -83,6 +83,9 @@ # include <novsock2.h> # endif #endif +#ifdef OPENSSL_SYSNAME_WINCE +#include <winsock2.h> +#endif /* Maximum leeway in validity period: default 5 minutes */ #define MAX_VALIDITY_PERIOD (5 * 60) Index: crypto/o_str.c =================================================================== RCS file: /v/openssl/cvs/openssl/crypto/o_str.c,v retrieving revision 1.12 diff -d -u -r1.12 o_str.c --- crypto/o_str.c 14 Jan 2008 18:10:55 -0000 1.12 +++ crypto/o_str.c 21 Nov 2008 08:12:27 -0000 @@ -60,7 +60,7 @@ #include <e_os.h> #include "o_str.h" -#if !defined(OPENSSL_IMPLEMENTS_strncasecmp) && !defined(OPENSSL_SYSNAME_WIN32) +#if !defined(OPENSSL_IMPLEMENTS_strncasecmp) && !defined(OPENSSL_SYSNAME_WIN32) && !defined(OPENSSL_SYS_WINCE) # include <strings.h> #endif Index: crypto/bio/b_sock.c =================================================================== RCS file: /v/openssl/cvs/openssl/crypto/bio/b_sock.c,v retrieving revision 1.49 diff -d -u -r1.49 b_sock.c --- crypto/bio/b_sock.c 3 Jan 2008 22:43:01 -0000 1.49 +++ crypto/bio/b_sock.c 21 Nov 2008 08:58:24 -0000 @@ -88,7 +88,7 @@ static int wsa_init_done=0; #endif -#if defined(OPENSSL_SYS_BEOS_BONE) +#if defined(OPENSSL_SYS_BEOS_BONE) || defined(OPENSSL_SYS_WINCE) /* BONE's IP6 support is incomplete */ #undef AF_INET6 #endif Index: crypto/dso/dso_win32.c =================================================================== RCS file: /v/openssl/cvs/openssl/crypto/dso/dso_win32.c,v retrieving revision 1.36 diff -d -u -r1.36 dso_win32.c --- crypto/dso/dso_win32.c 4 Jun 2008 11:53:14 -0000 1.36 +++ crypto/dso/dso_win32.c 21 Nov 2008 13:47:59 -0000 @@ -686,7 +686,9 @@ CREATETOOLHELP32SNAPSHOT create_snap; CLOSETOOLHELP32SNAPSHOT close_snap; MODULE32 module_first, module_next; +#if !defined(_WIN32_WCE) || _WIN32_WCE < 100 int len; +#endif if (addr == NULL) { Index: crypto/rsa/rsa_pss.c =================================================================== RCS file: /v/openssl/cvs/openssl/crypto/rsa/rsa_pss.c,v retrieving revision 1.7 diff -d -u -r1.7 rsa_pss.c --- crypto/rsa/rsa_pss.c 5 Nov 2008 18:39:02 -0000 1.7 +++ crypto/rsa/rsa_pss.c 21 Nov 2008 08:13:19 -0000 @@ -66,7 +66,7 @@ static const unsigned char zeroes[] = {0,0,0,0,0,0,0,0}; -#if defined(_MSC_VER) && defined(_ARM_) +#if defined(_MSC_VER) && defined(_ARM_) && (!defined(OPENSSL_SYS_WINCE) || _WIN32_WCE < 500) #pragma optimize("g", off) #endif Index: ms/do_ms.bat =================================================================== RCS file: /v/openssl/cvs/openssl/ms/do_ms.bat,v retrieving revision 1.6 diff -d -u -r1.6 do_ms.bat --- ms/do_ms.bat 17 May 2005 00:07:13 -0000 1.6 +++ ms/do_ms.bat 21 Nov 2008 10:53:28 -0000 @@ -1,9 +1,18 @@ - -perl util\mkfiles.pl >MINFO -perl util\mk1mf.pl no-asm VC-WIN32 >ms\nt.mak -perl util\mk1mf.pl dll no-asm VC-WIN32 >ms\ntdll.mak -perl util\mk1mf.pl no-asm VC-CE >ms\ce.mak -perl util\mk1mf.pl dll no-asm VC-CE >ms\cedll.mak - -perl util\mkdef.pl 32 libeay > ms\libeay32.def -perl util\mkdef.pl 32 ssleay > ms\ssleay32.def + + +perl util\mkfiles.pl >MINFO + +perl util\mk1mf.pl no-asm VC-WIN32 >ms\nt.mak + +perl util\mk1mf.pl dll no-asm VC-WIN32 >ms\ntdll.mak + +perl util\mk1mf.pl no-asm enable-experimental-jpake VC-CE >ms\ce.mak + +perl util\mk1mf.pl dll no-asm enable-experimental-jpake VC-CE >ms\cedll.mak + + + +perl util\mkdef.pl 32 libeay > ms\libeay32.def + +perl util\mkdef.pl 32 ssleay > ms\ssleay32.def + Index: util/mk1mf.pl =================================================================== RCS file: /v/openssl/cvs/openssl/util/mk1mf.pl,v retrieving revision 1.94 diff -d -u -r1.94 mk1mf.pl --- util/mk1mf.pl 12 Nov 2008 18:52:58 -0000 1.94 +++ util/mk1mf.pl 21 Nov 2008 13:33:41 -0000 @@ -62,7 +62,7 @@ "VC-WIN32", "Microsoft Visual C++ [4-6] - Windows NT or 9X", "VC-WIN64I", "Microsoft C/C++ - Win64/IA-64", "VC-WIN64A", "Microsoft C/C++ - Win64/x64", - "VC-CE", "Microsoft eMbedded Visual C++ 3.0 - Windows CE ONLY", + "VC-CE", "Microsoft eMbedded Visual C++ 3.0 and following - Windows CE ONLY", "VC-NT", "Microsoft Visual C++ [4-6] - Windows NT ONLY", "Mingw32", "GNU C++ - Windows NT or 9x", "Mingw32-files", "Create files with DOS copy ...", Index: util/pl/VC-32.pl =================================================================== RCS file: /v/openssl/cvs/openssl/util/pl/VC-32.pl,v retrieving revision 1.60 diff -d -u -r1.60 VC-32.pl --- util/pl/VC-32.pl 5 Jun 2008 23:42:04 -0000 1.60 +++ util/pl/VC-32.pl 21 Nov 2008 13:34:35 -0000 @@ -55,7 +55,6 @@ { # sanity check die '%OSVERSION% is not defined' if (!defined($ENV{'OSVERSION'})); - die '%PLATFORM% is not defined' if (!defined($ENV{'PLATFORM'})); die '%TARGETCPU% is not defined' if (!defined($ENV{'TARGETCPU'})); # @@ -64,11 +63,15 @@ $wcevers = $ENV{'OSVERSION'}; # WCENNN die '%OSVERSION% value is insane' if ($wcevers !~ /^WCE([1-9])([0-9]{2})$/); $wcecdefs = "-D_WIN32_WCE=$1$2 -DUNDER_CE=$1$2"; # -D_WIN32_WCE=NNN + $wcevers = substr($wcevers,3); $wcelflag = "/subsystem:windowsce,$1.$2"; # ...,N.NN - $wceplatf = $ENV{'PLATFORM'}; - $wceplatf =~ tr/a-z0-9 /A-Z0-9_/d; - $wcecdefs .= " -DWCE_PLATFORM_$wceplatf"; + if ($wcevers < 500 || defined($ENV{'PLATFORM'})) { + die '%PLATFORM% is not defined' if (!defined($ENV{'PLATFORM'})); + $wceplatf = $ENV{'PLATFORM'}; + $wceplatf =~ tr/a-z0-9 /A-Z0-9_/d; + $wcecdefs .= " -DWCE_PLATFORM_$wceplatf"; + } $wcetgt = $ENV{'TARGETCPU'}; # just shorter name... SWITCH: for($wcetgt) { @@ -99,13 +102,22 @@ } $cc='$(CC)'; - $base_cflags=' /W3 /WX /GF /Gy /nologo -DUNICODE -D_UNICODE -DOPENSSL_SYSNAME_WINCE -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -DOPENSSL_SMALL_FOOTPRINT'; + $base_cflags=' /W3 /GF /Gy /nologo -DUNICODE -D_UNICODE -DOPENSSL_SYSNAME_WINCE -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -DOPENSSL_SMALL_FOOTPRINT'; $base_cflags.=" $wcecdefs"; $base_cflags.=' -I$(WCECOMPAT)/include' if (defined($ENV{'WCECOMPAT'})); $base_cflags.=' -I$(PORTSDK_LIBPATH)/../../include' if (defined($ENV{'PORTSDK_LIBPATH'})); - $opt_cflags=' /MC /O1i'; # optimize for space, but with intrinsics... - $dbg_clfags=' /MC /Od -DDEBUG -D_DEBUG'; + $opt_cflags=' /O1i'; # optimize for space, but with intrinsics... + $dbg_cflags=' /Od -DDEBUG -D_DEBUG'; $lflags="/nologo /opt:ref $wcelflag"; + if ($wcevers >= 500) { + $lflags .=" /NODEFAULTLIB:oldnames.lib /NODEFAULTLIB:libc.lib crypt32.lib"; + if (!($wcetgt eq "X86") || $shlib) { + $lflags .=" coredll.lib corelibc.lib"; + } + } else { + $opt_cflags .= ' /MC'; + $dbg_cflags .= ' /MC'; + } } else # Win32 { @@ -257,6 +269,7 @@ elsif ($shlib && $FLAVOR =~ /CE/) { $mlflags.=" $lflags /dll"; + $mlflags.=' $(WCECOMPAT)/lib/wcecompatex.lib' if (defined($ENV{'WCECOMPAT'})); $lflags.=' /entry:mainCRTstartup' if(defined($ENV{'PORTSDK_LIBPATH'})); $lib_cflag=" -D_WINDLL -D_DLL"; $out_def='out32dll_$(TARGETCPU)'; @@ -291,7 +304,7 @@ if ($name eq "") { $ex.=' bufferoverflowu.lib' if ($FLAVOR =~ /WIN64/); - if ($target =~ /capi/) + if ($target =~ /capi/ && $FLAVOR !~ /CE/) { $ex.=' crypt32.lib advapi32.lib'; }