xref: /onnv-gate/usr/src/common/openssl/doc/ssl/SSL_set_session.pod (revision 2175:b0b2f052a486)
1*2175Sjp161948=pod
2*2175Sjp161948
3*2175Sjp161948=head1 NAME
4*2175Sjp161948
5*2175Sjp161948SSL_set_session - set a TLS/SSL session to be used during TLS/SSL connect
6*2175Sjp161948
7*2175Sjp161948=head1 SYNOPSIS
8*2175Sjp161948
9*2175Sjp161948 #include <openssl/ssl.h>
10*2175Sjp161948
11*2175Sjp161948 int SSL_set_session(SSL *ssl, SSL_SESSION *session);
12*2175Sjp161948
13*2175Sjp161948=head1 DESCRIPTION
14*2175Sjp161948
15*2175Sjp161948SSL_set_session() sets B<session> to be used when the TLS/SSL connection
16*2175Sjp161948is to be established. SSL_set_session() is only useful for TLS/SSL clients.
17*2175Sjp161948When the session is set, the reference count of B<session> is incremented
18*2175Sjp161948by 1. If the session is not reused, the reference count is decremented
19*2175Sjp161948again during SSL_connect(). Whether the session was reused can be queried
20*2175Sjp161948with the L<SSL_session_reused(3)|SSL_session_reused(3)> call.
21*2175Sjp161948
22*2175Sjp161948If there is already a session set inside B<ssl> (because it was set with
23*2175Sjp161948SSL_set_session() before or because the same B<ssl> was already used for
24*2175Sjp161948a connection), SSL_SESSION_free() will be called for that session.
25*2175Sjp161948
26*2175Sjp161948=head1 NOTES
27*2175Sjp161948
28*2175Sjp161948SSL_SESSION objects keep internal link information about the session cache
29*2175Sjp161948list, when being inserted into one SSL_CTX object's session cache.
30*2175Sjp161948One SSL_SESSION object, regardless of its reference count, must therefore
31*2175Sjp161948only be used with one SSL_CTX object (and the SSL objects created
32*2175Sjp161948from this SSL_CTX object).
33*2175Sjp161948
34*2175Sjp161948=head1 RETURN VALUES
35*2175Sjp161948
36*2175Sjp161948The following return values can occur:
37*2175Sjp161948
38*2175Sjp161948=over 4
39*2175Sjp161948
40*2175Sjp161948=item 0
41*2175Sjp161948
42*2175Sjp161948The operation failed; check the error stack to find out the reason.
43*2175Sjp161948
44*2175Sjp161948=item 1
45*2175Sjp161948
46*2175Sjp161948The operation succeeded.
47*2175Sjp161948
48*2175Sjp161948=back
49*2175Sjp161948
50*2175Sjp161948=head1 SEE ALSO
51*2175Sjp161948
52*2175Sjp161948L<ssl(3)|ssl(3)>, L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>,
53*2175Sjp161948L<SSL_get_session(3)|SSL_get_session(3)>,
54*2175Sjp161948L<SSL_session_reused(3)|SSL_session_reused(3)>,
55*2175Sjp161948L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>
56*2175Sjp161948
57*2175Sjp161948=cut
58