From 3bfc4076f3c0d461a84cc39fc2641f31bc948549 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Mon, 20 Dec 2021 15:47:01 -0500 Subject: [PATCH] OpenSSL no longer requires thread locking callbacks. REMOVED FROM WEBCIT CLASSIC --- webcit/crypto.c | 56 ++----------------------------------------------- 1 file changed, 2 insertions(+), 54 deletions(-) diff --git a/webcit/crypto.c b/webcit/crypto.c index fb5f7a714..b1edb4a15 100644 --- a/webcit/crypto.c +++ b/webcit/crypto.c @@ -24,34 +24,16 @@ #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. */ -- 2.30.2