how to test WANT_READ and WANT_WRITE cases?

2009-05-12 Thread Nate Leon
Is there an easy way to test that my code is handling the WANT_READ and WANT_WRITE cases properly? e.g. when: 1.) SSL_read() returns WANT_READ 2.) SSL_read() returns WANT_WRITE 3.) SSL_write() returns WANT_READ 4.) SSL_write() returns WANT_WRITE Case #1 seems to be easy to test by reading small b

RE: BIO_flush with BIO_pairs?

2009-05-01 Thread Nate Leon
0:53 PM To: openssl-users@openssl.org Subject: Re: BIO_flush with BIO_pairs? On Thu, Apr 30, 2009 at 04:05:49PM -0700, Nate Leon wrote: > Is there any use for BIO_flush when using BIO_pairs? No, they don't have anywhere to drain (flush) the data to.

BIO_flush with BIO_pairs?

2009-04-30 Thread Nate Leon
Is there any use for BIO_flush when using BIO_pairs? I am using buffers in a BIO_pair to do en/decryption between the network and my app. e.g.: BIO_pair -- The <---> WSARecv <---> BIO_write <---> net

Re: last data bytes not delivered when read in several small buffers

2009-03-31 Thread Nate Leon
I like it: * make a read for data length = read buffer length (some kbytes) and then loop on SSL_pending and SSL_read to get the rest of the record, until SSL_pending returns 0. In that case, after the first SSL_read has returned something select is useless. BTW, does anybody

RE: TLS, BIOs, SSL_read/write

2009-03-20 Thread Nate Leon
I did find this comment in ssltest.c : * A BIO pair behaves similar to a non-blocking socketpair * (but both endpoints must be handled by the same thread). i.e. You can NOT have Thread1 write to a BIO_pair and expect Thread2 to read it off the BIO_pair. Is that what you were referring to? Regard

RE: TLS, BIOs, SSL_read/write

2009-03-19 Thread Nate Leon
Again, thanks for all the pointers, these are really helpful getting me going in the right direction. I am still digesting all of your info, but wanted to discuss this point further, as it almost sounds like a show-stopper: > be aware that SSL BIO's (and (SSL*) sessions!) are 'threadsafe' in the s

RE: TLS, BIOs, SSL_read/write

2009-03-18 Thread Nate Leon
All good points. I was not planning to go to production with that code - I was just happy to see something working. :) I was trying to figure out a way to call SSL_set_bio once per session with both read and write buffers, but I am stumped there since this call: m_bioMem = BIO_new_mem_buf(encry

RE: TLS, BIOs, SSL_read/write

2009-03-16 Thread Nate Leon
That was the trick - I was trying to write to a : BIO* bioMem = BIO_new(BIO_f_buffer()); which doesn't really make sense. Indeed, this is working: BIO* bioMem = BIO_new(BIO_s_mem()); SSL_set_bio(m_ssl, NULL, bioMem); SSL_write(m_ssl, responseData, nRespDataSize); My SSL object (m_

TLS, BIOs, SSL_read/write

2009-03-13 Thread Nate Leon
Greetings, I am in the process of converting an SMTP/TLS server to use Async IO. (using IO Completion Ports on Windows) As such, the previously working style of using SSL_accept, select, and SSL_read / SSL_write is no longer sufficient. Now that I am using WSARecv to do the read, my app is notifie

RE: caching problem?

2007-12-13 Thread Nate Leon
Since I never got any replies to this, I figured it might be useful to update the group with the solution... Indeed, the problem was with my application. I was just using ::select() to see if there was data waiting for me to SSL_read off the socket, which I cover to discover is not reliable.