In compiling openssl head (tarball from 18 November 2010) for mingw
under cygwin on a Windows98 machine, I came across a problem in
crypto/bss_file.c. The code compiles fine on Windows98 and the
openssl.exe executable works fine on WindowsXP, but fails to work on
Windows98. The problem shows up during make test when testenc calls the
executable from the apps directory. It looks like even when linked with
libunicows, Windows98 can't handle the unicode functions. I can't figure
out how to make this work on Win98, so I would propose for now adding a
check of the verion of Windows. Unicode should be supported starting at
NT4, so this patch should exclude the code on prior systems. If anyone
has a fix to make the code work on Win98, that would be better.

Error messages when running the compiled openssl.exe on Win98 look like:

4294277479:error:020013EC:system 
library:fopen:reason(1004):bss_file.c:163:fopen('../apps/openssl.cnf','rb')
4294277479:error:2006D002:BIO routines:BIO_new_file:system lib:bss_file.c:168:
4294277479:error:0E078002:configuration file routines:DEF_LOAD:system 
lib:conf_def.c:199:

Patch is attached. In order to compile, I also had to include the patch
for e_capi.c previously submitted by Guenter as #2374.

Since I am in the US, I am sending a copy of this to the Bureau of
Industry and Security and to the NSA.

Doug

-- 
Doug Kaufman
Internet: [email protected]

--- crypto/bio/bss_file.c.ori   2010-11-18 22:02:18.000000000 -0800

+++ crypto/bio/bss_file.c       2010-11-19 11:59:58.000000000 -0800

@@ -120,9 +120,14 @@

        {

        BIO  *ret;

        FILE *file=NULL;

-

 #if defined(_WIN32) && defined(CP_UTF8)

-       int sz, len_0 = (int)strlen(filename)+1;

+        OSVERSIONINFO osverinfo ;

+        osverinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO) ;

+        GetVersionEx( &osverinfo ) ;

+

+        if ( osverinfo.dwPlatformId == VER_PLATFORM_WIN32_NT)

+       {

+       int sz, len_0 = (int)strlen(filename)+1; 

 

        /*

         * Basically there are three cases to cover: a) filename is

@@ -135,8 +140,11 @@

         * MultiByteToWideChar fails reporting

         * ERROR_NO_UNICODE_TRANSLATION, in which case we fall

         * back to fopen...

+        *

+        * The version test is for NT 4.0 or greater, needed to 

+        * support _wfopen.

         */

-       if ((sz=MultiByteToWideChar(CP_UTF8,MB_ERR_INVALID_CHARS,

+        if ((sz=MultiByteToWideChar(CP_UTF8,MB_ERR_INVALID_CHARS,

                                        filename,len_0,NULL,0))>0)

                {

                WCHAR  wmode[8];

@@ -155,6 +163,11 @@

                {

                file = fopen(filename,mode);

                }

+       }

+       else

+       {

+       file=fopen(filename,mode);      

+       }

 #else

        file=fopen(filename,mode);      

 #endif

--- engines/e_capi.c.ori        2010-11-18 19:05:56.000000000 -0800

+++ engines/e_capi.c    2010-11-18 19:08:48.000000000 -0800

@@ -79,7 +79,9 @@

  * crypt32.lib are in shape. Yes, it's rather "weak" test and if

  * compilation fails, then re-configure with -DOPENSSL_NO_CAPIENG.

  */

-#ifdef CERT_KEY_PROV_INFO_PROP_ID

+#if defined(CERT_KEY_PROV_INFO_PROP_ID) && \

+    defined(CERT_STORE_PROV_SYSTEM_A) && \

+    defined(CERT_STORE_READONLY_FLAG)

 # define __COMPILE_CAPIENG

 #endif /* CERT_KEY_PROV_INFO_PROP_ID */

 #endif /* OPENSSL_NO_CAPIENG */

Reply via email to