From: Art Cancro Date: Mon, 20 Dec 2021 20:50:00 +0000 (-0500) Subject: OpenSSL no longer requires thread locking callbacks. REMOVED FROM WEBCIT-NG X-Git-Tag: v943~22 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=3bae1a68010d05f3b13141ea266af92f16a094db;p=citadel.git OpenSSL no longer requires thread locking callbacks. REMOVED FROM WEBCIT-NG --- diff --git a/webcit-ng/ssl.c b/webcit-ng/ssl.c index f1744c2bb..9de67d1cd 100644 --- a/webcit-ng/ssl.c +++ b/webcit-ng/ssl.c @@ -17,28 +17,7 @@ #include "webcit.h" SSL_CTX *ssl_ctx; // SSL context -pthread_mutex_t **SSLCritters; // Things needing locking char *ssl_cipher_list = DEFAULT_SSL_CIPHER_LIST; -void ssl_lock(int mode, int n, const char *file, int line); - - -// OpenSSL wants a callback function to identify the currently running thread. -// Since we are a pthreads program, we convert the output of pthread_self() to a long. -static unsigned long id_callback(void) { - return (unsigned long) pthread_self(); -} - - -// OpenSSL wants a callback function to set and clear various types of locks. -// Since we are a pthreads program, we use mutexes. -void ssl_lock(int mode, int n, const char *file, int line) { - if (mode & CRYPTO_LOCK) { - pthread_mutex_lock(SSLCritters[n]); - } - else { - pthread_mutex_unlock(SSLCritters[n]); - } -} // Generate a private key for SSL @@ -105,23 +84,6 @@ void init_ssl(void) { char buf[SIZ]; int rv = 0; - SSLCritters = malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t *)); - if (!SSLCritters) { - syslog(LOG_ERR, "citserver: can't allocate memory!!"); - exit(1); - } - else { - int a; - for (a = 0; a < CRYPTO_num_locks(); a++) { - SSLCritters[a] = malloc(sizeof(pthread_mutex_t)); - if (!SSLCritters[a]) { - syslog(LOG_INFO, "citserver: can't allocate memory!!"); - exit(1); - } - pthread_mutex_init(SSLCritters[a], NULL); - } - } - // Initialize SSL transport layer SSL_library_init(); SSL_load_error_strings(); @@ -137,9 +99,6 @@ void init_ssl(void) { return; } - CRYPTO_set_locking_callback(ssl_lock); - CRYPTO_set_id_callback(id_callback); - // Get our certificates in order. // First, create the key/cert directory if it's not there already... mkdir(CTDL_CRYPTO_DIR, 0700);