#include
SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, long length); int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp);
_i_2_d___S_S_L___S_E_S_S_I_O_N_(_) transforms the SSL_SESSION object iinn into the ASN1 representation and stores it into the memory location pointed to by pppp. The length of the resulting ASN1 representation is returned. If pppp is the NULL pointer, only the length is calculated and returned.
When using _d_2_i___S_S_L___S_E_S_S_I_O_N_(_), the SSL_SESSION object is automatically allocated. The reference count is 1, so that the session must be explicitly removed using _S_S_L___S_E_S_S_I_O_N___f_r_e_e(3), unless the SSL_SESSION object is completely taken over, when being called inside the _g_e_t___s_e_s_s_i_o_n___c_b_(_) (see _S_S_L___C_T_X___s_e_s_s___s_e_t___g_e_t___c_b(3)).
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).
When using _i_2_d___S_S_L___S_E_S_S_I_O_N_(_), the memory location pointed to by pppp must be large enough to hold the binary representation of the session. There is no known limit on the size of the created ASN1 representation, so the necessary amount of space should be obtained by first calling _i_2_d___S_S_L___S_E_S_S_I_O_N_(_) with pppp==NNUULLLL, and obtain the size needed, then allocate the memory and call _i_2_d___S_S_L___S_E_S_S_I_O_N_(_) again.
_i_2_d___S_S_L___S_E_S_S_I_O_N_(_) returns the size of the ASN1 representation in bytes. When the session is not valid, 00 is returned and no operation is performed.