Hi All,

     I am using openssl-1.0.1c in our project.when SSL_shutdown(ssl) get
executed it returns 0.If I get return value zero then calling  the same
SSL_shutdown(ssl) again.In 2nd time it return -1/SSL_ERROR_WANT_READ. Now I
am doing SSL_read(), but it returns -1.Again I am calling SSL_shutdown(ssl)
and it returns -1/SSL_ERROR_WANT_READ.How can I execute SSL_shutdown(ssl),
so that it will return 1. Code snippet given below

while(1)
    {
        status = SSL_shutdown(ssl);
        if(status == 1)
        {
           printf("ssl_shutdown() successfull");
        }
        else if(status == 0)
        {
          printf("ssl_shutdown() client  successfull");
        }
        else
        {
          err = SSL_get_error(ssl, status);
            switch (err)
            {
                case SSL_ERROR_WANT_READ:
                length = SSL_read(ssl,buf,size);//returns -1
                printf("ERROR: ssl SSL_ERROR_WANT_READ : %d",length);
                break;
            }
      if(status == 1)
     break;

}

O/p:
ssl_shutdown() client  successfull
ERROR: ssl SSL_ERROR_WANT_READ : -1
ERROR: ssl SSL_ERROR_WANT_READ : -1
ERROR: ssl SSL_ERROR_WANT_READ : -1
.
.
.

Please suggest me how to do ssl_shutdown().
Thanks
Priyarajan

Reply via email to