OpenSSL no longer requires thread locking callbacks. REMOVED FROM CITSERVER
authorArt Cancro <ajc@citadel.org>
Mon, 20 Dec 2021 20:42:51 +0000 (15:42 -0500)
committerArt Cancro <ajc@citadel.org>
Mon, 20 Dec 2021 20:42:51 +0000 (15:42 -0500)
citadel/modules/crypto/serv_crypto.c
citadel/modules/crypto/serv_crypto.h

index 83545f2fcfd79c55f80c0f1e218a3329eed5377f..3d2e7de6619e67d17023fa2eec6c816ea17c10eb 100644 (file)
 
 #ifdef HAVE_OPENSSL
 SSL_CTX *ssl_ctx;                      // SSL context
-pthread_mutex_t **SSLCritters;         // Things needing locking
-
-
-static unsigned long id_callback(void) {
-       return (unsigned long) pthread_self();
-}
 
 
 void generate_key(char *keyfilename) {
@@ -111,24 +105,6 @@ void init_ssl(void) {
        X509_NAME *name = NULL;
        FILE *fp;
 
-       SSLCritters = malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t *));
-       if (!SSLCritters) {
-               syslog(LOG_ERR, "crypto: can't allocate memory!");
-               exit(CTDLEXIT_CRYPTO);
-       }
-       else {
-               int a;
-
-               for (a = 0; a < CRYPTO_num_locks(); a++) {
-                       SSLCritters[a] = malloc(sizeof(pthread_mutex_t));
-                       if (!SSLCritters[a]) {
-                               syslog(LOG_ERR, "crypto: can't allocate memory!!");
-                               exit(CTDLEXIT_CRYPTO);
-                       }
-                       pthread_mutex_init(SSLCritters[a], NULL);
-               }
-       }
-
        // Initialize SSL transport layer
        SSL_library_init();
        SSL_load_error_strings();
@@ -144,9 +120,6 @@ void init_ssl(void) {
                return;
        }
 
-       CRYPTO_set_locking_callback(ssl_lock);
-       CRYPTO_set_id_callback(id_callback);
-
        mkdir(ctdl_key_dir, 0700);              // If the keys directory does not exist, create it
        generate_key(file_crpt_file_key);       // If a private key does not exist, create it
 
@@ -614,14 +587,4 @@ void endtls(void) {
        CC->redirect_ssl = 0;
 }
 
-
-// ssl_lock() callback for OpenSSL mutex locks
-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]);
-       }
-}
 #endif // HAVE_OPENSSL
index 391880ca58dc61c1fc7fea5faf755b8f9d0ea1b9..90c8d2604132a265d87ab566711040bec4c5dc05 100644 (file)
@@ -20,7 +20,6 @@ int client_read_sslblob(StrBuf *Target, long want_len, int timeout);
 void cmd_stls(char *params);
 void cmd_gtls(char *params);
 void endtls(void);
-void ssl_lock(int mode, int n, const char *file, int line);
 void CtdlStartTLS(char *ok_response, char *nosup_response, char *error_response);
 extern SSL_CTX *ssl_ctx;