Hi*!
I am implementing IOCP server (for Windows OS) supporting SSL. For SSL part i am trying to use OpenSSL's bio pairs. I have looked at the example in ssltest.c. As i understand (please correct me if i am wrong) of the three bios (s_ssl_bio, server, server_io) that get created in "doit_biopair" function, the "server_io" bio is used to read/write "Encrypted" data & the "s_ssl_bio" is used to read/write "UNEncrypted" data. I have setup my code according to this principle. Now when the client connects, it sends some "ssl-handshake" (Encrypted) data & I have to write it "server_io". Here is how my function looks for writing to "server_io" BIO.

bool CSSLSession::OnRecv(const std::string& RecvData)
{
        bool bRet = false;
        char *pData = NULL;
        int nRet = -1;
        int nLen = -1;

        nLen = BIO_ctrl_get_read_request(m_SessionInfo.ioBio);

        if( !nLen )
        {
                bRet = true;
                return bRet;
        }

        nRet = BIO_nwrite0(m_SessionInfo.ioBio, &pData);

        if( 0 >= nRet || nLen > nRet || !pData )
        {
                return bRet;
        }

        nRet = nLen;

#pragma warning (disable : 4018)
        if( nRet > RecvData.size() )
        {
                nRet = RecvData.size();
        }
#pragma warning (default: 4018)

        memcpy(pData, RecvData.data(), nRet);

        nRet = BIO_nwrite(m_SessionInfo.ioBio, &pData, nRet);
        BIO_flush(m_SessionInfo.ioBio);

        bRet = true;

        return bRet;
}

I am for the time being not handling the retry options (will implement later). Now the problem is this call "nLen = BIO_ctrl_get_read_request(m_SessionInfo.ioBio);" always return 0 & the function returns after that. Shouldn't the SSL engine be wating for some data on start of server side session?? since its the client who always sends the handshake data first. Can anyone help me solve this problem??? I check the return values while setting up ssl context and SSL objects and they all are retuning success.
Thanks in Advance,
Regards,
Usman.

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! http://search.msn.com/

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [email protected]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to