Hi,

At 03 Aug 2005 18:26:20 +0200 Andy Polyakov wrote:
> > Here is a patch to fix these problems except for 8. About 8, you can
> > supress it using pragma or just add a command line option.
> 
> You mean like #pragma warning(disable:4959) or /wd4959? Please verify
> either and confirm.

Unfortunatelly, /wd is not supported by CE compilers, we need to use
pragma to disable warnings.


Including this, I addressed some problems.

- VC-32.pl
1. Remove /wd4959, which is not supported.
2. Use /machine:ARM for all ARM based platforms such as ARMV4, ARMV4I,
   ARMV4T etc.

- rand_win.c
3. Don't typedef functions if OPENSSL_SYS_WINCE is defined. These
   typedefs are not used for WINCE, and some types such as LONG_PTR is
   not typedefed for old platforms.
4. Eliminate 'unreferences local variable' warning for 'buf' for
   _WINCE_WCE<300.

- des_old.h, ui_locl.h
5. Undef '_' for SH3 and SH4. For SH3 and SH4, '_' is defined as '1' and
   it causes a compile error. Although I think it's better to change the
   variable name, I add '#undef _' just to compile.

- ectest.c
6. Add pragma to disable warnings.

- rc2_skey.c, rsa_pss.c
7. Add pragma to disable optimizations because they cause 'Internal
   Compile Error' while compiling for Windows Mobile 2003 (WCE420/ARMV4).


I checked the patched source can compile for:
 - HPC Pro (WCE211), ARM/MIPS/SH3/SH4
 - Pocket PC (WCE300), ARM/MIPS/SH3
 - Windows Mobile 2003 (WCE420), ARM

I'll check other platforms later.


Here is a patch against openssl-0.9.8-stable-SNAP-20050807.tar.gz.


