From: Dr. Stephen Henson Date: Tue, 22 May 2012 23:57:22 +0000 (+0000) Subject: Changes needed to support WinCE compilation: X-Git-Tag: OpenSSL-fips-2_0-pl1~26 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b440c25d36bd04944ca6be4ab9b53314bb5f3aa7;p=oweals%2Fopenssl.git Changes needed to support WinCE compilation: 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. --- diff --git a/crypto/bn/bn_nist.c b/crypto/bn/bn_nist.c index 86bb0429f3..99cfc3f355 100644 --- a/crypto/bn/bn_nist.c +++ b/crypto/bn/bn_nist.c @@ -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) diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c index 87768d94e7..118fca1ee9 100644 --- a/crypto/cryptlib.c +++ b/crypto/cryptlib.c @@ -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 } diff --git a/fips/dh/fips_dhvs.c b/fips/dh/fips_dhvs.c index 0fb52f79a4..a925e13c7d 100644 --- a/fips/dh/fips_dhvs.c +++ b/fips/dh/fips_dhvs.c @@ -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 diff --git a/fips/rand/fips_rand.c b/fips/rand/fips_rand.c index f80c005758..5fa052746d 100644 --- a/fips/rand/fips_rand.c +++ b/fips/rand/fips_rand.c @@ -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); diff --git a/util/pl/VC-32.pl b/util/pl/VC-32.pl index e98eb1e1b9..24b8172ffc 100644 --- a/util/pl/VC-32.pl +++ b/util/pl/VC-32.pl @@ -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'}));