| 
									
										
										
										
											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 | 
					
						
							|  |  |  | non-blocking then the B<ssl> object will also have non-blocking behaviour. This | 
					
						
							|  |  |  | 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 | 
					
						
							|  |  |  | ownership of one reference. Therefore it may be necessary to increment the | 
					
						
							|  |  |  | 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 | 
					
						
							|  |  |  | to each | 
					
						
							|  |  |  | other then one reference is consumed for the B<rbio> and one 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. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-09-14 21:11:56 +08:00
										 |  |  | =head1 RETURN VALUES | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-07 08:08:59 +08:00
										 |  |  | SSL_set_bio(), SSL_set_rbio() and SSL_set_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 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-11 21:56:44 +08:00
										 |  |  | Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved. | 
					
						
							| 
									
										
										
										
											2016-05-18 23:44:05 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | Licensed under the OpenSSL license (the "License").  You may not use | 
					
						
							|  |  |  | 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 |