]>
Commit | Line | Data |
---|---|---|
cc99526d RL |
1 | =pod |
2 | ||
3 | =head1 NAME | |
4 | ||
e040a42e | 5 | SSL_set_bio, SSL_set0_rbio, SSL_set0_wbio - connect the SSL object with a BIO |
cc99526d RL |
6 | |
7 | =head1 SYNOPSIS | |
8 | ||
9 | #include <openssl/ssl.h> | |
10 | ||
11 | void SSL_set_bio(SSL *ssl, BIO *rbio, BIO *wbio); | |
e040a42e MC |
12 | void SSL_set0_rbio(SSL *s, BIO *rbio); |
13 | void SSL_set0_wbio(SSL *s, BIO *wbio); | |
cc99526d RL |
14 | |
15 | =head1 DESCRIPTION | |
16 | ||
e040a42e MC |
17 | SSL_set0_rbio() connects the BIO B<rbio> for the read operations of the B<ssl> |
18 | object. The SSL engine inherits the behaviour of B<rbio>. If the BIO is | |
19 | non-blocking then the B<ssl> object will also have non-blocking behaviour. This | |
20 | function transfers ownership of B<rbio> to B<ssl>. It will be automatically | |
21 | freed using L<BIO_free_all(3)> when the B<ssl> is freed. On calling this | |
22 | function, any existing B<rbio> that was previously set will also be freed via a | |
23 | call to L<BIO_free_all(3)> (this includes the case where the B<rbio> is set to | |
24 | the same value as previously). | |
cc99526d | 25 | |
e040a42e MC |
26 | SSL_set0_wbio() works in the same as SSL_set0_rbio() except that it connects |
27 | the BIO B<wbio> for the write operations of the B<ssl> object. Note that if the | |
28 | rbio and wbio are the same then SSL_set0_rbio() and SSL_set0_wbio() each take | |
29 | ownership of one reference. Therefore it may be necessary to increment the | |
30 | number of references available using L<BIO_up_ref(3)> before calling the set0 | |
31 | functions. | |
cc99526d | 32 | |
a95d7574 RS |
33 | SSL_set_bio() is similar to SSL_set0_rbio() and SSL_set0_wbio() except |
34 | that it connects both the B<rbio> and the B<wbio> at the same time, and | |
35 | transfers the ownership of B<rbio> and B<wbio> to B<ssl> according to | |
36 | the following set of rules: | |
cc99526d | 37 | |
2f61bc2e | 38 | =over 2 |
e040a42e | 39 | |
3dfda1a6 | 40 | =item * |
e040a42e | 41 | |
a95d7574 RS |
42 | If neither the B<rbio> or B<wbio> have changed from their previous values |
43 | then nothing is done. | |
e040a42e | 44 | |
3dfda1a6 | 45 | =item * |
e040a42e | 46 | |
a95d7574 RS |
47 | If the B<rbio> and B<wbio> parameters are different and both are different |
48 | to their | |
e040a42e MC |
49 | previously set values then one reference is consumed for the rbio and one |
50 | reference is consumed for the wbio. | |
51 | ||
3dfda1a6 | 52 | =item * |
e040a42e | 53 | |
a95d7574 RS |
54 | If the B<rbio> and B<wbio> parameters are the same and the B<rbio> is not |
55 | the same as the previously set value then one reference is consumed. | |
e040a42e | 56 | |
3dfda1a6 | 57 | =item * |
e040a42e | 58 | |
a95d7574 RS |
59 | If the B<rbio> and B<wbio> parameters are the same and the B<rbio> is the |
60 | same as the previously set value, then no additional references are consumed. | |
e040a42e | 61 | |
3dfda1a6 | 62 | =item * |
e040a42e | 63 | |
a95d7574 RS |
64 | If the B<rbio> and B<wbio> parameters are different and the B<rbio> is the |
65 | same as the | |
66 | previously set value then one reference is consumed for the B<wbio> and no | |
67 | references are consumed for the B<rbio>. | |
e040a42e | 68 | |
3dfda1a6 | 69 | =item * |
e040a42e | 70 | |
a95d7574 RS |
71 | If the B<rbio> and B<wbio> parameters are different and the B<wbio> is the |
72 | same as the previously set value and the old B<rbio> and B<wbio> values | |
73 | were the same as each other then one reference is consumed for the B<rbio> | |
74 | and no references are consumed for the B<wbio>. | |
e040a42e | 75 | |
3dfda1a6 | 76 | =item * |
e040a42e | 77 | |
a95d7574 RS |
78 | If the B<rbio> and B<wbio> parameters are different and the B<wbio> |
79 | is the same as the | |
80 | previously set value and the old B<rbio> and B<wbio> values were different | |
81 | to each | |
82 | other then one reference is consumed for the B<rbio> and one reference | |
83 | is consumed | |
84 | for the B<wbio>. | |
e040a42e MC |
85 | |
86 | =back | |
3ffbe008 | 87 | |
a95d7574 RS |
88 | Because of this complexity, this function should be avoided; |
89 | use SSL_set0_rbio() and SSL_set0_wbio() instead. | |
90 | ||
cc99526d RL |
91 | =head1 RETURN VALUES |
92 | ||
5224df0d | 93 | SSL_set_bio(), SSL_set0_rbio() and SSL_set0_wbio() cannot fail. |
cc99526d RL |
94 | |
95 | =head1 SEE ALSO | |
96 | ||
9e183d22 | 97 | L<SSL_get_rbio(3)>, |
9b86974e | 98 | L<SSL_connect(3)>, L<SSL_accept(3)>, |
b97fdb57 | 99 | L<SSL_shutdown(3)>, L<ssl(7)>, L<bio(7)> |
cc99526d | 100 | |
3ffbe008 MC |
101 | =head1 HISTORY |
102 | ||
e040a42e | 103 | SSL_set0_rbio() and SSL_set0_wbio() were added in OpenSSL 1.1.0. |
3ffbe008 | 104 | |
e2f92610 RS |
105 | =head1 COPYRIGHT |
106 | ||
5224df0d | 107 | Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved. |
e2f92610 RS |
108 | |
109 | Licensed under the OpenSSL license (the "License"). You may not use | |
110 | this file except in compliance with the License. You can obtain a copy | |
111 | in the file LICENSE in the source distribution or at | |
112 | L<https://www.openssl.org/source/license.html>. | |
113 | ||
114 | =cut |