Thanks Lutz,

And further reading on the archive and google has also enlightened me on this.
I'm actually almost surprised that this has worked at all, but I guess it
depends on the relative sizes of the SSL block and my 8k block.

I don't want to sound too ignorant of SSL (although I am), but what is the block
size in the SSL buffering layer?  It could make a difference to the way I want
to change our code.  If the block size is not much larger than 8k, then I guess
I could do an SSL_pending() and read the remainder.  If it is much larger then I
could change the loop construct to include both real read events from select()
and virtual read events from SSL_pending().

In our application the WANT_READ, etc. is handled locally by re-calling SSL_read
(or SSL_write, or ...) until the condition ends.  I guess this is safe?

G.





Lutz Jaenicke <[EMAIL PROTECTED]> on 2001-02-21 15:14:20

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:    (bcc: George Shaw/EMEA/Viewlocity)

Subject:  Re: SSL_read buffering problem?



On Wed, Feb 21, 2001 at 01:25:08PM -0500, [EMAIL PROTECTED] wrote:
> Does the SSL layer have its own read buffering?

Since the data come in in blocks (encrypted, with checksum etc) internal
buffering occurs that may not fall together with your 8kB boundary.

> Our application has a standard non-blocking socket loop where we wait for a
read
> event, read 8k, and go back to wait for more.  If we have more than 8k then we
> have multiple events until the data is complete.
>
> On extending the application to use OpenSSL, this seemed to work OK during
> testing, replacing the socket read with SSL_read.  But now I have a case
where,
> from the debug output, it seems that the SSL_read reads all available data,
but
> only returns the 8k requested.  As a result when we return to wait, there is
no
> read event to trigger any further calls to SSL_read, as all the data has
already
> been read.

Use SSL_pending() to see, whether there are still data available inside
the SSL and/or underlying BIO. Only try to select() on the read (write) event
if the call to SSL_read()/SSL_get_error() returns the WANT_READ or WANT_WRITE
condition.

Best regards,
     Lutz
--
Lutz Jaenicke                             [EMAIL PROTECTED]
BTU Cottbus               http://www.aet.TU-Cottbus.DE/personen/jaenicke/
Lehrstuhl Allgemeine Elektrotechnik                  Tel. +49 355 69-4129
Universitaetsplatz 3-4, D-03044 Cottbus              Fax. +49 355 69-4153
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]






______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to