1SSL_SET_BIO(3) OpenSSL SSL_SET_BIO(3)
2
3
4
6 SSL_set_bio, SSL_set0_rbio, SSL_set0_wbio - connect the SSL object with
7 a BIO
8
10 #include <openssl/ssl.h>
11
12 void SSL_set_bio(SSL *ssl, BIO *rbio, BIO *wbio);
13 void SSL_set0_rbio(SSL *s, BIO *rbio);
14 void SSL_set0_wbio(SSL *s, BIO *wbio);
15
17 SSL_set0_rbio() connects the BIO rbio for the read operations of the
18 ssl object. The SSL engine inherits the behaviour of rbio. If the BIO
19 is nonblocking then the ssl object will also have nonblocking
20 behaviour. This function transfers ownership of rbio to ssl. It will be
21 automatically freed using BIO_free_all(3) when the ssl is freed. On
22 calling this function, any existing rbio that was previously set will
23 also be freed via a call to BIO_free_all(3) (this includes the case
24 where the rbio is set to the same value as previously).
25
26 SSL_set0_wbio() works in the same as SSL_set0_rbio() except that it
27 connects the BIO wbio for the write operations of the ssl object. Note
28 that if the rbio and wbio are the same then SSL_set0_rbio() and
29 SSL_set0_wbio() each take ownership of one reference. Therefore, it may
30 be necessary to increment the number of references available using
31 BIO_up_ref(3) before calling the set0 functions.
32
33 SSL_set_bio() is similar to SSL_set0_rbio() and SSL_set0_wbio() except
34 that it connects both the rbio and the wbio at the same time, and
35 transfers the ownership of rbio and wbio to ssl according to the
36 following set of rules:
37
38 • If neither the rbio or wbio have changed from their previous values
39 then nothing is done.
40
41 • If the rbio and wbio parameters are different and both are different
42 to their previously set values then one reference is consumed for the
43 rbio and one reference is consumed for the wbio.
44
45 • If the rbio and wbio parameters are the same and the rbio is not the
46 same as the previously set value then one reference is consumed.
47
48 • If the rbio and wbio parameters are the same and the rbio is the same
49 as the previously set value, then no additional references are
50 consumed.
51
52 • If the rbio and wbio parameters are different and the rbio is the
53 same as the previously set value then one reference is consumed for
54 the wbio and no references are consumed for the rbio.
55
56 • If the rbio and wbio parameters are different and the wbio is the
57 same as the previously set value and the old rbio and wbio values
58 were the same as each other then one reference is consumed for the
59 rbio and no references are consumed for the wbio.
60
61 • If the rbio and wbio parameters are different and the wbio is the
62 same as the previously set value and the old rbio and wbio values
63 were different to each other then one reference is consumed for the
64 rbio and one reference is consumed for the wbio.
65
66 Because of this complexity, this function should be avoided; use
67 SSL_set0_rbio() and SSL_set0_wbio() instead.
68
70 SSL_set_bio(), SSL_set0_rbio() and SSL_set0_wbio() cannot fail.
71
73 SSL_get_rbio(3), SSL_connect(3), SSL_accept(3), SSL_shutdown(3),
74 ssl(7), bio(7)
75
77 SSL_set0_rbio() and SSL_set0_wbio() were added in OpenSSL 1.1.0.
78
80 Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
81
82 Licensed under the OpenSSL license (the "License"). You may not use
83 this file except in compliance with the License. You can obtain a copy
84 in the file LICENSE in the source distribution or at
85 <https://www.openssl.org/source/license.html>.
86
87
88
891.1.1i 2021-01-26 SSL_SET_BIO(3)