From a006fef78e56b078549a80f4bb4518b6a02eba84 Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Sat, 19 Jan 2013 21:23:13 +0100 Subject: [PATCH] Improve WINCE support. Submitted by: Pierre Delaage --- apps/apps.c | 2 +- apps/apps.h | 2 +- crypto/bio/bss_dgram.c | 4 ++-- crypto/bio/bss_fd.c | 20 ++++++++++++++++++-- crypto/cryptlib.c | 2 ++ crypto/o_str.c | 2 +- e_os.h | 5 ++++- ssl/d1_lib.c | 4 ++-- util/pl/VC-32.pl | 2 +- 9 files changed, 32 insertions(+), 11 deletions(-) diff --git a/apps/apps.c b/apps/apps.c index 15f2069c95..e35f3c458c 100644 --- a/apps/apps.c +++ b/apps/apps.c @@ -118,7 +118,7 @@ #include #include #include -#if !defined(OPENSSL_SYSNAME_WIN32) && !defined(NETWARE_CLIB) +#if !defined(OPENSSL_SYSNAME_WIN32) && !defined(OPENSSL_SYSNAME_WINCE) && !defined(NETWARE_CLIB) #include #endif #include diff --git a/apps/apps.h b/apps/apps.h index 6a71b8323a..390a58c67c 100644 --- a/apps/apps.h +++ b/apps/apps.h @@ -202,7 +202,7 @@ extern BIO *bio_err; # endif #endif -#ifdef OPENSSL_SYSNAME_WIN32 +#if defined(OPENSSL_SYSNAME_WIN32) || defined(OPENSSL_SYSNAME_WINCE) # define openssl_fdset(a,b) FD_SET((unsigned int)a, b) #else # define openssl_fdset(a,b) FD_SET(a, b) diff --git a/crypto/bio/bss_dgram.c b/crypto/bio/bss_dgram.c index d121386a52..f8215f440d 100644 --- a/crypto/bio/bss_dgram.c +++ b/crypto/bio/bss_dgram.c @@ -66,7 +66,7 @@ #include #ifndef OPENSSL_NO_DGRAM -#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) +#if defined(OPENSSL_SYS_VMS) #include #endif @@ -1895,7 +1895,7 @@ int BIO_dgram_non_fatal_error(int err) static void get_current_time(struct timeval *t) { -#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINCE) +#if defined(_WIN32) SYSTEMTIME st; union { unsigned __int64 ul; FILETIME ft; } now; diff --git a/crypto/bio/bss_fd.c b/crypto/bio/bss_fd.c index d1bf85aae1..c274877c13 100644 --- a/crypto/bio/bss_fd.c +++ b/crypto/bio/bss_fd.c @@ -63,9 +63,25 @@ #if defined(OPENSSL_NO_POSIX_IO) /* - * One can argue that one should implement dummy placeholder for - * BIO_s_fd here... + * Dummy placeholder for BIO_s_fd... */ +BIO *BIO_new_fd(int fd,int close_flag) + { + return NULL; + } +int BIO_fd_non_fatal_error(int err) + { + return 0; + } +int BIO_fd_should_retry(int i) + { + return 0; + } + +BIO_METHOD *BIO_s_fd(void) + { + return NULL; + } #else /* * As for unconditional usage of "UPLINK" interface in this module. diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c index 14453491de..07b0a66217 100644 --- a/crypto/cryptlib.c +++ b/crypto/cryptlib.c @@ -387,7 +387,9 @@ void OpenSSLDie(const char *file,int line,const char *assertion) abort(); #else /* Win32 abort() customarily shows a dialog, but we just did that... */ +#if !defined(_WIN32_WCE) raise(SIGABRT); +#endif _exit(3); #endif } diff --git a/crypto/o_str.c b/crypto/o_str.c index 56104a6c34..60c01c10a4 100644 --- a/crypto/o_str.c +++ b/crypto/o_str.c @@ -61,7 +61,7 @@ #include "o_str.h" #if !defined(OPENSSL_IMPLEMENTS_strncasecmp) && \ - !defined(OPENSSL_SYSNAME_WIN32) && \ + !defined(OPENSSL_SYSNAME_WIN32) && !defined(OPENSSL_SYSNAME_WINCE) && \ !defined(NETWARE_CLIB) # include #endif diff --git a/e_os.h b/e_os.h index eaff717b2b..364eb3778b 100644 --- a/e_os.h +++ b/e_os.h @@ -270,7 +270,7 @@ extern "C" { */ # define _WIN32_WINNT 0x0400 # endif -# if !defined(OPENSSL_NO_SOCK) && defined(_WIN32_WINNT) +# if !defined(OPENSSL_NO_SOCK) && (defined(_WIN32_WINNT) || defined(_WIN32_WCE)) /* * Just like defining _WIN32_WINNT including winsock2.h implies * certain "discipline" for maintaining [broad] binary compatibility. @@ -286,6 +286,9 @@ extern "C" { # include # include # include +# if defined(_WIN32_WCE) && !defined(EACCES) +# define EACCES 13 +# endif # include # ifdef _WIN64 # define strlen(s) _strlen31(s) diff --git a/ssl/d1_lib.c b/ssl/d1_lib.c index 048ce3b4b0..db180f2ce2 100644 --- a/ssl/d1_lib.c +++ b/ssl/d1_lib.c @@ -62,7 +62,7 @@ #include #include "ssl_locl.h" -#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) +#if defined(OPENSSL_SYS_VMS) #include #endif @@ -452,7 +452,7 @@ int dtls1_handle_timeout(SSL *s) static void get_current_time(struct timeval *t) { -#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINCE) +#if defined(_WIN32) SYSTEMTIME st; union { unsigned __int64 ul; FILETIME ft; } now; diff --git a/util/pl/VC-32.pl b/util/pl/VC-32.pl index 0aeabcf5c7..f9749e4c78 100644 --- a/util/pl/VC-32.pl +++ b/util/pl/VC-32.pl @@ -126,7 +126,7 @@ elsif ($FLAVOR =~ /CE/) $base_cflags.=" $wcecdefs"; $base_cflags.=' -I$(WCECOMPAT)/include' if (defined($ENV{'WCECOMPAT'})); $base_cflags.=' -I$(PORTSDK_LIBPATH)/../../include' if (defined($ENV{'PORTSDK_LIBPATH'})); - if ($cc =~ /\bcl(\.exe)*$/) { + if (`$cc 2>&1` =~ /Version ([0-9]+)\./ && $1>=14) { $base_cflags.=($shlib and !$fipscanisterbuild)?' /MD':' /MT'; } else { $base_cflags.=' /MC'; -- 2.25.1