Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

handling SSL_ERROR_ZERO_RETURN from SSL_read

1,970 views
Skip to first unread message

Amit Ben Shahar

unread,
Jul 13, 2010, 10:50:17 AM7/13/10
to
Hi,

The documentation specifies that SSL_ERROR_ZERO_RETURN is returned if
the transport layer is closed normally.
My question is, how should i handle this return code?
specifically should i call SSL_free normally to free resources, or are
resources already freed?

Thanks,

Amit Ben Shahar
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openss...@openssl.org
Automated List Manager majo...@openssl.org

David Schwartz

unread,
Jul 13, 2010, 5:08:40 PM7/13/10
to

Amit Ben Shahar wrote:

> Hi,
>
> The documentation specifies that SSL_ERROR_ZERO_RETURN is returned if
> the transport layer is closed normally.
> My question is, how should i handle this return code?
> specifically should i call SSL_free normally to free resources, or are
> resources already freed?

Handle it the same way you would handle 'read' returning zero. Resources
cannot already be freed because if they were, a subsequent call to, say,
SSL_write would cause the program to crash.

DS

Darryl Miles

unread,
Jul 14, 2010, 9:08:18 AM7/14/10
to
Amit Ben Shahar wrote:
> The documentation specifies that SSL_ERROR_ZERO_RETURN is returned if
> the transport layer is closed normally.
> My question is, how should i handle this return code?
> specifically should i call SSL_free normally to free resources, or are
> resources already freed?

Yes you need to call SSL_free() to release the (SSL *) handle.


You may need to free/release other OpenSSL objects you created that were
also used in relation to the (SSL *) handle.

Unfortunately things get a big vague as man page documentation often
doesn't clearly indicate which API calls transfer ownership (and
therefore responsibly to release/free) to the callee from the caller
(usually your application code).


Darryl

Amit Ben Shahar

unread,
Jul 14, 2010, 10:26:31 AM7/14/10
to
Assuming i'm only using SSL_set_bio to assign a BIO to the SSL object
(all other calls are read/write), will the SSL_free suffice?

Amit

0 new messages