static void OpenSslThreadId(CRYPTO_THREADID *ti) { #if UCFG_WIN32 CRYPTO_THREADID_set_numeric(ti, ::GetCurrentThreadId()); #else CRYPTO_THREADID_set_numeric(ti, ::pthread_self()); #endif }
void CRYPTO_THREADID_current(CRYPTO_THREADID *id) { if (threadid_callback) { threadid_callback(id); return; } #ifndef OPENSSL_NO_DEPRECATED /* If the deprecated callback was set, fall back to that */ if (id_callback) { CRYPTO_THREADID_set_numeric(id, id_callback()); return; } #endif /* Else pick a backup */ #ifdef OPENSSL_SYS_WIN16 CRYPTO_THREADID_set_numeric(id, (unsigned long)GetCurrentTask()); #elif defined(OPENSSL_SYS_WIN32) CRYPTO_THREADID_set_numeric(id, (unsigned long)GetCurrentThreadId()); #elif defined(OPENSSL_SYS_BEOS) CRYPTO_THREADID_set_numeric(id, (unsigned long)find_thread(NULL)); #else /* For everything else, default to using the address of 'errno' */ CRYPTO_THREADID_set_pointer(id, (void*)&errno); #endif }
extern void SSLThread_id(CRYPTO_THREADID *id) { #if defined(WIN32) CRYPTO_THREADID_set_numeric(id, (unsigned long)GetCurrentThreadId()); #else CRYPTO_THREADID_set_numeric(id, (unsigned long)pthread_self()); #endif }
static void crypto_threadid_callback(CRYPTO_THREADID *threadId) { std::ostringstream oss; oss << std::this_thread::get_id(); std::hash<std::string> hash; CRYPTO_THREADID_set_numeric(threadId, static_cast<unsigned long>(hash(oss.str()))); }
void OpenSSLInitializer::uninitialize() { if (--_rc == 0) { if(_mutexes != NULL) { CRYPTO_set_dynlock_create_callback(0); CRYPTO_set_dynlock_lock_callback(0); CRYPTO_set_dynlock_destroy_callback(0); CRYPTO_set_locking_callback(0); #ifndef POCO_OS_FAMILY_WINDOWS #ifndef OPENSSL_NO_DEPRECATED CRYPTO_set_id_callback(0); #else CRYPTO_THREADID tid; CRYPTO_THREADID_set_numeric(&tid, 0); #endif /* OPENSSL_NO_DEPRECATED */ #endif delete [] _mutexes; } if(! _disableSSLInitialization) { EVP_cleanup(); ERR_free_strings(); CONF_modules_free(); } } }
static void threadIdCallback(CRYPTO_THREADID * id) { /// ACE_thread_t turns out to be a struct under Mac OS. #ifndef __APPLE__ CRYPTO_THREADID_set_numeric(id, ACE_Thread::self()); #else CRYPTO_THREADID_set_pointer(id, ACE_Thread::self()); #endif }
static void pthreads_thread_id(CRYPTO_THREADID *tid) { #if !defined(_MSC_VER) CRYPTO_THREADID_set_numeric(tid, (unsigned long)pthread_self()); #else CRYPTO_THREADID_set_pointer(tid, pthread_self().p); #endif }
static void cb_openssl_threadid(CRYPTO_THREADID *tid) { pthread_t me; me = pthread_self(); if (sizeof(me) == sizeof(void *)) CRYPTO_THREADID_set_pointer(tid, (void *) me); else CRYPTO_THREADID_set_numeric(tid, (unsigned long) me); }
static void janus_dtls_cb_openssl_threadid(CRYPTO_THREADID *tid) { /* FIXME Assuming pthread, which is fine as GLib wraps pthread and * so that's what we use anyway? */ pthread_t me = pthread_self(); if(sizeof(me) == sizeof(void *)) { CRYPTO_THREADID_set_pointer(tid, (void *) me); } else { CRYPTO_THREADID_set_numeric(tid, (unsigned long) me); } }
void CRYPTO_THREADID_current(CRYPTO_THREADID *id) { if (threadid_callback) { threadid_callback(id); return; } #if defined(OPENSSL_WINDOWS) CRYPTO_THREADID_set_numeric(id, (unsigned long)GetCurrentThreadId()); #else /* For everything else, default to using the address of 'errno' */ CRYPTO_THREADID_set_pointer(id, (void *)&errno); #endif }
void OpenSSLInitializer::initialize() { if (++_rc == 1) { #if OPENSSL_VERSION_NUMBER >= 0x0907000L OPENSSL_config(NULL); #endif if(! _disableSSLInitialization) { SSL_library_init(); SSL_load_error_strings(); OpenSSL_add_all_algorithms(); } char seed[SEEDSIZE]; RandomInputStream rnd; rnd.read(seed, sizeof(seed)); RAND_seed(seed, SEEDSIZE); if(CRYPTO_get_locking_callback() == NULL) { int nMutexes = CRYPTO_num_locks(); _mutexes = new Poco::FastMutex[nMutexes]; CRYPTO_set_locking_callback(&OpenSSLInitializer::lock); #ifndef POCO_OS_FAMILY_WINDOWS // Not needed on Windows (see SF #110: random unhandled exceptions when linking with ssl). // https://sourceforge.net/p/poco/bugs/110/ // // From http://www.openssl.org/docs/crypto/threads.html : // "If the application does not register such a callback using CRYPTO_THREADID_set_callback(), // then a default implementation is used - on Windows and BeOS this uses the system's // default thread identifying APIs" #ifndef OPENSSL_NO_DEPRECATED CRYPTO_set_id_callback(&OpenSSLInitializer::id); #else CRYPTO_THREADID tid; CRYPTO_THREADID_set_numeric(&tid, OpenSSLInitializer::id()); #endif /* OPENSSL_NO_DEPRECATED */ #endif CRYPTO_set_dynlock_create_callback(&OpenSSLInitializer::dynlockCreate); CRYPTO_set_dynlock_lock_callback(&OpenSSLInitializer::dynlock); CRYPTO_set_dynlock_destroy_callback(&OpenSSLInitializer::dynlockDestroy); } } }
static void threadIdCallback(CRYPTO_THREADID * id) { CRYPTO_THREADID_set_numeric(id, ACE_Thread::self()); }
/* * OpenSSL thread-safety thread ID callback, up-to-date version. */ static void ssl_thr_id_cb(CRYPTO_THREADID *id) { CRYPTO_THREADID_set_numeric(id, (unsigned long) pthread_self()); }
/* ================================================================================ Function :getThreadId Input :CRYPTO_THREADID *id < thread id information of ssl management > Output :void Return :void Description :get an id of thread ================================================================================ */ static void getThreadId( CRYPTO_THREADID *id ) { CRYPTO_THREADID_set_numeric( id, ( unsigned long )pthread_self( ) ); }
static void thread_id(CRYPTO_THREADID *pId) { CRYPTO_THREADID_set_numeric(pId, (unsigned long)uv_thread_self()); }
static void sdns_openssl_id_cb(CRYPTO_THREADID * id) { CRYPTO_THREADID_set_numeric(id, (unsigned long)sdns_thread_self()); }
NOEXPORT void threadid_func(CRYPTO_THREADID *tid) { CRYPTO_THREADID_set_numeric(tid, stunnel_thread_id()); }
static void my_cb_threadid(CRYPTO_THREADID *id) { CRYPTO_THREADID_set_numeric(id, (unsigned long)pthread_self()); }
static void threadid_cb(CRYPTO_THREADID *threadid) { GIT_UNUSED(threadid); CRYPTO_THREADID_set_numeric(threadid, git_thread_currentid()); }
void OpenSSL::SetThreadId(CRYPTO_THREADID* id) { // MS_TRACE(); CRYPTO_THREADID_set_numeric(id, (unsigned long)pthread_self()); }
void OpenSSL::SetThreadId(CRYPTO_THREADID* thread_id) { // ::Debug("-OpenSSL::SetThreadId() [thread_id: 0x%lx]\n", (long)thread_id); // Let's assume pthread_self() is an unsigned long (otherwise this won't compile anyway). CRYPTO_THREADID_set_numeric(thread_id, (unsigned long)pthread_self()); }