1*4724848cSchristos=pod 2*4724848cSchristos 3*4724848cSchristos=head1 NAME 4*4724848cSchristos 5*4724848cSchristosSSL_set_session - set a TLS/SSL session to be used during TLS/SSL connect 6*4724848cSchristos 7*4724848cSchristos=head1 SYNOPSIS 8*4724848cSchristos 9*4724848cSchristos #include <openssl/ssl.h> 10*4724848cSchristos 11*4724848cSchristos int SSL_set_session(SSL *ssl, SSL_SESSION *session); 12*4724848cSchristos 13*4724848cSchristos=head1 DESCRIPTION 14*4724848cSchristos 15*4724848cSchristosSSL_set_session() sets B<session> to be used when the TLS/SSL connection 16*4724848cSchristosis to be established. SSL_set_session() is only useful for TLS/SSL clients. 17*4724848cSchristosWhen the session is set, the reference count of B<session> is incremented 18*4724848cSchristosby 1. If the session is not reused, the reference count is decremented 19*4724848cSchristosagain during SSL_connect(). Whether the session was reused can be queried 20*4724848cSchristoswith the L<SSL_session_reused(3)> call. 21*4724848cSchristos 22*4724848cSchristosIf there is already a session set inside B<ssl> (because it was set with 23*4724848cSchristosSSL_set_session() before or because the same B<ssl> was already used for 24*4724848cSchristosa connection), SSL_SESSION_free() will be called for that session. If that old 25*4724848cSchristossession is still B<open>, it is considered bad and will be removed from the 26*4724848cSchristossession cache (if used). A session is considered open, if L<SSL_shutdown(3)> was 27*4724848cSchristosnot called for the connection (or at least L<SSL_set_shutdown(3)> was used to 28*4724848cSchristosset the SSL_SENT_SHUTDOWN state). 29*4724848cSchristos 30*4724848cSchristos=head1 NOTES 31*4724848cSchristos 32*4724848cSchristosSSL_SESSION objects keep internal link information about the session cache 33*4724848cSchristoslist, when being inserted into one SSL_CTX object's session cache. 34*4724848cSchristosOne SSL_SESSION object, regardless of its reference count, must therefore 35*4724848cSchristosonly be used with one SSL_CTX object (and the SSL objects created 36*4724848cSchristosfrom this SSL_CTX object). 37*4724848cSchristos 38*4724848cSchristos=head1 RETURN VALUES 39*4724848cSchristos 40*4724848cSchristosThe following return values can occur: 41*4724848cSchristos 42*4724848cSchristos=over 4 43*4724848cSchristos 44*4724848cSchristos=item Z<>0 45*4724848cSchristos 46*4724848cSchristosThe operation failed; check the error stack to find out the reason. 47*4724848cSchristos 48*4724848cSchristos=item Z<>1 49*4724848cSchristos 50*4724848cSchristosThe operation succeeded. 51*4724848cSchristos 52*4724848cSchristos=back 53*4724848cSchristos 54*4724848cSchristos=head1 SEE ALSO 55*4724848cSchristos 56*4724848cSchristosL<ssl(7)>, L<SSL_SESSION_free(3)>, 57*4724848cSchristosL<SSL_get_session(3)>, 58*4724848cSchristosL<SSL_session_reused(3)>, 59*4724848cSchristosL<SSL_CTX_set_session_cache_mode(3)> 60*4724848cSchristos 61*4724848cSchristos=head1 COPYRIGHT 62*4724848cSchristos 63*4724848cSchristosCopyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved. 64*4724848cSchristos 65*4724848cSchristosLicensed under the OpenSSL license (the "License"). You may not use 66*4724848cSchristosthis file except in compliance with the License. You can obtain a copy 67*4724848cSchristosin the file LICENSE in the source distribution or at 68*4724848cSchristosL<https://www.openssl.org/source/license.html>. 69*4724848cSchristos 70*4724848cSchristos=cut 71