diff -ur openssl-0.9.8-stable-SNAP-20050807.orig/crypto/des/des_old.h 
openssl-0.9.8-stable-SNAP-20050807/crypto/des/des_old.h
--- openssl-0.9.8-stable-SNAP-20050807.orig/crypto/des/des_old.h        
2005-06-24 07:03:55.000000000 +0900
+++ openssl-0.9.8-stable-SNAP-20050807/crypto/des/des_old.h     2005-08-07 
21:02:13.156250000 +0900
@@ -116,6 +116,10 @@
 extern "C" {
 #endif
 
+#if defined(OPENSSL_SYS_WINCE) && defined(SHx)
+#undef _
+#endif
+
 typedef unsigned char _ossl_old_des_cblock[8];
 typedef struct _ossl_old_des_ks_struct
        {
diff -ur openssl-0.9.8-stable-SNAP-20050807.orig/crypto/ec/ectest.c 
openssl-0.9.8-stable-SNAP-20050807/crypto/ec/ectest.c
--- openssl-0.9.8-stable-SNAP-20050807.orig/crypto/ec/ectest.c  2005-07-23 
18:05:31.000000000 +0900
+++ openssl-0.9.8-stable-SNAP-20050807/crypto/ec/ectest.c       2005-08-07 
20:52:06.265625000 +0900
@@ -803,6 +803,10 @@
        if (!(_variable = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT; \
        if (!EC_GROUP_copy(_variable, group)) ABORT;
 
+#if defined(OPENSSL_SYS_WINCE) && defined(_MIPS_)
+#pragma warning(push)
+#pragma warning(disable:4959)
+#endif
 void char2_field_tests()
        {       
        BN_CTX *ctx = NULL;
@@ -1179,6 +1183,9 @@
 
                fprintf(stdout, " ok\n\n");
        }
+#if defined(OPENSSL_SYS_WINCE) && defined(_MIPS_)
+#pragma warning(pop)
+#endif
 
 
 #if 0
diff -ur openssl-0.9.8-stable-SNAP-20050807.orig/crypto/rand/rand_win.c 
openssl-0.9.8-stable-SNAP-20050807/crypto/rand/rand_win.c
--- openssl-0.9.8-stable-SNAP-20050807.orig/crypto/rand/rand_win.c      
2005-08-04 05:04:11.000000000 +0900
+++ openssl-0.9.8-stable-SNAP-20050807/crypto/rand/rand_win.c   2005-08-07 
23:17:51.265811900 +0900
@@ -156,6 +156,7 @@
 #define CURSOR_SHOWING     0x00000001
 #endif /* CURSOR_SHOWING */
 
+#if !defined(OPENSSL_SYS_WINCE)
 typedef BOOL (WINAPI *CRYPTACQUIRECONTEXTW)(HCRYPTPROV *, LPCWSTR, LPCWSTR,
                                    DWORD, DWORD);
 typedef BOOL (WINAPI *CRYPTGENRANDOM)(HCRYPTPROV, DWORD, BYTE *);
@@ -173,6 +174,7 @@
 typedef BOOL (WINAPI *PROCESS32)(HANDLE, LPPROCESSENTRY32);
 typedef BOOL (WINAPI *THREAD32)(HANDLE, LPTHREADENTRY32);
 typedef BOOL (WINAPI *MODULE32)(HANDLE, LPMODULEENTRY32);
+#endif
 
 #include <lmcons.h>
 #ifndef OPENSSL_SYS_WINCE
@@ -193,7 +195,9 @@
 {
        MEMORYSTATUS m;
        HCRYPTPROV hProvider = 0;
+#if !defined(OPENSSL_SYS_WINCE) || _WIN32_WCE>=300
        BYTE buf[64];
+#endif
        DWORD w;
        int good = 0;
 
diff -ur openssl-0.9.8-stable-SNAP-20050807.orig/crypto/rc2/rc2_skey.c 
openssl-0.9.8-stable-SNAP-20050807/crypto/rc2/rc2_skey.c
--- openssl-0.9.8-stable-SNAP-20050807.orig/crypto/rc2/rc2_skey.c       
2000-06-03 23:13:54.000000000 +0900
+++ openssl-0.9.8-stable-SNAP-20050807/crypto/rc2/rc2_skey.c    2005-08-07 
21:20:10.062500000 +0900
@@ -90,6 +90,9 @@
  * BSAFE uses the 'retarded' version.  What I previously shipped is
  * the same as specifying 1024 for the 'bits' parameter.  Bsafe uses
  * a version where the bits parameter is the same as len*8 */
+#if defined(_WIN32_WCE) && defined(_ARM_)
+#pragma optimize("", off)
+#endif
 void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits)
        {
        int i,j;
@@ -136,3 +139,6 @@
                *(ki--)=((k[i]<<8)|k[i-1])&0xffff;
        }
 
+#if defined(_WIN32_WCE) && defined(_ARM_)
+#pragma optimize("", on)
+#endif
diff -ur openssl-0.9.8-stable-SNAP-20050807.orig/crypto/rsa/rsa_pss.c 
openssl-0.9.8-stable-SNAP-20050807/crypto/rsa/rsa_pss.c
--- openssl-0.9.8-stable-SNAP-20050807.orig/crypto/rsa/rsa_pss.c        
2005-06-03 04:04:04.000000000 +0900
+++ openssl-0.9.8-stable-SNAP-20050807/crypto/rsa/rsa_pss.c     2005-08-07 
21:21:11.218750000 +0900
@@ -66,6 +66,9 @@
 
 const static unsigned char zeroes[] = {0,0,0,0,0,0,0,0};
 
+#if defined(_WIN32_WCE) && defined(_ARM_)
+#pragma optimize("", off)
+#endif
 int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash,
                        const EVP_MD *Hash, const unsigned char *EM, int sLen)
        {
@@ -259,3 +262,6 @@
        return ret;
 
        }
+#if defined(_WIN32_WCE) && defined(_ARM_)
+#pragma optimize("", on)
+#endif
diff -ur openssl-0.9.8-stable-SNAP-20050807.orig/crypto/ui/ui_locl.h 
openssl-0.9.8-stable-SNAP-20050807/crypto/ui/ui_locl.h
--- openssl-0.9.8-stable-SNAP-20050807.orig/crypto/ui/ui_locl.h 2004-05-18 
03:01:28.000000000 +0900
+++ openssl-0.9.8-stable-SNAP-20050807/crypto/ui/ui_locl.h      2005-08-07 
21:05:50.078125000 +0900
@@ -62,6 +62,10 @@
 #include <openssl/ui.h>
 #include <openssl/crypto.h>
 
+#if defined(OPENSSL_SYS_WINCE) && defined(SHx)
+#undef _
+#endif
+
 struct ui_method_st
        {
        char *name;
diff -ur openssl-0.9.8-stable-SNAP-20050807.orig/util/pl/VC-32.pl 
openssl-0.9.8-stable-SNAP-20050807/util/pl/VC-32.pl
--- openssl-0.9.8-stable-SNAP-20050807.orig/util/pl/VC-32.pl    2005-08-04 
05:05:39.000000000 +0900
+++ openssl-0.9.8-stable-SNAP-20050807/util/pl/VC-32.pl 2005-08-07 
21:25:44.467898000 +0900
@@ -50,7 +50,7 @@
        /^X86/          && do { $wcecdefs.=" -Dx86 -D_X86_";
                                $wcelflag.=" /machine:X86";     last; };
        /^ARM/          && do { $wcecdefs.=" -DARM -D_ARM_";
-                               $wcelflag.=" /machine:$wcetgt"; last; };
+                               $wcelflag.=" /machine:ARM";     last; };
        /^R4[0-9]{3}/   && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DMIPS_R4000";
                                $wcelflag.=" /machine:MIPS";    last; };
        /^SH[0-9]/      && do { $wcecdefs.=" -D$wcetgt -D_$wcetgt_ -DSHx";
@@ -64,7 +64,6 @@
     $base_cflags.=" $wcecdefs";
     $base_cflags.=" -Qsh4" if ($wcetgt =~ /^SH4/);
     $opt_cflags=' /MC /O1i';   # optimize for space, but with intrinsics...
-    $opt_cflags.=' /wd4959';   # disable "too large to optimize" warning...
     $dbg_clfags=' /MC /Od -DDEBUG -D_DEBUG';
     $lflags="/nologo /opt:ref $wcelflag";
     }


Regards.

-- 
Satoshi Nakamura <[EMAIL PROTECTED]>
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       openssl-dev@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to