2000-09-14 21:11:56 +08:00
|
|
|
=pod
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
2016-07-22 18:55:10 +08:00
|
|
|
SSL_set_bio, SSL_set0_rbio, SSL_set0_wbio - connect the SSL object with a BIO
|
2000-09-14 21:11:56 +08:00
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
|
|
|
|
#include <openssl/ssl.h>
|
|
|
|
|
|
|
|
void SSL_set_bio(SSL *ssl, BIO *rbio, BIO *wbio);
|
2016-07-22 18:55:10 +08:00
|
|
|
void SSL_set0_rbio(SSL *s, BIO *rbio);
|
|
|
|
void SSL_set0_wbio(SSL *s, BIO *wbio);
|
2000-09-14 21:11:56 +08:00
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
|
2016-07-22 18:55:10 +08:00
|
|
|
SSL_set0_rbio() connects the BIO B<rbio> for the read operations of the B<ssl>
|
|
|
|
object. The SSL engine inherits the behaviour of B<rbio>. If the BIO is
|
2020-07-17 18:31:26 +08:00
|
|
|
nonblocking then the B<ssl> object will also have nonblocking behaviour. This
|
2016-07-22 18:55:10 +08:00
|
|
|
function transfers ownership of B<rbio> to B<ssl>. It will be automatically
|
|
|
|
freed using L<BIO_free_all(3)> when the B<ssl> is freed. On calling this
|
|
|
|
function, any existing B<rbio> that was previously set will also be freed via a
|
|
|
|
call to L<BIO_free_all(3)> (this includes the case where the B<rbio> is set to
|
|
|
|
the same value as previously).
|
2000-09-14 21:11:56 +08:00
|
|
|
|
2016-07-22 18:55:10 +08:00
|
|
|
SSL_set0_wbio() works in the same as SSL_set0_rbio() except that it connects
|
|
|
|
the BIO B<wbio> for the write operations of the B<ssl> object. Note that if the
|
|
|
|
rbio and wbio are the same then SSL_set0_rbio() and SSL_set0_wbio() each take
|
2020-06-30 03:13:07 +08:00
|
|
|
ownership of one reference. Therefore, it may be necessary to increment the
|
2016-07-22 18:55:10 +08:00
|
|
|
number of references available using L<BIO_up_ref(3)> before calling the set0
|
|
|
|
functions.
|
2000-09-14 21:11:56 +08:00
|
|
|
|
2017-07-03 00:16:38 +08:00
|
|
|
SSL_set_bio() is similar to SSL_set0_rbio() and SSL_set0_wbio() except
|
|
|
|
that it connects both the B<rbio> and the B<wbio> at the same time, and
|
|
|
|
transfers the ownership of B<rbio> and B<wbio> to B<ssl> according to
|
|
|
|
the following set of rules:
|
2000-09-14 21:11:56 +08:00
|
|
|
|
2017-04-08 01:37:47 +08:00
|
|
|
=over 2
|
2016-07-22 18:55:10 +08:00
|
|
|
|
2016-12-13 00:14:40 +08:00
|
|
|
=item *
|
2016-07-22 18:55:10 +08:00
|
|
|
|
2017-07-03 00:16:38 +08:00
|
|
|
If neither the B<rbio> or B<wbio> have changed from their previous values
|
|
|
|
then nothing is done.
|
2016-07-22 18:55:10 +08:00
|
|
|
|
2016-12-13 00:14:40 +08:00
|
|
|
=item *
|
2016-07-22 18:55:10 +08:00
|
|
|
|
2017-07-03 00:16:38 +08:00
|
|
|
If the B<rbio> and B<wbio> parameters are different and both are different
|
|
|
|
to their
|
2016-07-22 18:55:10 +08:00
|
|
|
previously set values then one reference is consumed for the rbio and one
|
|
|
|
reference is consumed for the wbio.
|
|
|
|
|
2016-12-13 00:14:40 +08:00
|
|
|
=item *
|
2016-07-22 18:55:10 +08:00
|
|
|
|
2017-07-03 00:16:38 +08:00
|
|
|
If the B<rbio> and B<wbio> parameters are the same and the B<rbio> is not
|
|
|
|
the same as the previously set value then one reference is consumed.
|
2016-07-22 18:55:10 +08:00
|
|
|
|
2016-12-13 00:14:40 +08:00
|
|
|
=item *
|
2016-07-22 18:55:10 +08:00
|
|
|
|
2017-07-03 00:16:38 +08:00
|
|
|
If the B<rbio> and B<wbio> parameters are the same and the B<rbio> is the
|
|
|
|
same as the previously set value, then no additional references are consumed.
|
2016-07-22 18:55:10 +08:00
|
|
|
|
2016-12-13 00:14:40 +08:00
|
|
|
=item *
|
2016-07-22 18:55:10 +08:00
|
|
|
|
2017-07-03 00:16:38 +08:00
|
|
|
If the B<rbio> and B<wbio> parameters are different and the B<rbio> is the
|
|
|
|
same as the
|
|
|
|
previously set value then one reference is consumed for the B<wbio> and no
|
|
|
|
references are consumed for the B<rbio>.
|
2016-07-22 18:55:10 +08:00
|
|
|
|
2016-12-13 00:14:40 +08:00
|
|
|
=item *
|
2016-07-22 18:55:10 +08:00
|
|
|
|
2017-07-03 00:16:38 +08:00
|
|
|
If the B<rbio> and B<wbio> parameters are different and the B<wbio> is the
|
|
|
|
same as the previously set value and the old B<rbio> and B<wbio> values
|
|
|
|
were the same as each other then one reference is consumed for the B<rbio>
|
|
|
|
and no references are consumed for the B<wbio>.
|
2016-07-22 18:55:10 +08:00
|
|
|
|
2016-12-13 00:14:40 +08:00
|
|
|
=item *
|
2016-07-22 18:55:10 +08:00
|
|
|
|
2017-07-03 00:16:38 +08:00
|
|
|
If the B<rbio> and B<wbio> parameters are different and the B<wbio>
|
|
|
|
is the same as the
|
|
|
|
previously set value and the old B<rbio> and B<wbio> values were different
|
2021-09-21 08:59:56 +08:00
|
|
|
to each other, then one reference is consumed for the B<rbio> and one
|
2020-06-30 03:13:07 +08:00
|
|
|
reference is consumed for the B<wbio>.
|
2016-07-22 18:55:10 +08:00
|
|
|
|
|
|
|
=back
|
2015-02-07 08:08:59 +08:00
|
|
|
|
2017-07-03 00:16:38 +08:00
|
|
|
Because of this complexity, this function should be avoided;
|
|
|
|
use SSL_set0_rbio() and SSL_set0_wbio() instead.
|
|
|
|
|
2023-01-09 19:31:07 +08:00
|
|
|
Where a new BIO is set on a QUIC connection SSL object, blocking mode will be
|
|
|
|
disabled on that SSL object if the BIO cannot support blocking mode. If another
|
|
|
|
BIO is subsequently set on the SSL object which can support blocking mode,
|
|
|
|
blocking mode will not be automatically re-enabled. For more information, see
|
|
|
|
L<SSL_set_blocking_mode(3)>.
|
|
|
|
|
2000-09-14 21:11:56 +08:00
|
|
|
=head1 RETURN VALUES
|
|
|
|
|
2018-08-23 10:12:05 +08:00
|
|
|
SSL_set_bio(), SSL_set0_rbio() and SSL_set0_wbio() cannot fail.
|
2000-09-14 21:11:56 +08:00
|
|
|
|
|
|
|
=head1 SEE ALSO
|
|
|
|
|
2017-03-11 21:56:44 +08:00
|
|
|
L<SSL_get_rbio(3)>,
|
2015-08-18 03:21:33 +08:00
|
|
|
L<SSL_connect(3)>, L<SSL_accept(3)>,
|
2016-11-11 16:33:09 +08:00
|
|
|
L<SSL_shutdown(3)>, L<ssl(7)>, L<bio(7)>
|
2000-09-14 21:11:56 +08:00
|
|
|
|
2015-02-07 08:08:59 +08:00
|
|
|
=head1 HISTORY
|
|
|
|
|
2016-07-22 18:55:10 +08:00
|
|
|
SSL_set0_rbio() and SSL_set0_wbio() were added in OpenSSL 1.1.0.
|
2015-02-07 08:08:59 +08:00
|
|
|
|
2016-05-18 23:44:05 +08:00
|
|
|
=head1 COPYRIGHT
|
|
|
|
|
2020-07-16 20:47:04 +08:00
|
|
|
Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
|
2016-05-18 23:44:05 +08:00
|
|
|
|
2018-12-06 21:04:44 +08:00
|
|
|
Licensed under the Apache License 2.0 (the "License"). You may not use
|
2016-05-18 23:44:05 +08:00
|
|
|
this file except in compliance with the License. You can obtain a copy
|
|
|
|
in the file LICENSE in the source distribution or at
|
|
|
|
L<https://www.openssl.org/source/license.html>.
|
|
|
|
|
|
|
|
=cut
|