WinCE patches

This commit is contained in:
Richard Levitte 2002-11-15 22:44:08 +00:00
parent 97d58eadbf
commit 29ca164513
26 changed files with 225 additions and 57 deletions

View File

@ -4,6 +4,10 @@
Changes between 0.9.6h and 0.9.7 [XX xxx 2002] 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 *) 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 cygssl-x.y.z.dll, where x, y and z are the major, minor and
edit numbers of the version. edit numbers of the version.

View File

@ -500,6 +500,7 @@ my %table=(
# Windows NT, Microsoft Visual C++ 4.0 # Windows NT, Microsoft Visual C++ 4.0
"VC-NT","cl::::WINNT::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}::::::::::win32", "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-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-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:::", "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 my @WinTargets=qw(VC-NT VC-CE VC-WIN32 VC-WIN16 VC-W31-16 VC-W31-32 VC-MSDOS
BC-16 Mingw32 OS2-EMX); BC-32 BC-16 Mingw32 OS2-EMX);
my $idx = 0; my $idx = 0;
my $idx_cc = $idx++; my $idx_cc = $idx++;

View File

@ -2,6 +2,8 @@
INSTALLATION ON THE WIN32 PLATFORM 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 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 of this is tested on Win32 but it may also work in Win 3.1 with some
modification. modification.

View File

@ -345,6 +345,7 @@ void program_name(char *in, char *out, int size)
#ifdef OPENSSL_SYS_WIN32 #ifdef OPENSSL_SYS_WIN32
int WIN32_rename(char *from, char *to) int WIN32_rename(char *from, char *to)
{ {
#ifndef OPENSSL_SYS_WINCE
/* Windows rename gives an error if 'to' exists, so delete it /* Windows rename gives an error if 'to' exists, so delete it
* first and ignore file not found errror * first and ignore file not found errror
*/ */
@ -352,6 +353,30 @@ int WIN32_rename(char *from, char *to)
return -1; return -1;
#undef rename #undef rename
return rename(from, to); 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 #endif

View File

@ -140,6 +140,14 @@ typedef unsigned int u_int;
#include <conio.h> #include <conio.h>
#endif #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) #if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000)
/* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */ /* 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; tv.tv_usec = 0;
i=select(width,(void *)&readfds,(void *)&writefds, i=select(width,(void *)&readfds,(void *)&writefds,
NULL,&tv); 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; if(!i && (!((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0))) || !read_tty) ) continue;
#endif
} else i=select(width,(void *)&readfds,(void *)&writefds, } else i=select(width,(void *)&readfds,(void *)&writefds,
NULL,NULL); 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_WINDOWS
#ifdef OPENSSL_SYS_WINCE
else if (_kbhit())
#else
else if ((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0))) else if ((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0)))
#endif
#else #else
else if (FD_ISSET(fileno(stdin),&readfds)) else if (FD_ISSET(fileno(stdin),&readfds))
#endif #endif

View File

@ -144,6 +144,14 @@ typedef unsigned int u_int;
#include <conio.h> #include <conio.h>
#endif #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) #if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000)
/* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */ /* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */
#undef FIONBIO #undef FIONBIO

View File

@ -140,7 +140,9 @@ static void ssl_sock_cleanup(void)
if (wsa_init_done) if (wsa_init_done)
{ {
wsa_init_done=0; wsa_init_done=0;
#ifndef OPENSSL_SYS_WINCE
WSACancelBlockingCall(); WSACancelBlockingCall();
#endif
WSACleanup(); WSACleanup();
} }
} }

View File

