I have a problem with OpenSSL-0.9.6. Would you mind you help me?
I'm using OpenSSL lib to get SSL access to the email server via IMPA4 protocol. I
have develop a DLL which is provide access to IMPA4 server. If I'm not using SSL the
DLL is working fine. If I will replace Read() and Write() functions by SSL_read() and
SSL_write() I get a strange behavior: Dll if working under Windows 2000
Professional/Server.
In the begining I initalizing the SLL and establishing a connection:
//...
SSL *m_SecureConnection;
SSL_CTX *m_ctx;
SSL_METHOD *SSLConnectMethod = NULL;
SSL_library_init ();
SSLConnectMethod = SSLv3_client_method ( );
m_ctx = SSL_CTX_new ( SSLConnectMethod );
if ( m_ctx )
{
m_SecureConnection = SSL_new ( m_ctx );
if ( m_SecureConnection )
{
int rc;
rc = SSL_set_fd ( m_SecureConnection, m_Socket->GetHandle () );
if ( (rc = SSL_connect ( m_SecureConnection )) == 1 )
{
//Secure SSL connection to mail server established
}
else
{
//failed
}
}
else
{
//failed
}
}
else
{
//failed
}
//...
This code working well. The connection to server is established
Than I Read/Write IMAP4 messages:
int nBytesRead = SSL_read ( m_SecureConnection, pBuffer, dwBufferSize );
if ( nBytesRead > 0 ) {...}
nBytesWritten = SSL_write ( m_SecureConnection, pBuffer, dwBufferSize );
if ( nBytesWritten > 0) {...}
This is also working well.
UNFORTUNATELY the next code fails. When I'm tryieng to finish connection I get
SSL_ERROR_SYSCALL: rc = SSL_shutdown ( m_SecureConnection );
if (rc == 0)
{
// as suggested in the spec if 1st shutdown fails, try again
rc = SSL_shutdown ( m_SecureConnection );
}
SSL_free(m_SecureConnection);
SSL_CTX_free(m_ctx);
m_SecureConnection = NULL;
m_ctx = NULL;
The problem is that SSL_shutdown() returns "0" with SSL_get_error() ==
"SSL_ERROR_SYSCALL" in both cases.
Could you help me? May be I'm forgot to do something?
PS: If I'm using SSLv2_client_method instead of SSLv3_client_method, the first
SSL_shutdown() returns "1" (no problems)
Thanks in Advance
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]