[tor-commits] [tor/release-0.2.8] OpenSSL 1.1.0-pre5-dev and later made BIO opaque.

nickm at torproject.org nickm at torproject.org
Tue Apr 5 14:07:19 UTC 2016


commit 5db21f8f81b5b42fcd072cfa06e6fa80a5e64aed
Author: Yawning Angel <yawning at schwanenlied.me>
Date:   Mon Apr 4 04:08:54 2016 +0000

    OpenSSL 1.1.0-pre5-dev and later made BIO opaque.
    
    Detect newer versions and fix our TLS code to use the new API.
---
 src/common/tortls.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/common/tortls.c b/src/common/tortls.c
index fe21875..4ffc672 100644
--- a/src/common/tortls.c
+++ b/src/common/tortls.c
@@ -2274,8 +2274,18 @@ tor_tls_get_n_raw_bytes(tor_tls_t *tls, size_t *n_read, size_t *n_written)
    * save the original BIO for  tls->ssl in the tor_tls_t structure, but
    * that would be tempting fate. */
   wbio = SSL_get_wbio(tls->ssl);
+#if OPENSSL_VERSION_NUMBER >= OPENSSL_VER(1,1,0,0,5)
+  /* BIO structure is opaque as of OpenSSL 1.1.0-pre5-dev.  Again, not
+   * supposed to use this form of the version macro, but the OpenSSL developers
+   * introduced major API changes in the pre-release stage.
+   */
+  if (BIO_method_type(wbio) == BIO_TYPE_BUFFER &&
+        (tmpbio = BIO_next(wbio)) != NULL)
+    wbio = tmpbio;
+#else
   if (wbio->method == BIO_f_buffer() && (tmpbio = BIO_next(wbio)) != NULL)
     wbio = tmpbio;
+#endif
   w = BIO_number_written(wbio);
 
   /* We are ok with letting these unsigned ints go "negative" here:





More information about the tor-commits mailing list