@ -487,7 +487,7 @@ int MAIN(int argc, char **argv)
tm_Time_F(START); tm_Time_F(START);
for (;;) for (;;)
{ {
if (finishtime < time(NULL)) break; if (finishtime < (long)time(NULL)) break;
#ifdef WIN32_STUFF #ifdef WIN32_STUFF
if( flushWinMsgs(0) == -1 ) 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 */ 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( "\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 */ /* Now loop and time connections using the same session id over and over */
@ -572,7 +572,7 @@ next:
nConn = 0; nConn = 0;
totalTime = 0.0; totalTime = 0.0;
finishtime=time(NULL)+maxTime; finishtime=(long)time(NULL)+maxTime;
printf( "starting\n" ); printf( "starting\n" );
bytes_read=0; bytes_read=0;
@ -580,7 +580,7 @@ next:
for (;;) for (;;)
{ {
if (finishtime < time(NULL)) break; if (finishtime < (long)time(NULL)) break;
#ifdef WIN32_STUFF #ifdef WIN32_STUFF
if( flushWinMsgs(0) == -1 ) 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( "\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; ret=0;
end: end:

View File

@ -62,7 +62,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.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 SWAP(x) (_lrotl(x, 8) & 0x00ff00ff | _lrotr(x, 8) & 0xff00ff00)
# define GETU32(p) SWAP(*((u32 *)(p))) # define GETU32(p) SWAP(*((u32 *)(p)))
# define PUTU32(ct, st) { *((u32 *)(ct)) = SWAP((st)); } # define PUTU32(ct, st) { *((u32 *)(ct)) = SWAP((st)); }

View File

@ -482,7 +482,9 @@ void BIO_sock_cleanup(void)
if (wsa_init_done) if (wsa_init_done)
{ {
wsa_init_done=0; wsa_init_done=0;
#ifndef OPENSSL_SYS_WINCE
WSACancelBlockingCall(); WSACancelBlockingCall();
#endif
WSACleanup(); WSACleanup();
} }
#endif #endif

View File

@ -68,7 +68,8 @@
#include "cryptlib.h" #include "cryptlib.h"
#if defined(OPENSSL_SYS_WIN32) #if defined(OPENSSL_SYS_WINCE)
#elif defined(OPENSSL_SYS_WIN32)
# include <process.h> # include <process.h>
#elif defined(OPENSSL_SYS_VMS) #elif defined(OPENSSL_SYS_VMS)
# include <opcdef.h> # include <opcdef.h>

View File

@ -63,6 +63,9 @@
#ifndef OPENSSL_NO_FP_API #ifndef OPENSSL_NO_FP_API
#include <stdio.h> #include <stdio.h>
#ifdef OPENSSL_SYS_WINCE
#include <stdio_extras.h>
#endif
#endif #endif
#include <openssl/stack.h> #include <openssl/stack.h>

View File

@ -112,6 +112,9 @@
#include <string.h> #include <string.h>
#include <openssl/des.h> #include <openssl/des.h>
#include <openssl/ui.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) int DES_read_password(DES_cblock *key, const char *prompt, int verify)
{ {

View File

@ -101,8 +101,10 @@
#ifdef WIN_CONSOLE_BUG #ifdef WIN_CONSOLE_BUG
#include <windows.h> #include <windows.h>
#ifndef OPENSSL_SYS_WINCE
#include <wincon.h> #include <wincon.h>
#endif #endif
#endif
/* There are 5 types of terminal interface supported, /* There are 5 types of terminal interface supported,
@ -167,7 +169,7 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
#endif #endif
#if defined(OPENSSL_SYS_MSDOS) && !defined(__CYGWIN32__) #if defined(OPENSSL_SYS_MSDOS) && !defined(__CYGWIN32__) && !defined(OPENSSL_SYS_WINCE)
#include <conio.h> #include <conio.h>
#define fgets(a,b,c) noecho_fgets(a,b,c) #define fgets(a,b,c) noecho_fgets(a,b,c)
#endif #endif
@ -222,7 +224,25 @@ int des_read_pw_string(char *buf, int length, const char *prompt,
return(ret); 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) static void read_till_nl(FILE *in)
{ {
@ -393,17 +413,6 @@ error:
return(!ok); 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) static void pushsig(void)
{ {
int i; int i;
@ -466,7 +475,7 @@ static void recsig(int i)
#endif #endif
} }
#if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN16) #ifdef OPENSSL_SYS_MSDOS
static int noecho_fgets(char *buf, int size, FILE *tty) static int noecho_fgets(char *buf, int size, FILE *tty)
{ {
int i; int i;
@ -509,3 +518,4 @@ static int noecho_fgets(char *buf, int size, FILE *tty)
return(strlen(buf)); return(strlen(buf));
} }
#endif #endif
#endif /* !OPENSSL_SYS_WINCE && !WIN16 */

View File

@ -61,7 +61,7 @@
#include "cryptlib.h" #include "cryptlib.h"
#include <openssl/dso.h> #include <openssl/dso.h>
#ifndef OPENSSL_SYS_WIN32 #if !defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINCE)
DSO_METHOD *DSO_METHOD_win32(void) DSO_METHOD *DSO_METHOD_win32(void)
{ {
return NULL; return NULL;

View File

@ -55,6 +55,11 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#ifdef FLAT_INC
#include "e_os.h"
#else
#include "../../e_os.h"
#endif
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>

View File

@ -58,6 +58,9 @@
#include <openssl/e_os2.h> #include <openssl/e_os2.h>
#include <stdio.h> #include <stdio.h>
#ifdef OPENSSL_SYS_WINCE
#include <stdlib_extras.h>
#endif
#include <string.h> #include <string.h>
#include <openssl/buffer.h> #include <openssl/buffer.h>
#include <openssl/crypto.h> #include <openssl/crypto.h>

View File

@ -125,7 +125,7 @@
* http://developer.intel.com/design/security/rng/redist_license.htm * http://developer.intel.com/design/security/rng/redist_license.htm
*/ */
#define PROV_INTEL_SEC 22 #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 readtimer(void);
static void readscreen(void); static void readscreen(void);
@ -170,7 +170,9 @@ typedef BOOL (WINAPI *THREAD32)(HANDLE, LPTHREADENTRY32);
typedef BOOL (WINAPI *MODULE32)(HANDLE, LPMODULEENTRY32); typedef BOOL (WINAPI *MODULE32)(HANDLE, LPMODULEENTRY32);
#include <lmcons.h> #include <lmcons.h>
#ifndef OPENSSL_SYS_WINCE
#include <lmstats.h> #include <lmstats.h>
#endif
#if 1 /* The NET API is Unicode only. It requires the use of the UNICODE #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 * 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 * 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) ; osverinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO) ;
GetVersionEx( &osverinfo ) ; GetVersionEx( &osverinfo ) ;
/* load functions dynamically - not available on all systems */ #ifdef OPENSSL_SYS_WINCE
advapi = LoadLibrary("ADVAPI32.DLL"); /* poll the CryptoAPI PRNG */
kernel = LoadLibrary("KERNEL32.DLL"); /* The CryptoAPI returns sizeof(buf) bytes of randomness */
user = LoadLibrary("USER32.DLL"); if (CryptAcquireContext(&hProvider, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
netapi = LoadLibrary("NETAPI32.DLL"); {
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(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 #if 1 /* There was previously a problem with NETSTATGET. Currently, this
* section is still experimental, but if all goes well, this conditional * section is still experimental, but if all goes well, this conditional
* will be removed * will be removed
*/ */
if (netapi) if (netapi)
{ {
netstatget = (NETSTATGET) GetProcAddress(netapi,"NetStatisticsGet"); netstatget = (NETSTATGET) GetProcAddress(netapi,TEXT("NetStatisticsGet"));
netfree = (NETFREE) GetProcAddress(netapi,"NetApiBufferFree"); netfree = (NETFREE) GetProcAddress(netapi,TEXT("NetApiBufferFree"));
} }
if (netstatget && netfree) if (netstatget && netfree)
@ -249,7 +263,9 @@ int RAND_poll(void)
if (netapi) if (netapi)
FreeLibrary(netapi); FreeLibrary(netapi);
#endif /* 1 */ #endif /* 1 */
#endif /* !OPENSSL_SYS_WINCE */
#ifndef OPENSSL_SYS_WINCE
/* It appears like this can cause an exception deep within ADVAPI32.DLL /* It appears like this can cause an exception deep within ADVAPI32.DLL
* at random times on Windows 2000. Reported by Jeffrey Altman. * at random times on Windows 2000. Reported by Jeffrey Altman.
* Only use it on NT. * Only use it on NT.
@ -280,7 +296,7 @@ int RAND_poll(void)
bufsz += 8192; bufsz += 8192;
length = bufsz; length = bufsz;
rc = RegQueryValueEx(HKEY_PERFORMANCE_DATA, "Global", rc = RegQueryValueEx(HKEY_PERFORMANCE_DATA, TEXT("Global"),
NULL, NULL, buf, &length); NULL, NULL, buf, &length);
} }
if (rc == ERROR_SUCCESS) if (rc == ERROR_SUCCESS)
@ -304,15 +320,16 @@ int RAND_poll(void)
free(buf); free(buf);
} }
#endif #endif
#endif /* !OPENSSL_SYS_WINCE */
if (advapi) if (advapi)
{ {
acquire = (CRYPTACQUIRECONTEXT) GetProcAddress(advapi, acquire = (CRYPTACQUIRECONTEXT) GetProcAddress(advapi,
"CryptAcquireContextA"); TEXT("CryptAcquireContextA"));
gen = (CRYPTGENRANDOM) GetProcAddress(advapi, gen = (CRYPTGENRANDOM) GetProcAddress(advapi,
"CryptGenRandom"); TEXT("CryptGenRandom"));
release = (CRYPTRELEASECONTEXT) GetProcAddress(advapi, release = (CRYPTRELEASECONTEXT) GetProcAddress(advapi,
"CryptReleaseContext"); TEXT("CryptReleaseContext"));
} }
if (acquire && gen && release) if (acquire && gen && release)
@ -366,9 +383,9 @@ int RAND_poll(void)
GETFOREGROUNDWINDOW win; GETFOREGROUNDWINDOW win;
GETQUEUESTATUS queue; GETQUEUESTATUS queue;
win = (GETFOREGROUNDWINDOW) GetProcAddress(user, "GetForegroundWindow"); win = (GETFOREGROUNDWINDOW) GetProcAddress(user, TEXT("GetForegroundWindow"));
cursor = (GETCURSORINFO) GetProcAddress(user, "GetCursorInfo"); cursor = (GETCURSORINFO) GetProcAddress(user, TEXT("GetCursorInfo"));
queue = (GETQUEUESTATUS) GetProcAddress(user, "GetQueueStatus"); queue = (GETQUEUESTATUS) GetProcAddress(user, TEXT("GetQueueStatus"));
if (win) if (win)
{ {
@ -439,17 +456,17 @@ int RAND_poll(void)
MODULEENTRY32 m; MODULEENTRY32 m;
snap = (CREATETOOLHELP32SNAPSHOT) snap = (CREATETOOLHELP32SNAPSHOT)
GetProcAddress(kernel, "CreateToolhelp32Snapshot"); GetProcAddress(kernel, TEXT("CreateToolhelp32Snapshot"));
heap_first = (HEAP32FIRST) GetProcAddress(kernel, "Heap32First"); heap_first = (HEAP32FIRST) GetProcAddress(kernel, TEXT("Heap32First"));
heap_next = (HEAP32NEXT) GetProcAddress(kernel, "Heap32Next"); heap_next = (HEAP32NEXT) GetProcAddress(kernel, TEXT("Heap32Next"));
heaplist_first = (HEAP32LIST) GetProcAddress(kernel, "Heap32ListFirst"); heaplist_first = (HEAP32LIST) GetProcAddress(kernel, TEXT("Heap32ListFirst"));
heaplist_next = (HEAP32LIST) GetProcAddress(kernel, "Heap32ListNext"); heaplist_next = (HEAP32LIST) GetProcAddress(kernel, TEXT("Heap32ListNext"));
process_first = (PROCESS32) GetProcAddress(kernel, "Process32First"); process_first = (PROCESS32) GetProcAddress(kernel, TEXT("Process32First"));
process_next = (PROCESS32) GetProcAddress(kernel, "Process32Next"); process_next = (PROCESS32) GetProcAddress(kernel, TEXT("Process32Next"));
thread_first = (THREAD32) GetProcAddress(kernel, "Thread32First"); thread_first = (THREAD32) GetProcAddress(kernel, TEXT("Thread32First"));
thread_next = (THREAD32) GetProcAddress(kernel, "Thread32Next"); thread_next = (THREAD32) GetProcAddress(kernel, TEXT("Thread32Next"));
module_first = (MODULE32) GetProcAddress(kernel, "Module32First"); module_first = (MODULE32) GetProcAddress(kernel, TEXT("Module32First"));
module_next = (MODULE32) GetProcAddress(kernel, "Module32Next"); module_next = (MODULE32) GetProcAddress(kernel, TEXT("Module32Next"));
if (snap && heap_first && heap_next && heaplist_first && if (snap && heap_first && heap_next && heaplist_first &&
heaplist_next && process_first && process_next && heaplist_next && process_first && process_next &&
@ -584,7 +601,7 @@ static void readtimer(void)
DWORD w; DWORD w;
LARGE_INTEGER l; LARGE_INTEGER l;
static int have_perfc = 1; static int have_perfc = 1;
#ifdef _MSC_VER #if defined(_MSC_VER) && !defined(OPENSSL_SYS_WINCE)
static int have_tsc = 1; static int have_tsc = 1;
DWORD cyclecount; DWORD cyclecount;
@ -637,6 +654,7 @@ static void readtimer(void)
static void readscreen(void) static void readscreen(void)
{ {
#ifndef OPENSSL_SYS_WINCE
HDC hScrDC; /* screen DC */ HDC hScrDC; /* screen DC */
HDC hMemDC; /* memory DC */ HDC hMemDC; /* memory DC */
HBITMAP hBitmap; /* handle for our bitmap */ 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 */ int n = 16; /* number of screen lines to grab at a time */
/* Create a screen DC and a memory DC compatible to screen DC */ /* 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); hMemDC = CreateCompatibleDC(hScrDC);
/* Get screen resolution */ /* Get screen resolution */
@ -697,6 +715,7 @@ static void readscreen(void)
DeleteObject(hBitmap); DeleteObject(hBitmap);
DeleteDC(hMemDC); DeleteDC(hMemDC);
DeleteDC(hScrDC); DeleteDC(hScrDC);
#endif /* !OPENSSL_SYS_WINCE */
} }
#endif #endif

View File

@ -159,8 +159,10 @@
#ifdef WIN_CONSOLE_BUG #ifdef WIN_CONSOLE_BUG
# include <windows.h> # include <windows.h>
#ifndef OPENSSL_SYS_WINCE
# include <wincon.h> # include <wincon.h>
#endif #endif
#endif
/* There are 5 types of terminal interface supported, /* There are 5 types of terminal interface supported,
@ -281,10 +283,12 @@ static FILE *tty_in, *tty_out;
static int is_a_tty; static int is_a_tty;
/* Declare static functions */ /* Declare static functions */
#if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE)
static void read_till_nl(FILE *); static void read_till_nl(FILE *);
static void recsig(int); static void recsig(int);
static void pushsig(void); static void pushsig(void);
static void popsig(void); static void popsig(void);
#endif
#if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN16) #if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN16)
static int noecho_fgets(char *buf, int size, FILE *tty); static int noecho_fgets(char *buf, int size, FILE *tty);
#endif #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 */ /* Internal functions to read a string without echoing */
static void read_till_nl(FILE *in) 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; static volatile sig_atomic_t intr_signal;
#endif
static int read_string_inner(UI *ui, UI_STRING *uis, int echo, int strip_nl) 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; int ok;
char result[BUFSIZ]; char result[BUFSIZ];
int maxsize = BUFSIZ-1; int maxsize = BUFSIZ-1;
#if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE)
char *p; char *p;
#ifndef OPENSSL_SYS_WIN16
intr_signal=0; intr_signal=0;
ok=0; ok=0;
ps=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 */ /* Internal functions to handle signals and act on them */
static void pushsig(void) static void pushsig(void)
{ {
@ -618,9 +625,10 @@ static void recsig(int i)
{ {
intr_signal=i; intr_signal=i;
} }
#endif
/* Internal functions specific for Windows */ /* 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) static int noecho_fgets(char *buf, int size, FILE *tty)
{ {
int i; int i;

View File

@ -55,6 +55,9 @@
#include <string.h> #include <string.h>
#include <openssl/ui.h> #include <openssl/ui.h>
#ifdef OPENSSL_SYS_WINCE
#include <stdio_extras.h> /* BUFSIZ */
#endif
int UI_UTIL_read_pw_string(char *buf,int length,const char *prompt,int verify) int UI_UTIL_read_pw_string(char *buf,int length,const char *prompt,int verify)
{ {

13
e_os.h
View File

@ -229,6 +229,13 @@ extern "C" {
# include <io.h> # include <io.h>
# include <fcntl.h> # include <fcntl.h>
# ifdef OPENSSL_SYS_WINCE
# include <stdio_extras.h>
# include <stdlib_extras.h>
# include <string_extras.h>
# include <winsock_extras.h>
# endif
# define ssize_t long # define ssize_t long
# if defined (__BORLANDC__) # if defined (__BORLANDC__)
@ -258,7 +265,11 @@ extern "C" {
# define SSLEAY_CONF OPENSSL_CONF # define SSLEAY_CONF OPENSSL_CONF
# define NUL_DEV "nul" # define NUL_DEV "nul"
# define RFILE ".rnd" # define RFILE ".rnd"
# define DEFAULT_HOME "C:" # ifdef OPENSSL_SYS_WINCE
# define DEFAULT_HOME ""
# else
# define DEFAULT_HOME "C:"
# endif
#else /* The non-microsoft world world */ #else /* The non-microsoft world world */

View File

@ -106,11 +106,15 @@ extern "C" {
# undef OPENSSL_SYS_UNIX # undef OPENSSL_SYS_UNIX
# define OPENSSL_SYS_WINNT # define OPENSSL_SYS_WINNT
# endif # endif
# if defined(OPENSSL_SYSNAME_WINCE)
# undef OPENSSL_SYS_UNIX
# define OPENSSL_SYS_WINCE
# endif
# endif # endif
#endif #endif
/* Anything that tries to look like Microsoft is "Windows" */ /* Anything that tries to look like Microsoft is "Windows" */
#if defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINNT) #if defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE)
# undef OPENSSL_SYS_UNIX # undef OPENSSL_SYS_UNIX
# define OPENSSL_SYS_WINDOWS # define OPENSSL_SYS_WINDOWS
# ifndef OPENSSL_SYS_MSDOS # ifndef OPENSSL_SYS_MSDOS

View File

@ -5,6 +5,8 @@ rem perl util\mk1mf.pl VC-W31-32 >ms\w31.mak
perl util\mk1mf.pl dll VC-W31-32 >ms\w31dll.mak perl util\mk1mf.pl dll VC-W31-32 >ms\w31dll.mak
perl util\mk1mf.pl no-asm VC-WIN32 >ms\nt.mak perl util\mk1mf.pl no-asm VC-WIN32 >ms\nt.mak
perl util\mk1mf.pl dll no-asm VC-WIN32 >ms\ntdll.mak perl util\mk1mf.pl dll no-asm VC-WIN32 >ms\ntdll.mak
perl util\mk1mf.pl no-asm VC-CE >ms\ce.mak
perl util\mk1mf.pl dll no-asm VC-CE >ms\cedll.mak
perl util\mkdef.pl 16 libeay > ms\libeay16.def perl util\mkdef.pl 16 libeay > ms\libeay16.def
perl util\mkdef.pl 32 libeay > ms\libeay32.def perl util\mkdef.pl 32 libeay > ms\libeay32.def

View File

@ -789,10 +789,30 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
WIN32_FIND_DATA FindFileData; WIN32_FIND_DATA FindFileData;
HANDLE hFind; HANDLE hFind;
int ret = 0; int ret = 0;
#ifdef OPENSSL_SYS_WINCE
WCHAR* wdir = NULL;
#endif
CRYPTO_w_lock(CRYPTO_LOCK_READDIR); CRYPTO_w_lock(CRYPTO_LOCK_READDIR);
#ifdef OPENSSL_SYS_WINCE
/* convert strings to UNICODE */
{
BOOL result = FALSE;
int i;
wdir = malloc((strlen(dir)+1)*2);
if (wdir == NULL)
goto err_noclose;
for (i=0; i<(int)strlen(dir)+1; i++)
wdir[i] = (short)dir[i];
}
#endif
#ifdef OPENSSL_SYS_WINCE
hFind = FindFirstFile(wdir, &FindFileData);
#else
hFind = FindFirstFile(dir, &FindFileData); hFind = FindFirstFile(dir, &FindFileData);
#endif
/* Note that a side effect is that the CAs will be sorted by name */ /* Note that a side effect is that the CAs will be sorted by name */
if(hFind == INVALID_HANDLE_VALUE) if(hFind == INVALID_HANDLE_VALUE)
{ {
@ -807,7 +827,11 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
char buf[1024]; char buf[1024];
int r; int r;
#ifdef OPENSSL_SYS_WINCE
if(strlen(dir)+_tcslen(FindFileData.cFileName)+2 > sizeof buf)
#else
if(strlen(dir)+strlen(FindFileData.cFileName)+2 > sizeof buf) if(strlen(dir)+strlen(FindFileData.cFileName)+2 > sizeof buf)
#endif
{ {
SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG); SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG);
goto err; goto err;
@ -825,6 +849,10 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
err: err:
FindClose(hFind); FindClose(hFind);
err_noclose: err_noclose:
#ifdef OPENSSL_SYS_WINCE
if (wdir != NULL)
free(wdir);
#endif
CRYPTO_w_unlock(CRYPTO_LOCK_READDIR); CRYPTO_w_unlock(CRYPTO_LOCK_READDIR);
return ret; return ret;
} }

View File

@ -143,6 +143,9 @@
#ifdef OPENSSL_SYS_VMS #ifdef OPENSSL_SYS_VMS
# define TEST_SERVER_CERT "SYS$DISK:[-.APPS]SERVER.PEM" # define TEST_SERVER_CERT "SYS$DISK:[-.APPS]SERVER.PEM"
# define TEST_CLIENT_CERT "SYS$DISK:[-.APPS]CLIENT.PEM" # define TEST_CLIENT_CERT "SYS$DISK:[-.APPS]CLIENT.PEM"
#elif defined(OPENSSL_SYS_WINCE)
# define TEST_SERVER_CERT "\\OpenSSL\\server.pem"
# define TEST_CLIENT_CERT "\\OpenSSL\\client.pem"
#else #else
# define TEST_SERVER_CERT "../apps/server.pem" # define TEST_SERVER_CERT "../apps/server.pem"
# define TEST_CLIENT_CERT "../apps/client.pem" # define TEST_CLIENT_CERT "../apps/client.pem"

View File

@ -24,6 +24,7 @@ $infile="MINFO";
%ops=( %ops=(
"VC-WIN32", "Microsoft Visual C++ [4-6] - Windows NT or 9X", "VC-WIN32", "Microsoft Visual C++ [4-6] - Windows NT or 9X",
"VC-CE", "Microsoft eMbedded Visual C++ 3.0 - Windows CE ONLY",
"VC-NT", "Microsoft Visual C++ [4-6] - Windows NT ONLY", "VC-NT", "Microsoft Visual C++ [4-6] - Windows NT ONLY",
"VC-W31-16", "Microsoft Visual C++ 1.52 - Windows 3.1 - 286", "VC-W31-16", "Microsoft Visual C++ 1.52 - Windows 3.1 - 286",
"VC-WIN16", "Alias for VC-W31-32", "VC-WIN16", "Alias for VC-W31-32",
@ -137,6 +138,10 @@ elsif (($platform eq "VC-WIN32") || ($platform eq "VC-NT"))
$NT = 1 if $platform eq "VC-NT"; $NT = 1 if $platform eq "VC-NT";
require 'VC-32.pl'; require 'VC-32.pl';
} }
elsif ($platform eq "VC-CE")
{
require 'VC-CE.pl';
}
elsif ($platform eq "Mingw32") elsif ($platform eq "Mingw32")
{ {
require 'Mingw32.pl'; require 'Mingw32.pl';