RE: Confusion about SSL_ERROR_WANT_READ/WRITE

2005-04-20 Thread David Schwartz
Thanks for the info. One last question :) So if I am using blocking sockets, than would I ever get a WANT_WRITE error? I'm guessing no? No, it should just block until it gets some application data or can send the application data. But if I am using BIO pairs, and blocking sockets,

RE: Confusion about SSL_ERROR_WANT_READ/WRITE

2005-04-19 Thread Edward Chan
- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Sunday, April 17, 2005 11:01 PM To: openssl-users@openssl.org Subject: Re: Confusion about SSL_ERROR_WANT_READ/WRITE If all that was sent was the protocol data that the write was waiting for to satisfy the ssl state machine

Re: Confusion about SSL_ERROR_WANT_READ/WRITE

2005-04-18 Thread Joseph Bruni
If all that was sent was the protocol data that the write was waiting for to satisfy the ssl state machine, and no application data was sent, would SSL_read return the number of bytes actually read off the socket (which is just protocol data), or would it read that transparently and return 0

RE: Confusion about SSL_ERROR_WANT_READ/WRITE

2005-04-17 Thread David Schwartz
Yes, I think I understand what you are saying. If I get a WANT_READ from a call to SSL_write, that means I need to read some data before I can send. Not quite, it means the OpenSSL engine must read some data (from the socket) before you can perform the 'write' logical operation on

RE: Confusion about SSL_ERROR_WANT_READ/WRITE

2005-04-17 Thread Edward Chan
Yes, I think I understand what you are saying. If I get a WANT_READ from a call to SSL_write, that means I need to read some data before I can send. Not quite, it means the OpenSSL engine must read some data (from the socket) before you can perform the 'write' logical

RE: Confusion about SSL_ERROR_WANT_READ/WRITE

2005-04-17 Thread David Schwartz
There may not be any application data, but there should be data sent over the SSL connection. Protocol data? Like an ack for some previous data sent? Well, remember no data at all can be sent until a key is negotiated. So if you immediately call SSL_write, it will be unable

RE: Confusion about SSL_ERROR_WANT_READ/WRITE

2005-04-17 Thread Edward Chan
First of all, I want to thank everyone for all the information, especially David with his excellent explanations. I know this thread is getting long, but I really think I'm getting it now :) Just a few more questions and comments... There may not be any application data, but there should

Re: Confusion about SSL_ERROR_WANT_READ/WRITE

2005-04-17 Thread Joseph Bruni
A return result of 0 typically means the other side closed the connection. Here is the section from SSL_read's man page with regards to a 0 return: 0 The read operation was not successful. The reason may either be a clean shutdown due to a close notify alert sent by the

RE: Confusion about SSL_ERROR_WANT_READ/WRITE

2005-04-17 Thread Edward Chan
that I should retry the SSL_read when more data arrives? Now that I think about it, I'm guessing the latter. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Sunday, April 17, 2005 9:48 PM To: openssl-users@openssl.org Subject: Re: Confusion about

Re: Confusion about SSL_ERROR_WANT_READ/WRITE

2005-04-17 Thread Joseph Bruni
You're right -- the latter. Another thing to think about is that at any time, the remote peer might request a re-negotiation. During such time, the session key will be re-established requiring a few round-trips during the DH process. This will all be handled behind the scenes as you attempt to

RE: Confusion about SSL_ERROR_WANT_READ/WRITE

2005-04-16 Thread David Schwartz
Thanks for this explanation. As I read more, I think I am getting a better understanding of this. So unlike normal tcp connections, where a read juts reads, and a write just writes, SSL_read may write, and SSL_write may read. This is all done under the hood, so I don't need to be

RE: Confusion about SSL_ERROR_WANT_READ/WRITE

2005-04-16 Thread Edward Chan
] [mailto:[EMAIL PROTECTED] Sent: Saturday, April 16, 2005 3:02 AM To: openssl-users@openssl.org Subject: RE: Confusion about SSL_ERROR_WANT_READ/WRITE Thanks for this explanation. As I read more, I think I am getting a better understanding of this. So unlike normal tcp connections

Re: Confusion about SSL_ERROR_WANT_READ/WRITE

2005-04-16 Thread Joseph Bruni
that caused it? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Saturday, April 16, 2005 3:02 AM To: openssl-users@openssl.org Subject: RE: Confusion about SSL_ERROR_WANT_READ/WRITE Thanks for this explanation. As I read more, I think I am getting a better

RE: Confusion about SSL_ERROR_WANT_READ/WRITE

2005-04-16 Thread Edward Chan
10:43 AM To: openssl-users@openssl.org Subject: Re: Confusion about SSL_ERROR_WANT_READ/WRITE You're on the money. This confused me, too. I had a program that needed to see if there was incoming data, and so I performed an SSL_read(). I received back a WANT_READ, because

Confusion about SSL_ERROR_WANT_READ/WRITE

2005-04-15 Thread Edward Chan
Title: Confusion about SSL_ERROR_WANT_READ/WRITE I have an app where reads and writes happen from different threads. Now, ideally, one would envision that I just replace the reads/writes with SSL_read/SSL_write. Now I know it is not as simple as that. What exactly is the meaning

Re: Confusion about SSL_ERROR_WANT_READ/WRITE

2005-04-15 Thread Christopher Fowler
Whats wrong with select? Or are you using java that does not support select() On Fri, 2005-04-15 at 18:24, Edward Chan wrote: I have an app where reads and writes happen from different threads. Now, ideally, one would envision that I just replace the reads/writes with SSL_read/SSL_write.

Re: Confusion about SSL_ERROR_WANT_READ/WRITE

2005-04-15 Thread Dr. Stephen Henson
On Fri, Apr 15, 2005, Edward Chan wrote: I have an app where reads and writes happen from different threads. Now, ideally, one would envision that I just replace the reads/writes with SSL_read/SSL_write. Now I know it is not as simple as that. If you read and write the same stream in

RE: Confusion about SSL_ERROR_WANT_READ/WRITE

2005-04-15 Thread David Schwartz
I have an app where reads and writes happen from different threads. Now, ideally, one would envision that I just replace the reads/writes with SSL_read/SSL_write. Now I know it is not as simple as that. You need to wrap each SSL connection with a lock and hold that lock when you call

RE: Confusion about SSL_ERROR_WANT_READ/WRITE

2005-04-15 Thread Edward Chan
] [mailto:[EMAIL PROTECTED] Sent: Friday, April 15, 2005 4:58 PM To: openssl-users@openssl.org Subject: RE: Confusion about SSL_ERROR_WANT_READ/WRITE I have an app where reads and writes happen from different threads. Now, ideally, one would envision that I just replace the reads