Lutz Jaenicke <[EMAIL PROTECTED]> writes:
> On Mon, May 07, 2001 at 04:25:10PM -0400, Tom Biggs wrote:
> > Say an application uses SSL_write() to write out (on a non-blocking socket)
> > a large buffer, which contains more bytes than an underlying SSL record can
> > carry.
> > What is the behavior if, for example, one SSL record is successfully written,
> > but EWOULDBLOCK is returned when OpenSSL tries to write the next SSL record?
> > What value would be returned by SSL_write()? Would it be
> > A: the number of bytes which were transmitted, or
> > B: -1 to indicate a failure?
>
> 1. I would also recommend Eric Rescorla's book, as the other poster did,
> as a good book about the SSL/TLS protocol and implementations.
Thanks. :)
> 2. Having this said: unlike write() SSL_write() will only return with
> "success", when the complete buffer was written. Partial writes are
> not supported. Thus for the scenario you describe, option "B"
> applies.
Mostly, but not always. IF you use SSL_MODE_ENABLE_PARTIAL_WRITE
then it will do partial writes provided that the data you're passing
in is longer than 1 SSL record.
> > Or, if case 'B' is true, does that imply that the OpenSSL library tracks
> > how many
> > bytes have been written and keeps an offset pointer into 'buf' so that it
> > knows
> > where to start the next write?
>
> Yes. It keeps the necessary information internally (whether by an
> absolute pointer or an offset pointer I don't know without looking
> into the source).
I believe it has an offset pointer because (if you use the proper
flags) you can pass in a buffer with the same contents
(SSL_MODE_ACCEPT_MOVING_BUFFER).
-Ekr
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]