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