diff mbox

[FFmpeg-devel] avformat/tls_openssl: don't use libcrypto locking functions with newer OpenSLL versions

Message ID 20191211161549.9285-1-jamrial@gmail.com
State Accepted
Commit abf5e7bc212f4cc1e022907f92506ab33c19de44
Headers show

Commit Message

James Almer Dec. 11, 2019, 4:15 p.m. UTC
They have been removed altogheter without a compat implementatino, and are
either no-ops or return NULL.
This fixes compiler warnings about checks always evaluating to false, and leaks
of allocated mutexes.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/tls_openssl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Gyan Dec. 11, 2019, 4:37 p.m. UTC | #1
A few typos:

(in commit title)
OpenSLL --> OpenSSL

On 11-12-2019 09:45 pm, James Almer wrote:
> They have been removed altogheter without a compat implementatino, and are
altogheter --> altogether

implementatino --> implementation

Gyan
James Almer Dec. 11, 2019, 4:39 p.m. UTC | #2
On 12/11/2019 1:37 PM, Gyan wrote:
> A few typos:
> 
> (in commit title)
> OpenSLL --> OpenSSL
> 
> On 11-12-2019 09:45 pm, James Almer wrote:
>> They have been removed altogheter without a compat implementatino, and
>> are
> altogheter --> altogether
> 
> implementatino --> implementation

Amended locally (Plus a mental note to proofread commit messages before
git send-email).
James Almer Dec. 19, 2019, 10:32 p.m. UTC | #3
On 12/11/2019 1:39 PM, James Almer wrote:
> On 12/11/2019 1:37 PM, Gyan wrote:
>> A few typos:
>>
>> (in commit title)
>> OpenSLL --> OpenSSL
>>
>> On 11-12-2019 09:45 pm, James Almer wrote:
>>> They have been removed altogheter without a compat implementatino, and
>>> are
>> altogheter --> altogether
>>
>> implementatino --> implementation
> 
> Amended locally (Plus a mental note to proofread commit messages before
> git send-email).

Pushed.
diff mbox

Patch

diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c
index 53f8363a12..e305b2465a 100644
--- a/libavformat/tls_openssl.c
+++ b/libavformat/tls_openssl.c
@@ -48,7 +48,7 @@  typedef struct TLSContext {
 #endif
 } TLSContext;
 
-#if HAVE_THREADS
+#if HAVE_THREADS && OPENSSL_VERSION_NUMBER < 0x10100000L
 #include <openssl/crypto.h>
 pthread_mutex_t *openssl_mutexes;
 static void openssl_lock(int mode, int type, const char *file, int line)
@@ -79,7 +79,7 @@  int ff_openssl_init(void)
         SSL_library_init();
         SSL_load_error_strings();
 #endif
-#if HAVE_THREADS
+#if HAVE_THREADS && OPENSSL_VERSION_NUMBER < 0x10100000L
         if (!CRYPTO_get_locking_callback()) {
             int i;
             openssl_mutexes = av_malloc_array(sizeof(pthread_mutex_t), CRYPTO_num_locks());
@@ -108,7 +108,7 @@  void ff_openssl_deinit(void)
     ff_lock_avformat();
     openssl_init--;
     if (!openssl_init) {
-#if HAVE_THREADS
+#if HAVE_THREADS && OPENSSL_VERSION_NUMBER < 0x10100000L
         if (CRYPTO_get_locking_callback() == openssl_lock) {
             int i;
             CRYPTO_set_locking_callback(NULL);