Disable OpenSSL lock callback on OpenSSL >= 1.1.1
(cherry picked from commit a56b51a0ba7b0d6fdff7fd0127a118185b146f4f)
This commit is contained in:
		
							parent
							
								
									ff7fcd3805
								
							
						
					
					
						commit
						fa028194e9
					
				
					 1 changed files with 4 additions and 0 deletions
				
			
		| 
						 | 
					@ -80,6 +80,7 @@ string getArg(const string & opt,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if OPENSSL_VERSION_NUMBER < 0x10101000L
 | 
				
			||||||
/* OpenSSL is not thread-safe by default - it will randomly crash
 | 
					/* OpenSSL is not thread-safe by default - it will randomly crash
 | 
				
			||||||
   unless the user supplies a mutex locking function. So let's do
 | 
					   unless the user supplies a mutex locking function. So let's do
 | 
				
			||||||
   that. */
 | 
					   that. */
 | 
				
			||||||
| 
						 | 
					@ -92,6 +93,7 @@ static void opensslLockCallback(int mode, int type, const char * file, int line)
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        opensslLocks[type].unlock();
 | 
					        opensslLocks[type].unlock();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void sigHandler(int signo) { }
 | 
					static void sigHandler(int signo) { }
 | 
				
			||||||
| 
						 | 
					@ -105,9 +107,11 @@ void initNix()
 | 
				
			||||||
    std::cerr.rdbuf()->pubsetbuf(buf, sizeof(buf));
 | 
					    std::cerr.rdbuf()->pubsetbuf(buf, sizeof(buf));
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if OPENSSL_VERSION_NUMBER < 0x10101000L
 | 
				
			||||||
    /* Initialise OpenSSL locking. */
 | 
					    /* Initialise OpenSSL locking. */
 | 
				
			||||||
    opensslLocks = std::vector<std::mutex>(CRYPTO_num_locks());
 | 
					    opensslLocks = std::vector<std::mutex>(CRYPTO_num_locks());
 | 
				
			||||||
    CRYPTO_set_locking_callback(opensslLockCallback);
 | 
					    CRYPTO_set_locking_callback(opensslLockCallback);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    loadConfFile();
 | 
					    loadConfFile();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue