Changes needed to support WinCE compilation:
authorDr. Stephen Henson <steve@openssl.org>
Tue, 22 May 2012 23:57:22 +0000 (23:57 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Tue, 22 May 2012 23:57:22 +0000 (23:57 +0000)
Don't try to raise SIGABRT if not defined.
Return from fips_dhvs.c main instead of calling exit.
Workaround for lack of GetSystemFileAsFileTime.
Disable optimisation for part of bn_nist.c to avoid compiler bug.
Remove /WX flag so we don't exist on warnings.

crypto/bn/bn_nist.c
crypto/cryptlib.c
fips/dh/fips_dhvs.c
fips/rand/fips_rand.c
util/pl/VC-32.pl

index 86bb0429f3e817e8ebf51504bd5eaa9523b71756..99cfc3f3557560451cd6f77da03b8a2f7ee5aec0 100644 (file)
@@ -1047,6 +1047,10 @@ int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *field,
        return 1;
        }
 
+#ifdef _W32_WCE
+#pragma optimize( "", off )
+#endif
+
 #define BN_NIST_521_RSHIFT     (521%BN_BITS2)
 #define BN_NIST_521_LSHIFT     (BN_BITS2-BN_NIST_521_RSHIFT)
 #define BN_NIST_521_TOP_MASK   ((BN_ULONG)BN_MASK2>>BN_NIST_521_LSHIFT)
@@ -1113,6 +1117,10 @@ int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *field,
        return 1;
        }
 
+#ifdef _W32_WCE
+#pragma optimize( "", on )
+#endif
+
 int (*BN_nist_mod_func(const BIGNUM *p))(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx)
        {
        if (BN_ucmp(&_bignum_nist_p_192, p) == 0)
index 87768d94e7550b350840b4684d9a72e7b48bc1ca..118fca1ee9ca3b8ca0707891615ef70d8a174801 100644 (file)
@@ -382,7 +382,9 @@ void OpenSSLDie(const char *file,int line,const char *assertion)
        abort();
 #else
        /* Win32 abort() customarily shows a dialog, but we just did that... */
+#ifdef SIGABRT
        raise(SIGABRT);
+#endif
        _exit(3);
 #endif
        }
index 0fb52f79a413fe318d5631290e67328c39e9dc74..a925e13c7d90929173f04cfa3a817ce306cc1457 100644 (file)
@@ -286,7 +286,7 @@ int main(int argc, char **argv)
        return 0;
        parse_error:
        fprintf(stderr, "Error Parsing request file\n");
-       exit(1);
+       return 1;
        }
 
 #endif
index f80c005758a04b63fa8168297a9c0538e36a0310..5fa052746d5e1080f1012f3f606025e3cf7dd102 100644 (file)
@@ -232,6 +232,9 @@ void FIPS_get_timevec(unsigned char *buf, unsigned long *pctr)
        {
 #ifdef OPENSSL_SYS_WIN32
        FILETIME ft;
+#ifdef _WIN32_WCE
+       SYSTEMTIME t;
+#endif
 #elif defined(OPENSSL_SYS_VXWORKS)
         struct timespec ts;
 #else
@@ -243,7 +246,12 @@ void FIPS_get_timevec(unsigned char *buf, unsigned long *pctr)
 #endif
 
 #ifdef OPENSSL_SYS_WIN32
+#ifdef _WIN32_WCE
+       GetSystemTime(&t);
+       SystemTimeToFileTime(&t, &ft);
+#else
        GetSystemTimeAsFileTime(&ft);
+#endif
        buf[0] = (unsigned char) (ft.dwHighDateTime & 0xff);
        buf[1] = (unsigned char) ((ft.dwHighDateTime >> 8) & 0xff);
        buf[2] = (unsigned char) ((ft.dwHighDateTime >> 16) & 0xff);
index e98eb1e1b9477d56367f66efb3cbc472c2779db3..24b8172ffc47d2024de32ab20cde6d3274df0311 100644 (file)
@@ -123,7 +123,7 @@ elsif ($FLAVOR =~ /CE/)
     }
 
     $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'}));