From 0a522fd74cf10a86749d85dde3086ee575a56efe Mon Sep 17 00:00:00 2001
From: Linus Nordberg <linus@nordu.net>
Date: Wed, 31 Aug 2016 16:21:34 +0200
Subject: Remove openssl thread lock handling.

openssl-1.1 uses a new threading API which makes manual locking wrt
openssl not necessary.
---
 radsecproxy.c | 25 -------------------------
 1 file changed, 25 deletions(-)

(limited to 'radsecproxy.c')

diff --git a/radsecproxy.c b/radsecproxy.c
index c247d5c..e97feae 100644
--- a/radsecproxy.c
+++ b/radsecproxy.c
@@ -77,8 +77,6 @@ static struct list *clconfs, *srvconfs;
 static struct list *realms;
 static struct hash *rewriteconfs;
 
-static pthread_mutex_t *ssl_locks = NULL;
-static long *ssl_lock_count;
 extern int optind;
 extern char *optarg;
 static const struct protodefs *protodefs[RAD_PROTOCOUNT];
@@ -104,19 +102,6 @@ uint8_t protoname2int(const char *name) {
     return 255;
 }
 
-/* callbacks for making OpenSSL thread safe */
-unsigned long ssl_thread_id() {
-    return (unsigned long)pthread_self();
-}
-
-void ssl_locking_callback(int mode, int type, const char *file, int line) {
-    if (mode & CRYPTO_LOCK) {
-	pthread_mutex_lock(&ssl_locks[type]);
-	ssl_lock_count[type]++;
-    } else
-	pthread_mutex_unlock(&ssl_locks[type]);
-}
-
 /* returns 1 if the len first bits are equal, else 0 */
 int prefixmatch(void *a1, void *a2, uint8_t len) {
     static uint8_t mask[] = { 0, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe };
@@ -2044,19 +2029,9 @@ void createlisteners(uint8_t type) {
 }
 
 void sslinit() {
-    int i;
     time_t t;
     pid_t pid;
 
-    ssl_locks = calloc(CRYPTO_num_locks(), sizeof(pthread_mutex_t));
-    ssl_lock_count = OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long));
-    for (i = 0; i < CRYPTO_num_locks(); i++) {
-	ssl_lock_count[i] = 0;
-	pthread_mutex_init(&ssl_locks[i], NULL);
-    }
-    CRYPTO_set_id_callback(ssl_thread_id);
-    CRYPTO_set_locking_callback(ssl_locking_callback);
-
     SSL_load_error_strings();
     SSL_library_init();
 
-- 
cgit v1.1