summaryrefslogtreecommitdiff
blob: 1e8806bda2fe20b5f7343fb063f77e364c45fe2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
From 2be534747d2bd111e64fb163120caa6c78d04abe Mon Sep 17 00:00:00 2001
From: Alyssa Ross <hi@alyssa.is>
Date: Mon, 16 Sep 2024 18:16:49 +0200
Subject: [PATCH] FIX(client, server): Remove redundant OpenSSL locking
 callback check
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

CRYPTO_get_locking_callback() has been defined to NULL since OpenSSL
1.1.0.  This check therefore doesn't do anything in any supported
version of OpenSSL:

https://github.com/openssl/openssl/blob/abd30777cc72029e8a44e4b67201cae8ed3d19c1/include/openssl/crypto.h#L220

This fixes the following compiler error that I saw with GCC 14:

/build/source/src/SSL.cpp: In static member function ‘static void MumbleSSL::initialize()’:
/build/source/src/SSL.cpp:36:14: error: converting to ‘bool’ from ‘std::nullptr_t’ requires direct-initialization [-fpermissive]
   36 |         if (!CRYPTO_get_locking_callback()) {
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~

(cherry picked from commit 56945a9dfb62d29dccfe561572ebf64500deaed1)
---
 src/SSL.cpp | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/src/SSL.cpp b/src/SSL.cpp
index bb30f7e9f..72161009c 100644
--- a/src/SSL.cpp
+++ b/src/SSL.cpp
@@ -24,18 +24,7 @@ void MumbleSSL::initialize() {
 	SSL_library_init(); // Safe to discard return value, per OpenSSL man pages.
 	SSL_load_error_strings();
 
-	// Determine if a locking callback has not been set.
-	// This should be the case if there are multiple copies
-	// of OpensSSL in the address space. This is mostly due
-	// to Qt dynamically loading OpenSSL when it is not
-	// configured with -openssl-linked.
-	//
-	// If we detect that no locking callback is configured, we
-	// have to set it up ourselves to allow multi-threaded use
-	// of OpenSSL.
-	if (!CRYPTO_get_locking_callback()) {
-		SSLLocks::initialize();
-	}
+	SSLLocks::initialize();
 }
 
 void MumbleSSL::destroy() {
-- 
2.46.2