Problems with non-blocking sockets and SSL

2002-06-14 Thread Martin Sjögren

Hello.

I'm having a few delicate problems, and I think at least one of them
adheres to non-blocking sockets, which is what I use.

1) Is it possible to get a WANT_WRITE error when I actually don't have
anything to send (on my high-level layer)? In that case, how should I
handle this? When I do SSL_write with an empty string, I get an error, but
maybe I won't get an error when I do SSL_write with an empty string on a
WANT_WRITE?
Am I far out? Maybe I simply don't understand how WANT_READ/WRITE work.
:( Exactly when will I get a WANT_WRITE? Is it only when the transporting
BIO failed to send more?

2) Say I have a program that sends a tiny crucial piece of data to another
program and can't do anything before it gets another tiny crucial piece of
data back... Can this go wrong in the sense that the first (or second for
that matter) piece of data isn't large enough to fill an SSL record, so
that it won't get sent and everything locks down? Or can it be padded
automatically in some way?


Do I make sense? :)


Regards,
Martin

-- 
Martin Sjögren
  [EMAIL PROTECTED]  ICQ : 41245059
  Phone: +46 (0)31 7710870   Cell: +46 (0)739 169191
  GPG key: http://www.strakt.com/~martin/gpg.html
__
OpenSSL Project http://www.openssl.org
User Support Mailing List[EMAIL PROTECTED]
Automated List Manager   [EMAIL PROTECTED]



Re: Problems with non-blocking sockets and SSL

2002-06-14 Thread Bodo Moeller

On Fri, Jun 14, 2002 at 04:17:58PM +0200, Martin Sjögren wrote:

 I'm having a few delicate problems, and I think at least one of them
 adheres to non-blocking sockets, which is what I use.
 
 1) Is it possible to get a WANT_WRITE error when I actually don't have
 anything to send (on my high-level layer)? [...]

Yes.  See the SSL_get_error() manpage,
http://www.openssl.org/docs/ssl/SSL_get_error.html


 2) Say I have a program that sends a tiny crucial piece of data to another
 program and can't do anything before it gets another tiny crucial piece of
 data back... Can this go wrong in the sense that the first (or second for
 that matter) piece of data isn't large enough to fill an SSL record, so
 that it won't get sent and everything locks down?  [...]

No.  Records can be tiny, the application does not have to worry about
this.


-- 
Bodo Möller [EMAIL PROTECTED]
PGP http://www.informatik.tu-darmstadt.de/TI/Mitarbeiter/moeller/0x36d2c658.html
* TU Darmstadt, Theoretische Informatik, Alexanderstr. 10, D-64283 Darmstadt
* Tel. +49-6151-16-6628, Fax +49-6151-16-6036
__
OpenSSL Project http://www.openssl.org
User Support Mailing List[EMAIL PROTECTED]
Automated List Manager   [EMAIL PROTECTED]