Could it be that the browser requests are being blocked by Windows Firewall?

Mark Itzcovitz
VISTA Technology Consultant
Publishing Technology plc
T: +44 1865 397849
mark.itzcov...@publishingtechnology.com
www.publishingtechnology.com

Publishing Technology plc is registered in England No. 837205
Registered Office: 8100 Alec Issigonis Way, Oxford Business Park North, Oxford, 
OX4 2HU

-----Original Message-----
From: owner-openssl-us...@openssl.org [mailto:owner-openssl-us...@openssl.org] 
On Behalf Of Mike Nosler
Sent: 16 August 2011 16:50
To: openssl-users@openssl.org
Subject: Why do these 12 lines of Win32 code work on XP but hang forever in 
Vista and Windows 7?

This Delphi code starts a minimal SSL server:

WSAStartup(MakeWord(1,1), WData);
SSL_library_init;
SSL_load_error_strings;
ctx := SSL_CTX_new(SSLv23_server_method);
SSL_CTX_use_certificate_chain_file(ctx, 'cert.pem');
SSL_CTX_use_PrivateKey_file(ctx, 'key.pem', 1);
SSL_CTX_check_private_key(ctx);
bio_ssl := BIO_new_ssl(ctx, 0);
bio_in := BIO_new_accept('443');
BIO_set_accept_bios(bio_in, bio_ssl);
BIO_do_accept(bio_in); // set up the socket
BIO_do_accept(bio_in); // wait for connection

Everything works fine on XP.  The code stays in the second
BIO_do_accept() waiting for a connection, and sending an HTTPS request
from a browser causes BIO_do_accept() to return.

On 32-bit Vista Home Premium and 64-bit Windows 7, the second
BIO_do_accept() hangs forever, and the browser can't connect.  Why?

The various definitions used are:

    const
      SSLEAY32DLL = 'ssleay32.dll';
      LIBEAY32DLL = 'libeay32.dll';
      LIBSSL32DLL = 'libssl32.dll';

    function SSL_CTX_check_private_key(ctx: Pointer): BOOL; cdecl;
external SSLEAY32DLL;
    function SSL_CTX_new(meth: Pointer): Pointer; cdecl; external SSLEAY32DLL;
    function SSL_CTX_use_certificate_chain_file(ctx: Pointer; FName:
PChar): Integer; cdecl; external SSLEAY32DLL;
    function SSL_CTX_use_PrivateKey_file(ctx: Pointer; FName: PChar;
AType: Integer): Integer; cdecl; external SSLEAY32DLL;
    procedure SSL_library_init; cdecl; external SSLEAY32DLL;
    procedure SSL_load_error_strings; cdecl; external SSLEAY32DLL;
    function SSLv23_server_method: Pointer; cdecl; external SSLEAY32DLL;

    function BIO_new_ssl(ctx: Pointer; client: Integer): Pointer;
cdecl; external LIBSSL32DLL;
    function BIO_new_accept(port: pchar): Pointer; cdecl; external LIBEAY32DLL;
    function BIO_ctrl(bp: Pointer; cmd: Integer; larg: Longint; parg:
Pointer): longint; cdecl; external LIBEAY32DLL;
    function BIO_set_accept_bios(b, bio: pointer): integer; const
BIO_C_SET_ACCEPT = 118; begin result := BIO_ctrl(b, BIO_C_SET_ACCEPT,
2, bio); end;
    function BIO_do_accept(b: pointer): integer; const
BIO_C_DO_STATE_MACHINE = 101; begin result := BIO_ctrl(b,
BIO_C_DO_STATE_MACHINE, 0, nil); end;

    var WData: TWSAData; ctx, bio_ssl, bio_in: pointer;

Changing the 32-bit .EXE's various compatibility modes (Windows XP,
Windows NT, etc) has no effect. I'm using OpenSSL 1.0.0d
(LIBEAY32.DLL, LIBSSL32.DLL, SSLEAY32.DLL).
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

The information in this message is intended solely for the addressee and should 
be considered confidential.  Publishing Technology does not accept legal 
responsibility for the contents of this message and any statements contained 
herein which do not relate to the official business of Publishing Technology 
are neither given nor endorsed by Publishing Technology and are those of the 
individual and not of Publishing Technology. This message has been scanned for 
viruses using the most current and reliable tools available and Publishing 
Technology excludes all liability related to any viruses that might exist in 
any attachment or which may have been acquired in transit.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to