]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
just use OpenSSL thread IDs
authorAlan T. DeKok <aland@freeradius.org>
Sat, 1 Apr 2023 14:17:20 +0000 (10:17 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sat, 1 Apr 2023 14:18:05 +0000 (10:18 -0400)
which uses the address of "errno".  That is thread-local on all
platforms we care about.

src/main/threads.c

index ac6283d432a685d91b9303dbb03367b2ce8f208e..9b3d0d69b02c83b77c604b41e6194c5c32815e00 100644 (file)
@@ -250,38 +250,6 @@ static const CONF_PARSER thread_config[] = {
 
 static pthread_mutex_t *ssl_mutexes = NULL;
 
-#ifdef HAVE_CRYPTO_SET_ID_CALLBACK
-static unsigned long get_ssl_id(void)
-{
-       unsigned long ret;
-       pthread_t thread = pthread_self();
-
-       if (sizeof(ret) >= sizeof(thread)) {
-               memcpy(&ret, &thread, sizeof(thread));
-       } else {
-               memcpy(&ret, &thread, sizeof(ret));
-       }
-
-       return ret;
-}
-
-/*
- *     Use preprocessor magic to get the right function and argument
- *     to use.  This avoids ifdef's through the rest of the code.
- */
-#if OPENSSL_VERSION_NUMBER < 0x10000000L
-#define ssl_id_function get_ssl_id
-#define set_id_callback CRYPTO_set_id_callback
-
-#else
-static void ssl_id_function(CRYPTO_THREADID *id)
-{
-       CRYPTO_THREADID_set_numeric(id, get_ssl_id());
-}
-#define set_id_callback CRYPTO_THREADID_set_callback
-#endif
-#endif
-
 #ifdef HAVE_CRYPTO_SET_LOCKING_CALLBACK
 static void ssl_locking_function(int mode, int n, UNUSED char const *file, UNUSED int line)
 {
@@ -310,9 +278,6 @@ int tls_mutexes_init(void)
                pthread_mutex_init(&(ssl_mutexes[i]), NULL);
        }
 
-#ifdef HAVE_CRYPTO_SET_ID_CALLBACK
-       set_id_callback(ssl_id_function);
-#endif
 #ifdef HAVE_CRYPTO_SET_LOCKING_CALLBACK
        CRYPTO_set_locking_callback(ssl_locking_function);
 #endif