openssl/ssl
Matt Caswell 65e2d67254 Simplify and rename SSL_set_rbio() and SSL_set_wbio()
SSL_set_rbio() and SSL_set_wbio() are new functions in 1.1.0 and really
should be called SSL_set0_rbio() and SSL_set0_wbio(). The old
implementation was not consistent with what "set0" means though as there
were special cases around what happens if the rbio and wbio are the same.
We were only ever taking one reference on the BIO, and checking everywhere
whether the rbio and wbio are the same so as not to double free.

A better approach is to rename the functions to SSL_set0_rbio() and
SSL_set0_wbio(). If an existing BIO is present it is *always* freed
regardless of whether the rbio and wbio are the same or not. It is
therefore the callers responsibility to ensure that a reference is taken
for *each* usage, i.e. one for the rbio and one for the wbio.

The legacy function SSL_set_bio() takes both the rbio and wbio in one go
and sets them both. We can wrap up the old behaviour in the implementation
of that function, i.e. previously if the rbio and wbio are the same in the
call to this function then the caller only needed to ensure one reference
was passed. This behaviour is retained by internally upping the ref count.

This commit was inspired by BoringSSL commit f715c423224.

RT#4572

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-07-29 14:09:57 +01:00
..
record Make the checks for an SSLv2 style record stricter 2016-07-29 12:42:40 +01:00
statem zero pad DHE public key in ServerKeyExchange message for interop 2016-07-25 13:41:33 -04:00
bio_ssl.c Fix BIO_pop for SSL BIOs 2016-07-29 14:09:57 +01:00
build.info Update build.info files for auto-init/de-init 2016-02-09 15:11:38 +00:00
d1_lib.c Fix a few if(, for(, while( inside code. 2016-07-20 07:21:53 -04:00
d1_msg.c Whitespace cleanup in ssl folder 2016-06-29 09:56:39 -04:00
d1_srtp.c Add checks on sk_TYPE_push() returned result 2016-06-23 14:03:29 +01:00
methods.c Copyright consolidation 01/10 2016-05-17 14:19:19 -04:00
packet_locl.h Copyright consolidation 01/10 2016-05-17 14:19:19 -04:00
pqueue.c Copyright consolidation 01/10 2016-05-17 14:19:19 -04:00
s3_cbc.c check return values for EVP_Digest*() APIs 2016-07-15 14:09:05 +01:00
s3_enc.c check return values for EVP_Digest*() APIs 2016-07-15 14:09:05 +01:00
s3_lib.c Sanity check in ssl_get_algorithm2(). 2016-07-20 00:09:46 +01:00
s3_msg.c Always use session_ctx when removing a session 2016-06-08 15:22:41 +01:00
ssl_asn1.c Copyright consolidation 01/10 2016-05-17 14:19:19 -04:00
ssl_cert.c Change all our uses of CRYPTO_THREAD_run_once to use RUN_ONCE instead 2016-07-19 23:49:54 +02:00
ssl_ciph.c Have load_buildtin_compression in ssl/ssl_ciph.c return RUN_ONCE result 2016-07-22 11:56:45 +02:00
ssl_conf.c Spelling... and more spelling 2016-06-22 00:26:10 +02:00
ssl_err.c Check for errors allocating the error strings. 2016-07-20 19:20:53 +02:00
ssl_init.c Change all our uses of CRYPTO_THREAD_run_once to use RUN_ONCE instead 2016-07-19 23:49:54 +02:00
ssl_lib.c Simplify and rename SSL_set_rbio() and SSL_set_wbio() 2016-07-29 14:09:57 +01:00
ssl_locl.h Fix two bugs in clienthello processing 2016-07-19 14:18:03 +02:00
ssl_mcnf.c Whitespace cleanup in ssl folder 2016-06-29 09:56:39 -04:00
ssl_rsa.c fix memory leaks 2016-07-16 12:32:34 -04:00
ssl_sess.c Fix a few if(, for(, while( inside code. 2016-07-20 07:21:53 -04:00
ssl_stat.c SSL test framework: port NPN and ALPN tests 2016-07-19 14:17:48 +02:00
ssl_txt.c Enforce and explicit some const casting 2016-07-25 08:20:00 -04:00
ssl_utst.c Copyright consolidation 01/10 2016-05-17 14:19:19 -04:00
t1_enc.c Spelling... and more spelling 2016-06-22 00:26:10 +02:00
t1_ext.c Copyright consolidation 01/10 2016-05-17 14:19:19 -04:00
t1_lib.c Fix two bugs in clienthello processing 2016-07-19 14:18:03 +02:00
t1_reneg.c Copyright consolidation 01/10 2016-05-17 14:19:19 -04:00
t1_trce.c Enforce and explicit some const casting 2016-07-25 08:20:00 -04:00
tls_srp.c Copyright consolidation 01/10 2016-05-17 14:19:19 -04:00