#include
int SSL_write(SSL *ssl, const void *buf, int num);
For the transparent negotiation to succeed, the ssssll must have been initialized to client or server mode. This is being done by calling _S_S_L___s_e_t___c_o_n_n_e_c_t___s_t_a_t_e(3) or _S_S_L___s_e_t___a_c_c_e_p_t___s_t_a_t_e_(_) before the first call to an _S_S_L___r_e_a_d(3) or _S_S_L___w_r_i_t_e_(_) function.
If the underlying BIO is bblloocckkiinngg, _S_S_L___w_r_i_t_e_(_) will only return, once the write operation has been finished or an error occurred, except when a renegotiation take place, in which case a SSL_ERROR_WANT_READ may occur. This behaviour can be controlled with the SSL_MODE_AUTO_RETRY flag of the _S_S_L___C_T_X___s_e_t___m_o_d_e(3) call.
If the underlying BIO is nnoonn--bblloocckkiinngg, _S_S_L___w_r_i_t_e_(_) will also return, when the underlying BIO could not satisfy the needs of _S_S_L___w_r_i_t_e_(_) to continue the operation. In this case a call to _S_S_L___g_e_t___e_r_r_o_r(3) with the return value of _S_S_L___w_r_i_t_e_(_) will yield SSSSLL__EERRRROORR__WWAANNTT__RREEAADD or SSSSLL__EERRRROORR__WWAANNTT__WWRRIITTEE. As at any time a re-negotiation is possible, a call to _S_S_L___w_r_i_t_e_(_) can also cause read operations! The calling process then must repeat the call after taking appropriate action to satisfy the needs of _S_S_L___w_r_i_t_e_(_). 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.
_S_S_L___w_r_i_t_e_(_) will only return with success, when the complete contents of bbuuff of length nnuumm has been written. This default behaviour can be changed with the SSL_MODE_ENABLE_PARTIAL_WRITE option of _S_S_L___C_T_X___s_e_t___m_o_d_e(3). When this flag is set, _S_S_L___w_r_i_t_e_(_) will also return with success, when a partial write has been successfully completed. In this case the _S_S_L___w_r_i_t_e_(_) operation is considered completed. The bytes are sent and a new _S_S_L___w_r_i_t_e_(_) operation with a new buffer (with the already sent bytes removed) must be started. A partial write is performed with the size of a message block, which is 16kB for SSLv3/TLSv1.
When calling _S_S_L___w_r_i_t_e_(_) with num=0 bytes to be sent the behaviour is undefined.