diff options
author | Matt Caswell <matt@openssl.org> | 2016-07-21 12:17:29 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-07-29 14:09:57 +0100 |
commit | 65e2d672548e7c4bcb28f1c5c835362830b1745b (patch) | |
tree | 6d87e72458317ce13c8f54aebd368b9965619525 /util | |
parent | 9a7169870e803bdd9767d75ca8f64802ca0e7f1c (diff) |
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>
Diffstat (limited to 'util')
-rw-r--r-- | util/libssl.num | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/util/libssl.num b/util/libssl.num index f19ee4c83e..1041d79172 100644 --- a/util/libssl.num +++ b/util/libssl.num @@ -156,7 +156,7 @@ SSL_CTX_set_tmp_dh_callback 156 1_1_0 EXIST::FUNCTION:DH SSL_CTX_get_default_passwd_cb 157 1_1_0 EXIST::FUNCTION: TLSv1_server_method 158 1_1_0 EXIST::FUNCTION:DEPRECATEDIN_1_1_0,TLS1_METHOD DTLS_server_method 159 1_1_0 EXIST::FUNCTION: -SSL_set_rbio 160 1_1_0 EXIST::FUNCTION: +SSL_set0_rbio 160 1_1_0 EXIST::FUNCTION: SSL_CTX_set_options 161 1_1_0 EXIST::FUNCTION: SSL_set_msg_callback 162 1_1_0 EXIST::FUNCTION: SSL_CONF_CTX_free 163 1_1_0 EXIST::FUNCTION: @@ -236,7 +236,7 @@ DTLSv1_server_method 236 1_1_0 EXIST::FUNCTION:DEPRECATEDIN_1 SSL_set_fd 237 1_1_0 EXIST::FUNCTION:SOCK SSL_use_certificate 238 1_1_0 EXIST::FUNCTION: DTLSv1_method 239 1_1_0 EXIST::FUNCTION:DEPRECATEDIN_1_1_0,DTLS1_METHOD -SSL_set_wbio 240 1_1_0 EXIST::FUNCTION: +SSL_set0_wbio 240 1_1_0 EXIST::FUNCTION: SSL_read 241 1_1_0 EXIST::FUNCTION: SSL_CTX_get_options 242 1_1_0 EXIST::FUNCTION: SSL_CTX_set_ssl_version 243 1_1_0 EXIST::FUNCTION: |