SSL_shutdown.pod revision 79998
168651Skris=pod 268651Skris 368651Skris=head1 NAME 468651Skris 568651SkrisSSL_shutdown - shut down a TLS/SSL connection 668651Skris 768651Skris=head1 SYNOPSIS 868651Skris 968651Skris #include <openssl/ssl.h> 1068651Skris 1168651Skris int SSL_shutdown(SSL *ssl); 1268651Skris 1368651Skris=head1 DESCRIPTION 1468651Skris 1576866SkrisSSL_shutdown() shuts down an active TLS/SSL connection. It sends the 1676866Skris"close notify" shutdown alert to the peer. 1768651Skris 1876866Skris=head1 NOTES 1976866Skris 2076866SkrisSSL_shutdown() tries to send the "close notify" shutdown alert to the peer. 2176866SkrisWhether the operation succeeds or not, the SSL_SENT_SHUTDOWN flag is set and 2276866Skrisa currently open session is considered closed and good and will be kept in the 2376866Skrissession cache for further reuse. 2476866Skris 2576866SkrisThe behaviour of SSL_shutdown() depends on the underlying BIO. 2676866Skris 2768651SkrisIf the underlying BIO is B<blocking>, SSL_shutdown() will only return once the 2868651Skrishandshake has been finished or an error occurred. 2968651Skris 3068651SkrisIf the underlying BIO is B<non-blocking>, SSL_shutdown() will also return 3168651Skriswhen the underlying BIO could not satisfy the needs of SSL_shutdown() 3268651Skristo continue the handshake. In this case a call to SSL_get_error() with the 3368651Skrisreturn value of SSL_shutdown() will yield B<SSL_ERROR_WANT_READ> or 3468651SkrisB<SSL_ERROR_WANT_WRITE>. The calling process then must repeat the call after 3568651Skristaking appropriate action to satisfy the needs of SSL_shutdown(). 3668651SkrisThe action depends on the underlying BIO. When using a non-blocking socket, 3768651Skrisnothing is to be done, but select() can be used to check for the required 3868651Skriscondition. When using a buffering BIO, like a BIO pair, data must be written 3968651Skrisinto or retrieved out of the BIO before being able to continue. 4068651Skris 4168651Skris=head1 RETURN VALUES 4268651Skris 4368651SkrisThe following return values can occur: 4468651Skris 4568651Skris=over 4 4668651Skris 4768651Skris=item 1 4868651Skris 4968651SkrisThe shutdown was successfully completed. 5068651Skris 5168651Skris=item 0 5268651Skris 5368651SkrisThe shutdown was not successful. Call SSL_get_error() with the return 5468651Skrisvalue B<ret> to find out the reason. 5568651Skris 5668651Skris=item -1 5768651Skris 5868651SkrisThe shutdown was not successful because a fatal error occurred either 5968651Skrisat the protocol level or a connection failure occurred. It can also occur of 6068651Skrisaction is need to continue the operation for non-blocking BIOs. 6168651SkrisCall SSL_get_error() with the return value B<ret> to find out the reason. 6268651Skris 6368651Skris=back 6468651Skris 6568651Skris=head1 SEE ALSO 6668651Skris 6768651SkrisL<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_connect(3)|SSL_connect(3)>, 6876866SkrisL<SSL_accept(3)|SSL_accept(3)>, L<SSL_set_shutdown(3)|SSL_set_shutdown(3)>, 6979998SkrisL<SSL_clear(3)|SSL_clear(3)>, L<SSL_free(3)|SSL_free(3)>, 7076866SkrisL<ssl(3)|ssl(3)>, L<bio(3)|bio(3)> 7168651Skris 7268651Skris=cut 73