Blame doc/man3/SSL_set_bio.pod

Packit c4476c
=pod
Packit c4476c
Packit c4476c
=head1 NAME
Packit c4476c
Packit c4476c
SSL_set_bio, SSL_set0_rbio, SSL_set0_wbio - connect the SSL object with a BIO
Packit c4476c
Packit c4476c
=head1 SYNOPSIS
Packit c4476c
Packit c4476c
 #include <openssl/ssl.h>
Packit c4476c
Packit c4476c
 void SSL_set_bio(SSL *ssl, BIO *rbio, BIO *wbio);
Packit c4476c
 void SSL_set0_rbio(SSL *s, BIO *rbio);
Packit c4476c
 void SSL_set0_wbio(SSL *s, BIO *wbio);
Packit c4476c
Packit c4476c
=head1 DESCRIPTION
Packit c4476c
Packit c4476c
SSL_set0_rbio() connects the BIO B<rbio> for the read operations of the B<ssl>
Packit c4476c
object. The SSL engine inherits the behaviour of B<rbio>. If the BIO is
Packit c4476c
non-blocking then the B<ssl> object will also have non-blocking behaviour. This
Packit c4476c
function transfers ownership of B<rbio> to B<ssl>. It will be automatically
Packit c4476c
freed using L<BIO_free_all(3)> when the B<ssl> is freed. On calling this
Packit c4476c
function, any existing B<rbio> that was previously set will also be freed via a
Packit c4476c
call to L<BIO_free_all(3)> (this includes the case where the B<rbio> is set to
Packit c4476c
the same value as previously).
Packit c4476c
Packit c4476c
SSL_set0_wbio() works in the same as SSL_set0_rbio() except that it connects
Packit c4476c
the BIO B<wbio> for the write operations of the B<ssl> object. Note that if the
Packit c4476c
rbio and wbio are the same then SSL_set0_rbio() and SSL_set0_wbio() each take
Packit c4476c
ownership of one reference. Therefore it may be necessary to increment the
Packit c4476c
number of references available using L<BIO_up_ref(3)> before calling the set0
Packit c4476c
functions.
Packit c4476c
Packit c4476c
SSL_set_bio() is similar to SSL_set0_rbio() and SSL_set0_wbio() except
Packit c4476c
that it connects both the B<rbio> and the B<wbio> at the same time, and
Packit c4476c
transfers the ownership of B<rbio> and B<wbio> to B<ssl> according to
Packit c4476c
the following set of rules:
Packit c4476c
Packit c4476c
=over 2
Packit c4476c
Packit c4476c
=item *
Packit c4476c
Packit c4476c
If neither the B<rbio> or B<wbio> have changed from their previous values
Packit c4476c
then nothing is done.
Packit c4476c
Packit c4476c
=item *
Packit c4476c
Packit c4476c
If the B<rbio> and B<wbio> parameters are different and both are different
Packit c4476c
to their
Packit c4476c
previously set values then one reference is consumed for the rbio and one
Packit c4476c
reference is consumed for the wbio.
Packit c4476c
Packit c4476c
=item *
Packit c4476c
Packit c4476c
If the B<rbio> and B<wbio> parameters are the same and the B<rbio> is not
Packit c4476c
the same as the previously set value then one reference is consumed.
Packit c4476c
Packit c4476c
=item *
Packit c4476c
Packit c4476c
If the B<rbio> and B<wbio> parameters are the same and the B<rbio> is the
Packit c4476c
same as the previously set value, then no additional references are consumed.
Packit c4476c
Packit c4476c
=item *
Packit c4476c
Packit c4476c
If the B<rbio> and B<wbio> parameters are different and the B<rbio> is the
Packit c4476c
same as the
Packit c4476c
previously set value then one reference is consumed for the B<wbio> and no
Packit c4476c
references are consumed for the B<rbio>.
Packit c4476c
Packit c4476c
=item *
Packit c4476c
Packit c4476c
If the B<rbio> and B<wbio> parameters are different and the B<wbio> is the
Packit c4476c
same as the previously set value and the old B<rbio> and B<wbio> values
Packit c4476c
were the same as each other then one reference is consumed for the B<rbio>
Packit c4476c
and no references are consumed for the B<wbio>.
Packit c4476c
Packit c4476c
=item *
Packit c4476c
Packit c4476c
If the B<rbio> and B<wbio> parameters are different and the B<wbio>
Packit c4476c
is the same as the
Packit c4476c
previously set value and the old B<rbio> and B<wbio> values were different
Packit c4476c
to each
Packit c4476c
other then one reference is consumed for the B<rbio> and one reference
Packit c4476c
is consumed
Packit c4476c
for the B<wbio>.
Packit c4476c
Packit c4476c
=back
Packit c4476c
Packit c4476c
Because of this complexity, this function should be avoided;
Packit c4476c
use SSL_set0_rbio() and SSL_set0_wbio() instead.
Packit c4476c
Packit c4476c
=head1 RETURN VALUES
Packit c4476c
Packit c4476c
SSL_set_bio(), SSL_set0_rbio() and SSL_set0_wbio() cannot fail.
Packit c4476c
Packit c4476c
=head1 SEE ALSO
Packit c4476c
Packit c4476c
L<SSL_get_rbio(3)>,
Packit c4476c
L<SSL_connect(3)>, L<SSL_accept(3)>,
Packit c4476c
L<SSL_shutdown(3)>, L<ssl(7)>, L<bio(7)>
Packit c4476c
Packit c4476c
=head1 HISTORY
Packit c4476c
Packit c4476c
SSL_set0_rbio() and SSL_set0_wbio() were added in OpenSSL 1.1.0.
Packit c4476c
Packit c4476c
=head1 COPYRIGHT
Packit c4476c
Packit c4476c
Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
Packit c4476c
Packit c4476c
Licensed under the OpenSSL license (the "License").  You may not use
Packit c4476c
this file except in compliance with the License.  You can obtain a copy
Packit c4476c
in the file LICENSE in the source distribution or at
Packit c4476c
L<https://www.openssl.org/source/license.html>.
Packit c4476c
Packit c4476c
=cut