summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2002-11-15 22:37:18 +0000
committerRichard Levitte <levitte@openssl.org>2002-11-15 22:37:18 +0000
commit0bf23d9b2055223c6e7a1398d2243a65dfa4c30d (patch)
treecd3b00d88ebc55c0ea232b6f43200097f20a16de
parent813f256783a678b131a81ed1c8d05b70395a6255 (diff)
WinCE patches
-rw-r--r--CHANGES4
-rwxr-xr-xConfigure5
-rw-r--r--INSTALL.W322
-rw-r--r--INSTALL.WCE63
-rw-r--r--apps/apps.c25
-rw-r--r--apps/s_client.c16
-rw-r--r--apps/s_server.c8
-rw-r--r--apps/s_socket.c2
-rw-r--r--apps/s_time.c12
-rw-r--r--crypto/aes/aes_locl.h2
-rw-r--r--crypto/bio/b_sock.c2
-rw-r--r--crypto/bio/bss_log.c3
-rw-r--r--crypto/crypto.h3
-rw-r--r--crypto/des/read2pwd.c3
-rw-r--r--crypto/des/read_pwd.c38
-rw-r--r--crypto/dso/dso_win32.c2
-rw-r--r--crypto/ec/ectest.c5
-rw-r--r--crypto/engine/enginetest.c3
-rw-r--r--crypto/rand/rand_win.c73
-rw-r--r--crypto/ui/ui_openssl.c12
-rw-r--r--crypto/ui/ui_util.c3
-rw-r--r--e_os.h13
-rw-r--r--e_os2.h6
-rwxr-xr-xms/do_ms.bat2
-rw-r--r--ms/tencce.bat19
-rw-r--r--ms/testce.bat234
-rw-r--r--ms/testce2.bat2
-rw-r--r--ms/testencce.bat97
-rw-r--r--ms/testpemce.bat42
-rw-r--r--ms/testssce.bat104
-rw-r--r--ms/tpemce.bat8
-rw-r--r--ssl/ssl_cert.c28
-rw-r--r--ssl/ssltest.c3
-rwxr-xr-xutil/mk1mf.pl5
-rw-r--r--util/pl/VC-CE.pl112
35 files changed, 905 insertions, 56 deletions
diff --git a/CHANGES b/CHANGES
index 81469d6ad3..f1dcdb40e7 100644
--- a/CHANGES
+++ b/CHANGES
@@ -319,6 +319,10 @@ TODO: bug: pad x with leading zeros if necessary
Changes between 0.9.6h and 0.9.7 [XX xxx 2002]
+ *) Add the VC-CE target, introduce the WINCE sysname, and add
+ INSTALL.WCE and appropriate conditionals to make it build.
+ [Steven Reddie <smr@essemer.com.au> via Richard Levitte]
+
*) Change the DLL names for Cygwin to cygcrypto-x.y.z.dll and
cygssl-x.y.z.dll, where x, y and z are the major, minor and
edit numbers of the version.
diff --git a/Configure b/Configure
index 956a2c1cef..0c04460258 100755
--- a/Configure
+++ b/Configure
@@ -500,6 +500,7 @@ my %table=(
# Windows NT, Microsoft Visual C++ 4.0
"VC-NT","cl::::WINNT::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}::::::::::win32",
+"VC-CE","cl::::WINCE::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}::::::::::win32",
"VC-WIN32","cl::::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}::::::::::win32",
"VC-WIN16","cl:::(unknown):WIN16::MD2_CHAR DES_UNROLL DES_PTR RC4_INDEX THIRTY_TWO_BIT:::",
"VC-W31-16","cl:::(unknown):WIN16::BN_LLONG MD2_CHAR DES_UNROLL DES_PTR RC4_INDEX SIXTEEN_BIT:::",
@@ -571,8 +572,8 @@ my %table=(
);
-my @WinTargets=qw(VC-NT VC-WIN32 VC-WIN16 VC-W31-16 VC-W31-32 VC-MSDOS BC-32
- BC-16 Mingw32 OS2-EMX);
+my @WinTargets=qw(VC-NT VC-CE VC-WIN32 VC-WIN16 VC-W31-16 VC-W31-32 VC-MSDOS
+ BC-32 BC-16 Mingw32 OS2-EMX);
my $idx = 0;
my $idx_cc = $idx++;
diff --git a/INSTALL.W32 b/INSTALL.W32
index 8b22d9d05f..8a875cf0be 100644
--- a/INSTALL.W32
+++ b/INSTALL.W32
@@ -2,6 +2,8 @@
INSTALLATION ON THE WIN32 PLATFORM
----------------------------------
+ [Instructions for building for Windows CE can be found in INSTALL.WCE]
+
Heres a few comments about building OpenSSL in Windows environments. Most
of this is tested on Win32 but it may also work in Win 3.1 with some
modification.
diff --git a/INSTALL.WCE b/INSTALL.WCE
new file mode 100644
index 0000000000..7de7faaa1d
--- /dev/null
+++ b/INSTALL.WCE
@@ -0,0 +1,63 @@
+
+ INSTALLATION FOR THE WINDOWS CE PLATFORM
+ ----------------------------------------
+
+ Building OpenSSL for Windows CE requires the following external tools:
+
+ * Microsoft eMbedded Visual C++ 3.0
+ * wcecompat compatibility library (www.essemer.com.au)
+ * Optionally ceutils for running automated tests (www.essemer.com.au)
+
+ The C Runtime Library implementation for Windows CE that is included with
+ Microsoft eMbedded Visual C++ 3.0 is incomplete and in some places
+ incorrect. wcecompat plugs the holes and tries to bring the Windows CE
+ CRT to a level that is more compatible with ANSI C. wcecompat goes further
+ and provides low-level IO and stream IO support for stdin/stdout/stderr
+ (which Windows CE does not provide). This IO functionality is not needed
+ by the OpenSSL library itself but is used for the tests and openssl.exe.
+ More information is available at www.essemer.com.au.
+
+ Building
+ --------
+
+ You need Perl for Win32. Unless you will build on Cygwin, you will need
+ ActiveState Perl, available from http://www.activestate.com/ActivePerl.
+
+ Setup the eMbedded Visual C++ environment. There are batch files for doing
+ this installed with eVC++. For an ARM processor, for example, execute:
+
+ > "C:\Program Files\Microsoft eMbedded Tools\EVC\WCE300\BIN\WCEARM.BAT"
+
+ Next indicate where wcecompat is located:
+
+ > set WCECOMPAT=C:\wcecompat
+
+ Next you should run Configure:
+
+ > perl Configure VC-CE
+
+ Next you need to build the Makefiles:
+
+ > ms\do_ms
+
+ If you get errors about things not having numbers assigned then check the
+ troubleshooting section in INSTALL.W32: you probably won't be able to compile
+ it as it stands.
+
+ Then from the VC++ environment at a prompt do:
+
+ - to build static libraries:
+
+ > nmake -f ms\ce.mak
+
+ - or to build DLLs:
+
+ > 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:
+
+ > cd out32
+ > ..\ms\testce
+
diff --git a/apps/apps.c b/apps/apps.c
index 305227d7ab..271dfa1439 100644
--- a/apps/apps.c
+++ b/apps/apps.c
@@ -345,6 +345,7 @@ void program_name(char *in, char *out, int size)
#ifdef OPENSSL_SYS_WIN32
int WIN32_rename(char *from, char *to)
{
+#ifndef OPENSSL_SYS_WINCE
/* Windows rename gives an error if 'to' exists, so delete it
* first and ignore file not found errror
*/
@@ -352,6 +353,30 @@ int WIN32_rename(char *from, char *to)
return -1;
#undef rename
return rename(from, to);
+#else
+ /* convert strings to UNICODE */
+ {
+ BOOL result = FALSE;
+ WCHAR* wfrom;
+ WCHAR* wto;
+ int i;
+ wfrom = malloc((strlen(from)+1)*2);
+ wto = malloc((strlen(to)+1)*2);
+ if (wfrom != NULL && wto != NULL)
+ {
+ for (i=0; i<(int)strlen(from)+1; i++)
+ wfrom[i] = (short)from[i];
+ for (i=0; i<(int)strlen(to)+1; i++)
+ wto[i] = (short)to[i];
+ result = MoveFile(wfrom, wto);
+ }
+ if (wfrom != NULL)
+ free(wfrom);
+ if (wto != NULL)
+ free(wto);
+ return result;
+ }
+#endif
}
#endif
diff --git a/apps/s_client.c b/apps/s_client.c
index 1b670aa4ee..3b018ff0e0 100644
--- a/apps/s_client.c
+++ b/apps/s_client.c
@@ -140,6 +140,14 @@ typedef unsigned int u_int;
#include <conio.h>
#endif
+#ifdef OPENSSL_SYS_WINCE
+/* Windows CE incorrectly defines fileno as returning void*, so to avoid problems below... */
+#ifdef fileno
+#undef fileno
+#endif
+#define fileno(a) (int)_fileno(a)
+#endif
+
#if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000)
/* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */
@@ -662,7 +670,11 @@ re_start:
tv.tv_usec = 0;
i=select(width,(void *)&readfds,(void *)&writefds,
NULL,&tv);
+#ifdef OPENSSL_SYS_WINCE
+ if(!i && (!_kbhit() || !read_tty) ) continue;
+#else
if(!i && (!((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0))) || !read_tty) ) continue;
+#endif
} else i=select(width,(void *)&readfds,(void *)&writefds,
NULL,NULL);
}
@@ -828,7 +840,11 @@ printf("read=%d pending=%d peek=%d\n",k,SSL_pending(con),SSL_peek(con,zbuf,10240
}
#ifdef OPENSSL_SYS_WINDOWS
+#ifdef OPENSSL_SYS_WINCE
+ else if (_kbhit())
+#else
else if ((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0)))
+#endif
#else
else if (FD_ISSET(fileno(stdin),&readfds))
#endif
diff --git a/apps/s_server.c b/apps/s_server.c
index 64ef2455bc..4d87567a62 100644
--- a/apps/s_server.c
+++ b/apps/s_server.c
@@ -149,6 +149,14 @@ typedef unsigned int u_int;
#include <conio.h>
#endif
+#ifdef OPENSSL_SYS_WINCE
+/* Windows CE incorrectly defines fileno as returning void*, so to avoid problems below... */
+#ifdef fileno
+#undef fileno
+#endif
+#define fileno(a) (int)_fileno(a)
+#endif
+
#if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000)
/* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */
#undef FIONBIO
diff --git a/apps/s_socket.c b/apps/s_socket.c
index ed15ce0c1d..a88de6c8c8 100644
--- a/apps/s_socket.c
+++ b/apps/s_socket.c
@@ -140,7 +140,9 @@ static void ssl_sock_cleanup(void)
if (wsa_init_done)
{
wsa_init_done=0;
+#ifndef OPENSSL_SYS_WINCE
WSACancelBlockingCall();
+#endif
WSACleanup();
}
}
diff --git a/apps/s_time.c b/apps/s_time.c
index da7383ca21..181a7c82f6 100644
--- a/apps/s_time.c
+++ b/apps/s_time.c
@@ -487,7 +487,7 @@ int MAIN(int argc, char **argv)
tm_Time_F(START);
for (;;)
{
- if (finishtime < time(NULL)) break;
+ if (finishtime < (long)time(NULL)) break;
#ifdef WIN32_STUFF
if( flushWinMsgs(0) == -1 )
@@ -538,9 +538,9 @@ int MAIN(int argc, char **argv)
}
totalTime += tm_Time_F(STOP); /* Add the time for this iteration */
- i=(int)(time(NULL)-finishtime+maxTime);
+ i=(int)((long)time(NULL)-finishtime+maxTime);
printf( "\n\n%d connections in %.2fs; %.2f connections/user sec, bytes read %ld\n", nConn, totalTime, ((double)nConn/totalTime),bytes_read);
- printf( "%d connections in %ld real seconds, %ld bytes read per connection\n",nConn,time(NULL)-finishtime+maxTime,bytes_read/nConn);
+ printf( "%d connections in %ld real seconds, %ld bytes read per connection\n",nConn,(long)time(NULL)-finishtime+maxTime,bytes_read/nConn);
/* Now loop and time connections using the same session id over and over */
@@ -572,7 +572,7 @@ next:
nConn = 0;
totalTime = 0.0;
- finishtime=time(NULL)+maxTime;
+ finishtime=(long)time(NULL)+maxTime;
printf( "starting\n" );
bytes_read=0;
@@ -580,7 +580,7 @@ next:
for (;;)
{
- if (finishtime < time(NULL)) break;
+ if (finishtime < (long)time(NULL)) break;
#ifdef WIN32_STUFF
if( flushWinMsgs(0) == -1 )
@@ -630,7 +630,7 @@ next:
printf( "\n\n%d connections in %.2fs; %.2f connections/user sec, bytes read %ld\n", nConn, totalTime, ((double)nConn/totalTime),bytes_read);
- printf( "%d connections in %ld real seconds, %ld bytes read per connection\n",nConn,time(NULL)-finishtime+maxTime,bytes_read/nConn);
+ printf( "%d connections in %ld real seconds, %ld bytes read per connection\n",nConn,(long)time(NULL)-finishtime+maxTime,bytes_read/nConn);
ret=0;
end:
diff --git a/crypto/aes/aes_locl.h b/crypto/aes/aes_locl.h
index 18fc2d0747..f290946058 100644
--- a/crypto/aes/aes_locl.h
+++ b/crypto/aes/aes_locl.h
@@ -62,7 +62,7 @@
#include <stdlib.h>
#include <string.h>
-#ifdef _MSC_VER
+#if defined(_MSC_VER) && !defined(OPENSSL_SYS_WINCE)
# define SWAP(x) (_lrotl(x, 8) & 0x00ff00ff | _lrotr(x, 8) & 0xff00ff00)
# define GETU32(p) SWAP(*((u32 *)(p)))
# define PUTU32(ct, st) { *((u32 *)(ct)) = SWAP((st)); }
diff --git a/crypto/bio/b_sock.c b/crypto/bio/b_sock.c
index a7da258101..86f38172fb 100644
--- a/crypto/bio/b_sock.c
+++ b/crypto/bio/b_sock.c
@@ -482,7 +482,9 @@ void BIO_sock_cleanup(void)
if (wsa_init_done)
{
wsa_init_done=0;
+#ifndef OPENSSL_SYS_WINCE
WSACancelBlockingCall();
+#endif
WSACleanup();
}
#endif
diff --git a/crypto/bio/bss_log.c b/crypto/bio/bss_log.c
index 5341812672..1eb678cac0 100644
--- a/crypto/bio/bss_log.c
+++ b/crypto/bio/bss_log.c
@@ -68,7 +68,8 @@
#include "cryptlib.h"
-#if defined(OPENSSL_SYS_WIN32)
+#if defined(OPENSSL_SYS_WINCE)
+#elif defined(OPENSSL_SYS_WIN32)
# include <process.h>
#elif defined(OPENSSL_SYS_VMS)
# include <opcdef.h>
diff --git a/crypto/crypto.h b/crypto/crypto.h
index 2a4dbd5975..d1d2400d87 100644
--- a/crypto/crypto.h
+++ b/crypto/crypto.h
@@ -121,6 +121,9 @@
#ifndef OPENSSL_NO_FP_API
#include <stdio.h>
+#ifdef OPENSSL_SYS_WINCE
+#include <stdio_extras.h>
+#endif
#endif
#include <openssl/stack.h>
diff --git a/crypto/des/read2pwd.c b/crypto/des/read2pwd.c
index b4720c3a98..241adfa342 100644
--- a/crypto/des/read2pwd.c
+++ b/crypto/des/read2pwd.c
@@ -112,6 +112,9 @@
#include <string.h>
#include <openssl/des.h>
#include <openssl/ui.h>
+#ifdef OPENSSL_SYS_WINCE
+#include <stdio_extras.h> /* BUFSIZ */
+#endif
int DES_read_password(DES_cblock *key, const char *prompt, int verify)
{
diff --git a/crypto/des/read_pwd.c b/crypto/des/read_pwd.c
index b893a1b03a..c79c9a0e2a 100644
--- a/crypto/des/read_pwd.c
+++ b/crypto/des/read_pwd.c
@@ -101,8 +101,10 @@
#ifdef WIN_CONSOLE_BUG
#include <windows.h>
+#ifndef OPENSSL_SYS_WINCE
#include <wincon.h>
#endif
+#endif
/* There are 5 types of terminal interface supported,
@@ -167,7 +169,7 @@
#include <sys/ioctl.h>
#endif
-#if defined(OPENSSL_SYS_MSDOS) && !defined(__CYGWIN32__)
+#if defined(OPENSSL_SYS_MSDOS) && !defined(__CYGWIN32__) && !defined(OPENSSL_SYS_WINCE)
#include <conio.h>
#define fgets(a,b,c) noecho_fgets(a,b,c)
#endif
@@ -222,7 +224,25 @@ int des_read_pw_string(char *buf, int length, const char *prompt,
return(ret);
}
-#ifndef OPENSSL_SYS_WIN16
+#ifdef OPENSSL_SYS_WINCE
+
+int des_read_pw(char *buf, char *buff, int size, const char *prompt, int verify)
+ {
+ memset(buf,0,size);
+ memset(buff,0,size);
+ return(0);
+ }
+
+#elif defined(OPENSSL_SYS_WIN16)
+
+int des_read_pw(char *buf, char *buff, int size, char *prompt, int verify)
+ {
+ memset(buf,0,size);
+ memset(buff,0,size);
+ return(0);
+ }
+
+#else /* !OPENSSL_SYS_WINCE && !OPENSSL_SYS_WIN16 */
static void read_till_nl(FILE *in)
{
@@ -393,17 +413,6 @@ error:
return(!ok);
}
-#else /* OPENSSL_SYS_WIN16 */
-
-int des_read_pw(char *buf, char *buff, int size, char *prompt, int verify)
- {
- memset(buf,0,size);
- memset(buff,0,size);
- return(0);
- }
-
-#endif
-
static void pushsig(void)
{
int i;
@@ -466,7 +475,7 @@ static void recsig(int i)
#endif
}
-#if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN16)
+#ifdef OPENSSL_SYS_MSDOS
static int noecho_fgets(char *buf, int size, FILE *tty)
{
int i;
@@ -509,3 +518,4 @@ static int noecho_fgets(char *buf, int size, FILE *tty)
return(strlen(buf));
}
#endif
+#endif /* !OPENSSL_SYS_WINCE && !WIN16 */
diff --git a/crypto/dso/dso_win32.c b/crypto/dso/dso_win32.c
index 58c5281de6..02e051595a 100644
--- a/crypto/dso/dso_win32.c
+++ b/crypto/dso/dso_win32.c
@@ -61,7 +61,7 @@
#include "cryptlib.h"
#include <openssl/dso.h>
-#ifndef OPENSSL_SYS_WIN32
+#if !defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINCE)
DSO_METHOD *DSO_METHOD_win32(void)
{
return NULL;
diff --git a/crypto/ec/ectest.c b/crypto/ec/ectest.c
index 96ff87d7ec..f3866481be 100644
--- a/crypto/ec/ectest.c
+++ b/crypto/ec/ectest.c
@@ -71,6 +71,11 @@
#include <stdio.h>
#include <stdlib.h>
+#ifdef FLAT_INC
+#include "e_os.h"
+#else
+#include "../../e_os.h"
+#endif
#include <string.h>
#include <time.h>
diff --git a/crypto/engine/enginetest.c b/crypto/engine/enginetest.c
index 87fa8c57b7..51eb091e60 100644
--- a/crypto/engine/enginetest.c
+++ b/crypto/engine/enginetest.c
@@ -58,6 +58,9 @@
#include <openssl/e_os2.h>
#include <stdio.h>
+#ifdef OPENSSL_SYS_WINCE
+#include <stdlib_extras.h>
+#endif
#include <string.h>
#include <openssl/buffer.h>
#include <openssl/crypto.h>
diff --git a/crypto/rand/rand_win.c b/crypto/rand/rand_win.c
index 242febe270..37f172f8a4 100644
--- a/crypto/rand/rand_win.c
+++ b/crypto/rand/rand_win.c
@@ -125,7 +125,7 @@
* http://developer.intel.com/design/security/rng/redist_license.htm
*/
#define PROV_INTEL_SEC 22
-#define INTEL_DEF_PROV "Intel Hardware Cryptographic Service Provider"
+#define INTEL_DEF_PROV TEXT("Intel Hardware Cryptographic Service Provider")
static void readtimer(void);
static void readscreen(void);
@@ -170,7 +170,9 @@ typedef BOOL (WINAPI *THREAD32)(HANDLE, LPTHREADENTRY32);
typedef BOOL (WINAPI *MODULE32)(HANDLE, LPMODULEENTRY32);
#include <lmcons.h>
+#ifndef OPENSSL_SYS_WINCE
#include <lmstats.h>
+#endif
#if 1 /* The NET API is Unicode only. It requires the use of the UNICODE
* macro. When UNICODE is defined LPTSTR becomes LPWSTR. LMSTR was
* was added to the Platform SDK to allow the NET API to be used in
@@ -209,20 +211,32 @@ int RAND_poll(void)
osverinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO) ;
GetVersionEx( &osverinfo ) ;
+#ifdef OPENSSL_SYS_WINCE
+ /* poll the CryptoAPI PRNG */
+ /* The CryptoAPI returns sizeof(buf) bytes of randomness */
+ if (CryptAcquireContext(&hProvider, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
+ {
+ if (CryptGenRandom(hProvider, sizeof(buf), buf))
+ RAND_add(buf, sizeof(buf), sizeof(buf));
+ CryptReleaseContext(hProvider, 0);
+ }
+#endif
+
/* load functions dynamically - not available on all systems */
- advapi = LoadLibrary("ADVAPI32.DLL");
- kernel = LoadLibrary("KERNEL32.DLL");
- user = LoadLibrary("USER32.DLL");
- netapi = LoadLibrary("NETAPI32.DLL");
+ advapi = LoadLibrary(TEXT("ADVAPI32.DLL"));
+ kernel = LoadLibrary(TEXT("KERNEL32.DLL"));
+ user = LoadLibrary(TEXT("USER32.DLL"));
+ netapi = LoadLibrary(TEXT("NETAPI32.DLL"));
+#ifndef OPENSSL_SYS_WINCE
#if 1 /* There was previously a problem with NETSTATGET. Currently, this
* section is still experimental, but if all goes well, this conditional
* will be removed
*/
if (netapi)
{
- netstatget = (NETSTATGET) GetProcAddress(netapi,"NetStatisticsGet");
- netfree = (NETFREE) GetProcAddress(netapi,"NetApiBufferFree");
+ netstatget = (NETSTATGET) GetProcAddress(netapi,TEXT("NetStatisticsGet"));
+ netfree = (NETFREE) GetProcAddress(netapi,TEXT("NetApiBufferFree"));
}
if (netstatget && netfree)
@@ -249,7 +263,9 @@ int RAND_poll(void)
if (netapi)
FreeLibrary(netapi);
#endif /* 1 */
+#endif /* !OPENSSL_SYS_WINCE */
+#ifndef OPENSSL_SYS_WINCE
/* It appears like this can cause an exception deep within ADVAPI32.DLL
* at random times on Windows 2000. Reported by Jeffrey Altman.
* Only use it on NT.
@@ -280,7 +296,7 @@ int RAND_poll(void)
bufsz += 8192;
length = bufsz;
- rc = RegQueryValueEx(HKEY_PERFORMANCE_DATA, "Global",
+ rc = RegQueryValueEx(HKEY_PERFORMANCE_DATA, TEXT("Global"),
NULL, NULL, buf, &length);
}
if (rc == ERROR_SUCCESS)
@@ -304,15 +320,16 @@ int RAND_poll(void)
free(buf);
}
#endif
+#endif /* !OPENSSL_SYS_WINCE */
if (advapi)
{
acquire = (CRYPTACQUIRECONTEXT) GetProcAddress(advapi,
- "CryptAcquireContextA");
+ TEXT("CryptAcquireContextA"));
gen = (CRYPTGENRANDOM) GetProcAddress(advapi,
- "CryptGenRandom");
+ TEXT("CryptGenRandom"));
release = (CRYPTRELEASECONTEXT) GetProcAddress(advapi,
- "CryptReleaseContext");
+ TEXT("CryptReleaseContext"));
}
if (acquire && gen && release)
@@ -366,9 +383,9 @@ int RAND_poll(void)
GETFOREGROUNDWINDOW win;
GETQUEUESTATUS queue;
- win = (GETFOREGROUNDWINDOW) GetProcAddress(user, "GetForegroundWindow");
- cursor = (GETCURSORINFO) GetProcAddress(user, "GetCursorInfo");
- queue = (GETQUEUESTATUS) GetProcAddress(user, "GetQueueStatus");
+ win = (GETFOREGROUNDWINDOW) GetProcAddress(user, TEXT("GetForegroundWindow"));
+ cursor = (GETCURSORINFO) GetProcAddress(user, TEXT("GetCursorInfo"));
+ queue = (GETQUEUESTATUS) GetProcAddress(user, TEXT("GetQueueStatus"));
if (win)
{
@@ -439,17 +456,17 @@ int RAND_poll(void)
MODULEENTRY32 m;
snap = (CREATETOOLHELP32SNAPSHOT)
- GetProcAddress(kernel, "CreateToolhelp32Snapshot");
- heap_first = (HEAP32FIRST) GetProcAddress(kernel, "Heap32First");
- heap_next = (HEAP32NEXT) GetProcAddress(kernel, "Heap32Next");
- heaplist_first = (HEAP32LIST) GetProcAddress(kernel, "Heap32ListFirst");
- heaplist_next = (HEAP32LIST) GetProcAddress(kernel, "Heap32ListNext");
- process_first = (PROCESS32) GetProcAddress(kernel, "Process32First");
- process_next = (PROCESS32) GetProcAddress(kernel, "Process32Next");
- thread_first = (THREAD32) GetProcAddress(kernel, "Thread32First");
- thread_next = (THREAD32) GetProcAddress(kernel, "Thread32Next");
- module_first = (MODULE32) GetProcAddress(kernel, "Module32First");
- module_next = (MODULE32) GetProcAddress(kernel, "Module32Next");
+ GetProcAddress(kernel, TEXT("CreateToolhelp32Snapshot"));
+ heap_first = (HEAP32FIRST) GetProcAddress(kernel, TEXT("Heap32First"));
+ heap_next = (HEAP32NEXT) GetProcAddress(kernel, TEXT("Heap32Next"));
+ heaplist_first = (HEAP32LIST) GetProcAddress(kernel, TEXT("Heap32ListFirst"));
+ heaplist_next = (HEAP32LIST) GetProcAddress(kernel, TEXT("Heap32ListNext"));
+ process_first = (PROCESS32) GetProcAddress(kernel, TEXT("Process32First"));
+ process_next = (PROCESS32) GetProcAddress(kernel, TEXT("Process32Next"));
+ thread_first = (THREAD32) GetProcAddress(kernel, TEXT("Thread32First"));
+ thread_next = (THREAD32) GetProcAddress(kernel, TEXT("Thread32Next"));
+ module_first = (MODULE32) GetProcAddress(kernel, TEXT("Module32First"));
+ module_next = (MODULE32) GetProcAddress(kernel, TEXT("Module32Next"));
if (snap && heap_first && heap_next && heaplist_first &&
heaplist_next && process_first && process_next &&
@@ -584,7 +601,7 @@ static void readtimer(void)
DWORD w;
LARGE_INTEGER l;
static int have_perfc = 1;
-#ifdef _MSC_VER
+#if defined(_MSC_VER) && !defined(OPENSSL_SYS_WINCE)
static int have_tsc = 1;
DWORD cyclecount;
@@ -637,6 +654,7 @@ static void readtimer(void)
static void readscreen(void)
{
+#ifndef OPENSSL_SYS_WINCE
HDC hScrDC; /* screen DC */
HDC hMemDC; /* memory DC */
HBITMAP hBitmap; /* handle for our bitmap */
@@ -650,7 +668,7 @@ static void readscreen(void)
int n = 16; /* number of screen lines to grab at a time */
/* Create a screen DC and a memory DC compatible to screen DC */
- hScrDC = CreateDC("DISPLAY", NULL, NULL, NULL);
+ hScrDC = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL);
hMemDC = CreateCompatibleDC(hScrDC);
/* Get screen resolution */
@@ -697,6 +715,7 @@ static void readscreen(void)
DeleteObject(hBitmap);
DeleteDC(hMemDC);
DeleteDC(hScrDC);
+#endif /* !OPENSSL_SYS_WINCE */
}
#endif
diff --git a/crypto/ui/ui_openssl.c b/crypto/ui/ui_openssl.c
index 793846cbc6..6d5f9cd8b1 100644
--- a/crypto/ui/ui_openssl.c
+++ b/crypto/ui/ui_openssl.c
@@ -159,8 +159,10 @@
#ifdef WIN_CONSOLE_BUG
# include <windows.h>
+#ifndef OPENSSL_SYS_WINCE
# include <wincon.h>
#endif
+#endif
/* There are 5 types of terminal interface supported,
@@ -281,10 +283,12 @@ static FILE *tty_in, *tty_out;
static int is_a_tty;
/* Declare static functions */
+#if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE)
static void read_till_nl(FILE *);
static void recsig(int);
static void pushsig(void);
static void popsig(void);
+#endif
#if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN16)
static int noecho_fgets(char *buf, int size, FILE *tty);
#endif
@@ -371,6 +375,7 @@ static int read_string(UI *ui, UI_STRING *uis)
}
+#if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE)
/* Internal functions to read a string without echoing */
static void read_till_nl(FILE *in)
{
@@ -383,6 +388,7 @@ static void read_till_nl(FILE *in)
}
static volatile sig_atomic_t intr_signal;
+#endif
static int read_string_inner(UI *ui, UI_STRING *uis, int echo, int strip_nl)
{
@@ -390,9 +396,9 @@ static int read_string_inner(UI *ui, UI_STRING *uis, int echo, int strip_nl)
int ok;
char result[BUFSIZ];
int maxsize = BUFSIZ-1;
+#if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE)
char *p;
-#ifndef OPENSSL_SYS_WIN16
intr_signal=0;
ok=0;
ps=0;
@@ -555,6 +561,7 @@ static int close_console(UI *ui)
}
+#if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE)
/* Internal functions to handle signals and act on them */
static void pushsig(void)
{
@@ -618,9 +625,10 @@ static void recsig(int i)
{
intr_signal=i;
}
+#endif
/* Internal functions specific for Windows */
-#if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN16)
+#if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE)
static int noecho_fgets(char *buf, int size, FILE *tty)
{
int i;
diff --git a/crypto/ui/ui_util.c b/crypto/ui/ui_util.c
index f05573df33..8876128e56 100644
--- a/crypto/u