Ok. Thanks.
So, here SSL_write( ) wants to read( ). In fact, ssl_accept( ) fails ( but I
continued instead of returning -1 for example. I repaired this programming
error. Now it's OK ).
-- Then I realize that ssl_accept returns ***ret = 0. *
-- I check if ret < 1. If true then I make : gret = SSL_get_error(ssl, ret)
-- Then, I make a switch(gret) and I realize that gret =  *SSL_ERROR_SYSCALL
*
-- Then, I make ERR_get_error(); it returns 0. According to the doc (
http://www.openssl.org/docs/ssl/SSL_get_error.html#RETURN_VALUES) I can
recheck *ret* value. If it is == 0 it says that "an EOF was observed that
violates the protocol".

My questions :
1) Did I well interpreted the doc ?
2) What does "an EOF was observed that violates the protocol" mean ?

3) I come back to the SSL_write( ). He wants to read( ).
The doc says :
" Caveat: Any TLS/SSL I/O function can lead to either of *
SSL_ERROR_WANT_READ* and *SSL_ERROR_WANT_WRITE*. In particular, SSL_read()or
SSL_peek() may want to write data and SSL_write() may want to read data.
This is mainly because TLS/SSL handshakes may occur at any time during the
protocol (initiated by either the client or the server); SSL_read(),
SSL_peek(), and SSL_write() will handle any pending handshakes. "
3.1) When the doc says "SSL_write () may want to read data"... what does it
mean exactly ? Does it mean that a function is blocked somewhere because it
wants read ? ( In my case : this function is accept( ) ?? )
3.2) Does the client and server share the same ssl object ... ?

Thanks.

2011/3/2 lzyzizi <lzyz...@126.com>

> If you stepped a bit into the source code , you would have found the answer
> yourself.
>
> They are defined in the ssl.h.You may see the help doc for more details.
> #define SSL_ERROR_NONE            0
> #define SSL_ERROR_SSL            1
> #define SSL_ERROR_WANT_READ        2
> #define SSL_ERROR_WANT_WRITE        3
> #define SSL_ERROR_WANT_X509_LOOKUP    4
> #define SSL_ERROR_SYSCALL        5 /* look at error stack/return
> value/errno */
> #define SSL_ERROR_ZERO_RETURN        6
> #define SSL_ERROR_WANT_CONNECT        7
> #define SSL_ERROR_WANT_ACCEPT        8
>
>
> At 2011-03-02 22:55:51,ikuzar <razuk...@gmail.com> wrote:
>
> Hello,
> SSL_write fails in my program. After debuging, I have got err = 2 in  err =
> SSL_get_error(ssl, err);
> Does someone know what does it mean ?
> Thanks.
>
>
>
>

Reply via email to