mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-20 16:31:06 +00:00
Fix for CONC-570:
Removed callback function for crypto threads, since the callback function cannot be cleared. For OpenSSL <= 1.0.2 the default implementation will be used: address of errno (Posix) or GetCurrentThreadId (Windows).
This commit is contained in:
@ -142,26 +142,6 @@ static void ma_tls_set_error(MYSQL *mysql)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAVE_OPENSSL_1_1_API
|
|
||||||
/*
|
|
||||||
thread safe callbacks for OpenSSL
|
|
||||||
Crypto call back functions will be
|
|
||||||
set during ssl_initialization
|
|
||||||
*/
|
|
||||||
#if OPENSSL_VERSION_NUMBER < 0x10000000L
|
|
||||||
static unsigned long my_cb_threadid(void)
|
|
||||||
{
|
|
||||||
/* cast pthread_t to unsigned long */
|
|
||||||
return (unsigned long) pthread_self();
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
static void my_cb_threadid(CRYPTO_THREADID *id)
|
|
||||||
{
|
|
||||||
CRYPTO_THREADID_set_numeric(id, (unsigned long)pthread_self());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_OPENSSL_1_1_API
|
#ifndef HAVE_OPENSSL_1_1_API
|
||||||
static void my_cb_locking(int mode, int n,
|
static void my_cb_locking(int mode, int n,
|
||||||
const char *file __attribute__((unused)),
|
const char *file __attribute__((unused)),
|
||||||
@ -175,25 +155,18 @@ static void my_cb_locking(int mode, int n,
|
|||||||
|
|
||||||
static int ssl_thread_init()
|
static int ssl_thread_init()
|
||||||
{
|
{
|
||||||
if (!CRYPTO_THREADID_get_callback()
|
if (LOCK_crypto == NULL)
|
||||||
#ifndef OPENSSL_NO_DEPRECATED
|
|
||||||
&& !CRYPTO_get_id_callback()
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
int i, max= CRYPTO_num_locks();
|
int i, max= CRYPTO_num_locks();
|
||||||
|
|
||||||
if (LOCK_crypto == NULL)
|
if (!(LOCK_crypto=
|
||||||
{
|
(pthread_mutex_t *)ma_malloc(sizeof(pthread_mutex_t) * max, MYF(0))))
|
||||||
if (!(LOCK_crypto=
|
return 1;
|
||||||
(pthread_mutex_t *)ma_malloc(sizeof(pthread_mutex_t) * max, MYF(0))))
|
|
||||||
return 1;
|
for (i=0; i < max; i++)
|
||||||
|
pthread_mutex_init(&LOCK_crypto[i], NULL);
|
||||||
|
|
||||||
for (i=0; i < max; i++)
|
|
||||||
pthread_mutex_init(&LOCK_crypto[i], NULL);
|
|
||||||
}
|
|
||||||
CRYPTO_set_locking_callback(my_cb_locking);
|
CRYPTO_set_locking_callback(my_cb_locking);
|
||||||
CRYPTO_THREADID_set_callback(my_cb_threadid);
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user