SSL_get_session(3) OpenSSL SSL_get_session(3) NNAAMMEE SSL_get_session - retrieve TLS/SSL session data SSYYNNOOPPSSIISS #include SSL_SESSION *SSL_get_session(const SSL *ssl); SSL_SESSION *SSL_get0_session(const SSL *ssl); SSL_SESSION *SSL_get1_session(SSL *ssl); DDEESSCCRRIIPPTTIIOONN _S_S_L___g_e_t___s_e_s_s_i_o_n_(_) returns a pointer to the SSSSLL__SSEESSSSIIOONN actually used in ssssll. The reference count of the SSSSLL__SSEESSSSIIOONN is not incremented, so that the pointer can become invalid by other operations. _S_S_L___g_e_t_0___s_e_s_s_i_o_n_(_) is the same as _S_S_L___g_e_t___s_e_s_s_i_o_n_(_). _S_S_L___g_e_t_1___s_e_s_s_i_o_n_(_) is the same as _S_S_L___g_e_t___s_e_s_s_i_o_n_(_), but the reference count of the SSSSLL__SSEESSSSIIOONN is incremented by one. NNOOTTEESS The ssl session contains all information required to re-establish the connection without a new handshake. A session will be automatically removed from the session cache and marked as non-resumable if the connection is not closed down cleanly, e.g. if a fatal error occurs on the connection or _S_S_L___s_h_u_t_d_o_w_n(3) is not called prior to _S_S_L___f_r_e_e(3). _S_S_L___g_e_t_0___s_e_s_s_i_o_n_(_) returns a pointer to the actual session. As the ref- erence counter is not incremented, the pointer is only valid while the connection is in use. If _S_S_L___c_l_e_a_r(3) or _S_S_L___f_r_e_e(3) is called, the session may be removed completely (if considered bad), and the pointer obtained will become invalid. Even if the session is valid, it can be removed at any time due to timeout during _S_S_L___C_T_X___f_l_u_s_h___s_e_s_s_i_o_n_s(3). If the data is to be kept, _S_S_L___g_e_t_1___s_e_s_s_i_o_n_(_) will increment the refer- ence count, so that the session will not be implicitly removed by other operations but stays in memory. In order to remove the session _S_S_L___S_E_S_- _S_I_O_N___f_r_e_e(3) must be explicitly called once to decrement the reference count again. SSL_SESSION objects keep internal link information about the session cache list, when being inserted into one SSL_CTX object's session cache. One SSL_SESSION object, regardless of its reference count, must therefore only be used with one SSL_CTX object (and the SSL objects created from this SSL_CTX object). RREETTUURRNN VVAALLUUEESS The following return values can occur: NULL There is no session available in ssssll. Pointer to an SSL The return value points to the data of an SSL session. SSEEEE AALLSSOO _s_s_l(3), _S_S_L___f_r_e_e(3), _S_S_L___c_l_e_a_r(3), _S_S_L___S_E_S_S_I_O_N___f_r_e_e(3) 1.0.2u 2019-12-20 SSL_get_session(3)