From 2cb3c542735a23a886f41757384f686b4f0d90e0 Mon Sep 17 00:00:00 2001 From: Philipp Hancke Date: Wed, 8 May 2024 11:52:05 -0700 Subject: [PATCH] tls: replace call to deprecated SSL_library_init with OPENSSL_init_ssl SSL_library_init https://www.openssl.org/docs/manmaster/man3/SSL_library_init.html has been deprecated by OPENSSL_init_ssl https://www.openssl.org/docs/man1.1.1/man3/OPENSSL_init_ssl.html which no longer needs to be called as of OpenSSL 1.1.0 (2017). It is still required for boringssl for the time being: https://bugs.chromium.org/p/boringssl/issues/detail?id=35 https://bugs.chromium.org/p/boringssl/issues/detail?id=673 so a TODO is added. BUG=webrtc:339300437 Change-Id: If4c7a9f4935521b33fc19b5fff72d293c0e17b81 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/350145 Reviewed-by: David Benjamin Commit-Queue: Philipp Hancke Reviewed-by: Harald Alvestrand Cr-Commit-Position: refs/heads/main@{#42291} --- rtc_base/openssl_adapter.cc | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/rtc_base/openssl_adapter.cc b/rtc_base/openssl_adapter.cc index e48cdf43bd..2743859006 100644 --- a/rtc_base/openssl_adapter.cc +++ b/rtc_base/openssl_adapter.cc @@ -170,16 +170,12 @@ namespace rtc { using ::webrtc::TimeDelta; bool OpenSSLAdapter::InitializeSSL() { - if (!SSL_library_init()) - return false; -#if !defined(ADDRESS_SANITIZER) || !defined(WEBRTC_MAC) || defined(WEBRTC_IOS) - // Loading the error strings crashes mac_asan. Omit this debugging aid there. - SSL_load_error_strings(); -#endif - ERR_load_BIO_strings(); - OpenSSL_add_all_algorithms(); - RAND_poll(); - return true; + // TODO: https://issues.webrtc.org/issues/339300437 - remove once + // BoringSSL no longer requires this after + // https://bugs.chromium.org/p/boringssl/issues/detail?id=35 + // In OpenSSL it is supposed to be a no-op as of 1.1: + // https://www.openssl.org/docs/man1.1.1/man3/OPENSSL_init_ssl.html + return OPENSSL_init_ssl(0, nullptr); } bool OpenSSLAdapter::CleanupSSL() {