OpenSSL no longer requires thread locking callbacks. REMOVED FROM WEBCIT-NG
authorArt Cancro <ajc@citadel.org>
Mon, 20 Dec 2021 20:50:00 +0000 (15:50 -0500)
committerArt Cancro <ajc@citadel.org>
Mon, 20 Dec 2021 20:50:00 +0000 (15:50 -0500)
webcit-ng/ssl.c

index f1744c2bb8144586984601a71e6f7d5291a56ab9..9de67d1cd164c048b11e1ce2d64b17e5a6e392ec 100644 (file)
 #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);