Fixed SSL thread locking functions not being used.
This commit is contained in:
@ -208,6 +208,15 @@ static int set_user();
|
|||||||
|
|
||||||
/** SSL multi-threading functions and structures */
|
/** SSL multi-threading functions and structures */
|
||||||
|
|
||||||
|
static SPINLOCK* ssl_locks;
|
||||||
|
|
||||||
|
static void ssl_locking_function(int mode,int n,const char* file, int line)
|
||||||
|
{
|
||||||
|
if(mode & CRYPTO_LOCK)
|
||||||
|
spinlock_acquire(&ssl_locks[n]);
|
||||||
|
else
|
||||||
|
spinlock_release(&ssl_locks[n]);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* OpenSSL requires this struct to be defined in order to use dynamic locks
|
* OpenSSL requires this struct to be defined in order to use dynamic locks
|
||||||
*/
|
*/
|
||||||
@ -1465,14 +1474,19 @@ int main(int argc, char **argv)
|
|||||||
SSL_library_init();
|
SSL_library_init();
|
||||||
SSL_load_error_strings();
|
SSL_load_error_strings();
|
||||||
OPENSSL_add_all_algorithms_noconf();
|
OPENSSL_add_all_algorithms_noconf();
|
||||||
CRYPTO_set_dynlock_create_callback(ssl_create_dynlock);
|
|
||||||
CRYPTO_set_dynlock_destroy_callback(ssl_free_dynlock);
|
int numlocks = CRYPTO_num_locks();
|
||||||
CRYPTO_set_dynlock_lock_callback(ssl_lock_dynlock);
|
if((ssl_locks = malloc(sizeof(SPINLOCK)*(numlocks + 1))) == NULL)
|
||||||
#ifdef OPENSSL_1_0
|
{
|
||||||
CRYPTO_THREADID_set_callback(maxscale_ssl_id);
|
char* logerr = "Memory allocation failed";
|
||||||
#else
|
print_log_n_stderr(true, true, logerr, logerr, eno);
|
||||||
CRYPTO_set_id_callback(pthread_self);
|
rc = MAXSCALE_INTERNALERROR;
|
||||||
#endif
|
goto return_main;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = 0;i<numlocks + 1;i++)
|
||||||
|
spinlock_init(&ssl_locks[i]);
|
||||||
|
|
||||||
/* register exit function for embedded MySQL library */
|
/* register exit function for embedded MySQL library */
|
||||||
l = atexit(libmysqld_done);
|
l = atexit(libmysqld_done);
|
||||||
|
|
||||||
@ -1806,6 +1820,16 @@ int main(int argc, char **argv)
|
|||||||
"MaxScale started with %d server threads.",
|
"MaxScale started with %d server threads.",
|
||||||
config_threadcount())));
|
config_threadcount())));
|
||||||
|
|
||||||
|
CRYPTO_set_locking_callback(ssl_locking_function);
|
||||||
|
CRYPTO_set_dynlock_create_callback(ssl_create_dynlock);
|
||||||
|
CRYPTO_set_dynlock_destroy_callback(ssl_free_dynlock);
|
||||||
|
CRYPTO_set_dynlock_lock_callback(ssl_lock_dynlock);
|
||||||
|
#ifdef OPENSSL_1_0
|
||||||
|
CRYPTO_THREADID_set_callback(maxscale_ssl_id);
|
||||||
|
#else
|
||||||
|
CRYPTO_set_id_callback(pthread_self);
|
||||||
|
#endif
|
||||||
|
|
||||||
MaxScaleStarted = time(0);
|
MaxScaleStarted = time(0);
|
||||||
/*<
|
/*<
|
||||||
* Serve clients.
|
* Serve clients.
|
||||||
|
Reference in New Issue
Block a user