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

index fb5f7a7140ca811be46f2a203d0bdc3b0a95aec9..b1edb4a152ed74fcfa995f4cb931e490bf1e121a 100644 (file)
 #define SIGN_DAYS              3650                    /* how long our certificate should live */
 
 SSL_CTX *ssl_ctx;              /* SSL context */
-pthread_mutex_t **SSLCritters; /* Things needing locking */
 char *ssl_cipher_list = DEFAULT_SSL_CIPHER_LIST;
 
 pthread_key_t ThreadSSL;       /* Per-thread SSL context */
 
-void ssl_lock(int mode, int n, const char *file, int line);
-
-static unsigned long id_callback(void)
-{
-       return (unsigned long) pthread_self();
-}
-
-void shutdown_ssl(void)
-{
+void shutdown_ssl(void) {
        ERR_free_strings();
-
-       /* Openssl requires these while shutdown. 
-        * Didn't find a way to get out of this clean.
-        * int i, n = CRYPTO_num_locks();
-        * for (i = 0; i < n; i++)
-        *      free(SSLCritters[i]);
-        * free(SSLCritters);
-        */
 }
 
 
-void generate_key(char *keyfilename)
-{
+void generate_key(char *keyfilename) {
        int ret = 0;
        RSA *rsa = NULL;
        BIGNUM *bne = NULL;
@@ -129,27 +111,6 @@ void init_ssl(void)
                syslog(LOG_WARNING, "PRNG not adequately seeded, won't do SSL/TLS\n");
                return;
        }
-       SSLCritters = malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t *));
-       if (!SSLCritters) {
-               syslog(LOG_ERR, "citserver: can't allocate memory!!\n");
-               /* Nothing's been initialized, just die */
-               ShutDownWebcit();
-               exit(WC_EXIT_SSL);
-       } else {
-               int a;
-
-               for (a = 0; a < CRYPTO_num_locks(); a++) {
-                       SSLCritters[a] = malloc(sizeof(pthread_mutex_t));
-                       if (!SSLCritters[a]) {
-                               syslog(LOG_ERR,
-                                       "citserver: can't allocate memory!!\n");
-                               /** Nothing's been initialized, just die */
-                               ShutDownWebcit();
-                               exit(WC_EXIT_SSL);
-                       }
-                       pthread_mutex_init(SSLCritters[a], NULL);
-               }
-       }
 
        /*
         * Initialize SSL transport layer
@@ -506,19 +467,6 @@ void endtls(void)
 }
 
 
-/*
- * 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]);
-       }
-}
-
 /*
  * Send binary data to the client encrypted.
  */