Dave Mitchell wrote:
> Can calls to non-blocking SSL_read() and SSL_write() be interleaved?
>
> I'm doing select() / event driven IO, and using a BIO pair to handle the
> underlying socket IO myself.
Yes, but not from 2 threads working on the same "SSL *" at the same time.
So your single threaded example is fine.
2 threads can work on 2 different "SSL *" instances at the same time,
providing you have setup and configured the necessary OpenSSL threading
primitives.
There is no such thing as an unfinished SSL_read() call. Either it
returns data or it doesn't.
Each time you call the method OpenSSL will attempt to make further
progress on returning more data.
Some people might say that when you call SSL_write() to push more data
that you can not change some elements of arguments to the call, when you
got a partial write occur (100% of the data you offered was not written).
I have never found this to be the case. Search for Internet concerning:
/usr/include/openssl/ssl.h:#define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER
0x00000002L
Even the description does not make much sense, the address of the bytes
isn't important.
No one on this list has explained why this exists and a look over the
source for the macro label shows it to make no difference.
Darryl