Browse code

ssl_openssl: fix compiler warning by removing getbio() wrapper

An API change in openssl 1.1 made the BIO_METHOD * returned by BIO_f_ssl()
and BIO_s_mem() const, as well as the BIO_METHOD * argment of BIO_new()
const. This meant that our getbio() function would either have an API
inconsistent with 1.0 or 1.1.

The wrapper was basically an ASSERT, so fix this by replacing the wrapper
with an ASSERT.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1513246897-28171-1-git-send-email-steffan@karger.me>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg16083.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>

Steffan Karger authored on 2017/12/14 19:21:37
Showing 1 changed files
... ...
@@ -1416,23 +1416,6 @@ bio_debug_oc(const char *mode, BIO *bio)
1416 1416
 #endif /* ifdef BIO_DEBUG */
1417 1417
 
1418 1418
 /*
1419
- * OpenVPN's interface to SSL/TLS authentication,
1420
- * encryption, and decryption is exclusively
1421
- * through "memory BIOs".
1422
- */
1423
-static BIO *
1424
-getbio(BIO_METHOD *type, const char *desc)
1425
-{
1426
-    BIO *ret;
1427
-    ret = BIO_new(type);
1428
-    if (!ret)
1429
-    {
1430
-        crypto_msg(M_FATAL, "Error creating %s BIO", desc);
1431
-    }
1432
-    return ret;
1433
-}
1434
-
1435
-/*
1436 1419
  * Write to an OpenSSL BIO in non-blocking mode.
1437 1420
  */
1438 1421
 static int
... ...
@@ -1573,9 +1556,9 @@ key_state_ssl_init(struct key_state_ssl *ks_ssl, const struct tls_root_ctx *ssl_
1573 1573
      * from verify callback*/
1574 1574
     SSL_set_ex_data(ks_ssl->ssl, mydata_index, session);
1575 1575
 
1576
-    ks_ssl->ssl_bio = getbio(BIO_f_ssl(), "ssl_bio");
1577
-    ks_ssl->ct_in = getbio(BIO_s_mem(), "ct_in");
1578
-    ks_ssl->ct_out = getbio(BIO_s_mem(), "ct_out");
1576
+    ASSERT((ks_ssl->ssl_bio = BIO_new(BIO_f_ssl())));
1577
+    ASSERT((ks_ssl->ct_in = BIO_new(BIO_s_mem())));
1578
+    ASSERT((ks_ssl->ct_out = BIO_new(BIO_s_mem())));
1579 1579
 
1580 1580
 #ifdef BIO_DEBUG
1581 1581
     bio_debug_oc("open ssl_bio", ks_ssl->ssl_bio);