SSL_connect 3 2003-11-04 0.9.9-dev OpenSSL

NAME

SSL_connect - initiate the TLS/SSL handshake with an TLS/SSL server

LIBRARY

libcrypto, -lcrypto

SYNOPSIS


 #include 


 int SSL_connect(SSL *ssl);

DESCRIPTION

_S_S_L___c_o_n_n_e_c_t_(_) initiates the TLS/SSL handshake with a server. The communication channel must already have been set and assigned to the ssssll by setting an underlying BBIIOO.

NOTES

The behaviour of _S_S_L___c_o_n_n_e_c_t_(_) depends on the underlying BIO.

If the underlying BIO is bblloocckkiinngg, _S_S_L___c_o_n_n_e_c_t_(_) will only return once the handshake has been finished or an error occurred.

If the underlying BIO is nnoonn--bblloocckkiinngg, _S_S_L___c_o_n_n_e_c_t_(_) will also return when the underlying BIO could not satisfy the needs of _S_S_L___c_o_n_n_e_c_t_(_) to continue the handshake, indicating the problem by the return value -1. In this case a call to _S_S_L___g_e_t___e_r_r_o_r_(_) with the return value of _S_S_L___c_o_n_n_e_c_t_(_) will yield SSSSLL__EERRRROORR__WWAANNTT__RREEAADD or SSSSLL__EERRRROORR__WWAANNTT__WWRRIITTEE. The calling process then must repeat the call after taking appropriate action to satisfy the needs of _S_S_L___c_o_n_n_e_c_t_(_). The action depends on the underlying BIO. When using a non-blocking socket, nothing is to be done, but _s_e_l_e_c_t_(_) can be used to check for the required condition. When using a buffering BIO, like a BIO pair, data must be written into or retrieved out of the BIO before being able to continue.

RETURN VALUES

The following return values can occur:
1 The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been
established.
0 The TLS/SSL handshake was not successful but was shut down controlled and
by the specifications of the TLS/SSL protocol. Call _S_S_L___g_e_t___e_r_r_o_r_(_) with the return value rreett to find out the reason.
<0 The TLS/SSL handshake was not successful, because a fatal error occurred either
at the protocol level or a connection failure occurred. The shutdown was not clean. It can also occur of action is need to continue the operation for non-blocking BIOs. Call _S_S_L___g_e_t___e_r_r_o_r_(_) with the return value rreett to find out the reason.

SEE ALSO

_S_S_L___g_e_t___e_r_r_o_r(3), _S_S_L___a_c_c_e_p_t(3), _S_S_L___s_h_u_t_d_o_w_n(3), _s_s_l(3), _o_p_e_n_s_s_l___b_i_o(3), _S_S_L___s_e_t___c_o_n_n_e_c_t___s_t_a_t_e(3), _S_S_L___d_o___h_a_n_d_s_h_a_k_e(3), _S_S_L___C_T_X___n_e_w(3)