try this to find the error:

                       i=SSL_accept(con);
                       switch (SSL_get_error(con,i))
                               {
                       case SSL_ERROR_NONE:
                               break;
                       case SSL_ERROR_WANT_WRITE:
                       case SSL_ERROR_WANT_READ:
                       case SSL_ERROR_WANT_X509_LOOKUP:
                               continue;
                       case SSL_ERROR_SYSCALL:
                       case SSL_ERROR_SSL:
                       case SSL_ERROR_ZERO_RETURN:
                               ret=1;
                               goto err;
                               /* break; */
                               }

you can find the code in <openssl_src>/apps/s_server.c

Edward Chan wrote:

SSL_accept() is returning <= 0. And when I trace out the err msg using the following code

        int iRet = SSL_accept(m_pSSL);
        if (iRet <= 0)
        {// handshake failed
                char buf[256];
                ERR_error_string_n(ERR_get_error(), buf, sizeof(buf));
                printf(buf);
        }

I get the following error string:

error:00000000:lib(0):func(0):reason(0)

Either I'm not getting the error string properly? Or SSL_accept() failed with some valid error? Unfortunately, I don't know whether 0 or -1 was returned. Would I be correct in assuming that if 0 was returned, that ERR_get_error() would return 0, and that I should be calling SSL_get_error() instead? In which case, I'm wondering what the possible conditions are for this to happen. Could it be that SSL_accept() is failing with an SSL_ERROR_WANT_READ/WRITE error? The socket is non-blocking. The client did not close its end during the handshake, and it should be capable of supporting all the ciphers and protocol versions that the server does.

Thanks,
Ed

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

Reply via email to