SSL_connect.pod revision 68651
160484Sobrien=pod 2218822Sdim 3218822Sdim=head1 NAME 460484Sobrien 5218822SdimSSL_connect - initiate the TLS/SSL handshake with an TLS/SSL server 660484Sobrien 7218822Sdim=head1 SYNOPSIS 860484Sobrien 9218822Sdim #include <openssl/ssl.h> 10218822Sdim 11218822Sdim int SSL_connect(SSL *ssl); 12218822Sdim 1360484Sobrien=head1 DESCRIPTION 14218822Sdim 15218822SdimSSL_connect() initiates the TLS/SSL handshake with a server. The communication 16218822Sdimchannel must already have been set and assigned to the B<ssl> by setting an 17218822Sdimunderlying B<BIO>. 1860484Sobrien 19218822Sdim=head1 NOTES 20218822Sdim 21218822SdimThe behaviour of SSL_connect() depends on the underlying BIO. 2260484Sobrien 23218822SdimIf the underlying BIO is B<blocking>, SSL_connect() will only return once the 2460484Sobrienhandshake has been finished or an error occurred. 2560484Sobrien 2660484SobrienIf the underlying BIO is B<non-blocking>, SSL_connect() will also return 2760484Sobrienwhen the underlying BIO could not satisfy the needs of SSL_connect() 2860484Sobriento continue the handshake. In this case a call to SSL_get_error() with the 2960484Sobrienreturn value of SSL_connect() will yield B<SSL_ERROR_WANT_READ> or 3077298SobrienB<SSL_ERROR_WANT_WRITE>. The calling process then must repeat the call after 3160484Sobrientaking appropriate action to satisfy the needs of SSL_connect(). 32218822SdimThe action depends on the underlying BIO. When using a non-blocking socket, 33218822Sdimnothing is to be done, but select() can be used to check for the required 3477298Sobriencondition. When using a buffering BIO, like a BIO pair, data must be written 3560484Sobrieninto or retrieved out of the BIO before being able to continue. 3660484Sobrien 3777298Sobrien=head1 RETURN VALUES 3860484Sobrien 3960484SobrienThe following return values can occur: 4077298Sobrien 4177298Sobrien=over 4 4260484Sobrien 4360484Sobrien=item 1 4477298Sobrien 4560484SobrienThe TLS/SSL handshake was successfully completed, a TLS/SSL connection has been 4660484Sobrienestablished. 4777298Sobrien 4860484Sobrien=item 0 4960484Sobrien 5077298SobrienThe TLS/SSL handshake was not successful but was shut down controlled and 5160484Sobrienby the specifications of the TLS/SSL protocol. Call SSL_get_error() with the 5260484Sobrienreturn value B<ret> to find out the reason. 5377298Sobrien 5460484Sobrien=item -1 5560484Sobrien 5660484SobrienThe TLS/SSL handshake was not successful, because a fatal error occurred either 5777298Sobrienat the protocol level or a connection failure occurred. The shutdown was 5860484Sobriennot clean. It can also occur of action is need to continue the operation 59218822Sdimfor non-blocking BIOs. Call SSL_get_error() with the return value B<ret> 60218822Sdimto find out the reason. 6177298Sobrien 6260484Sobrien=back 6360484Sobrien 6477298Sobrien=head1 SEE ALSO 6560484Sobrien 6660484SobrienL<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_accept(3)|SSL_accept(3)>, 6777298SobrienL<SSL_shutdown(3)|SSL_shutdown(3)>, L<ssl(3)|ssl(3)> , L<bio(3)|bio(3)> 6860484Sobrien 6960484Sobrien=cut 7060484Sobrien