Hi everyone,

please find attached a patch to update the Windows CE support to current versions (Windows CE 5 and 6) based on version 0.9.8i.

Most changes are related to the wcecompat lib, which defines an additional requirement for this platform. Unfortunately the maintainers did not respond to multiple contact mails for half a year, thus we were forced to fork the project to be able to provide updates. It is now hosted at github at following URL:

http://github.com/mauricek/wcecompat

Basically the patch consists of:
  * updated documentation (also some more details on setup)
* a compile regression which seemed to have happened within one of the later versions of OpenSSL (o_str.c)
  * Windows CE 5 and later updates (mostly in the configuration script).

OpenSSL compiles for Windows CE 5 Standard SDK on all provided architectures (x86,mips, arm, etc.) and for Windows Mobile 5 and 6.

Tests were run on Windows CE 5 x86 and mips devices and they all pass.

If you have any questions or comments, feel free to contact me, otherwise I'd be delighted to see these updates in the next version of this project.


Best Regards,
Maurice Kalinowski


--
Maurice Kalinowski - maurice.kalinowski (AT) nokia.com
Software Engineer - Nokia, Qt Software
Rudower Chaussee 13, 12489 Berlin, Germany

diff -durw openssl-0.9.8i_original/INSTALL.WCE openssl-0.9.8i/INSTALL.WCE
--- openssl-0.9.8i_original/INSTALL.WCE Tue Oct  4 08:35:14 2005
+++ openssl-0.9.8i/INSTALL.WCE  Thu Oct 30 10:59:54 2008
@@ -4,18 +4,15 @@
 
  Building OpenSSL for Windows CE requires the following external tools:
 
-  * Microsoft eMbedded Visual C++ 3.0
-  * wcecompat compatibility library (www.essemer.com.au)
+  * Microsoft eMbedded Visual C++ 3.0 or Microsoft Visual Studio 2005 and later
+  * wcecompat compatibility library
+      * 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)
 
  You also need Perl for Win32.  You will need ActiveState Perl, available
- from http://www.activestate.com/ActivePerl.
-
- Windows CE support in OpenSSL relies on wcecompat and therefore it's
- appropriate to check http://www.essemer.com.au/windowsce/ for updates in
- case of compilation problems. As for the moment of this writing version
- 1.1 is available and actually required for WCE 4.2 and newer platforms.
- All Windows CE specific issues should be directed to www.essemer.com.au.
+ from http://www.activestate.com/ActivePerl. Note that perl by MSYS does
+ not create correct makefiles.
 
  The C Runtime Library implementation for Windows CE that is included with
  Microsoft eMbedded Visual C++ 3.0 is incomplete and in some places
@@ -26,6 +23,10 @@
  by the OpenSSL library itself but is used for the tests and openssl.exe.
  More information is available at www.essemer.com.au.
 
+ 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
  --------
 
@@ -34,10 +35,18 @@
 
  > "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 indicate where wcecompat is located:
 
  > set WCECOMPAT=C:\wcecompat
 
+ 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.
+
  Next you should run Configure:
 
  > perl Configure VC-CE
@@ -61,8 +70,9 @@
    > nmake -f ms\cedll.mak
 
  If all is well it should compile and you will have some static libraries and
- executables in out32, or some DLLs and executables in out32dll.  If you want
- to try the tests then make sure the ceutils are in the path and do:
+ 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. 
+ If you want to try the tests then make sure the ceutils are in the path and 
do:
  
  > cd out32
  > ..\ms\testce
diff -durw openssl-0.9.8i_original/crypto/o_str.c openssl-0.9.8i/crypto/o_str.c
--- openssl-0.9.8i_original/crypto/o_str.c      Sat Mar 29 14:22:49 2008
+++ openssl-0.9.8i/crypto/o_str.c       Wed Oct 29 10:30:03 2008
@@ -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
 
diff -durw openssl-0.9.8i_original/crypto/rsa/rsa_pss.c 
openssl-0.9.8i/crypto/rsa/rsa_pss.c
--- openssl-0.9.8i_original/crypto/rsa/rsa_pss.c        Mon Aug 29 01:20:50 2005
+++ openssl-0.9.8i/crypto/rsa/rsa_pss.c Wed Oct 29 11:29:00 2008
@@ -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(_WIN32_WCE) || 
(_WIN32_WCE < 500))
 #pragma optimize("g", off)
 #endif
 
diff -durw openssl-0.9.8i_original/e_os.h openssl-0.9.8i/e_os.h
--- openssl-0.9.8i_original/e_os.h      Thu Jan  3 23:53:01 2008
+++ openssl-0.9.8i/e_os.h       Wed Oct 29 10:32:31 2008
@@ -625,7 +625,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)
diff -durw openssl-0.9.8i_original/util/pl/VC-32.pl 
openssl-0.9.8i/util/pl/VC-32.pl
--- openssl-0.9.8i_original/util/pl/VC-32.pl    Fri Jun  6 22:48:57 2008
+++ openssl-0.9.8i/util/pl/VC-32.pl     Wed Oct 29 13:05:44 2008
@@ -41,7 +41,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'}));
 
     #
@@ -50,11 +49,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
 
+    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) {
@@ -87,9 +90,18 @@
     $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 
-I$(WCECOMPAT)/include -DOPENSSL_SMALL_FOOTPRINT';
     $base_cflags.=" $wcecdefs";
-    $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";
+        if (!($wcetgt eq "X86") || $shlib) {
+            $lflags .=" coredll.lib corelibc.lib";
+        }
+    } else {
+        $opt_cflags .= ' /MC';
+        $dbg_cflags .= ' /MC';
+    }
     }
 else   # Win32
     {

Reply via email to