[reSIProcate] OpenSSLInit is not successfully ensuring the thread-safety of OpenSSL
Byron Campen
bcampen at estacado.net
Wed Nov 5 22:51:36 CST 2008
Here's the offending code:
*snip*
#if !defined(WIN32) && defined(PTHREADS)
CRYPTO_set_id_callback(OpenSSLInit::threadIdFunction);
#endif
*snip*
There is no such preprocessor macro as "PTHREADS". The correct thing
to be checking for here, AFAICT, is "_POSIX_THREADS". We should change
this code to something like
#if !defined(WIN32)
#if defined(_POSIX_THREADS)
CRYPTO_set_id_callback(OpenSSLInit::threadIdFunction);
#else
#error Can't set OpenSSL up to be threadsafe!
#endif
#endif
This assumes CRYPTO_thread_id() is set to something sensible by
default on Windows; is this true Scott/Derek?
Also, this code would need to use _POSIX_THREADS
*snip*
unsigned long
OpenSSLInit::threadIdFunction()
{
#if defined(WIN32)
assert(0);
#else
#ifndef PTHREADS
assert(0);
#endif
unsigned long ret;
ret= (unsigned long)pthread_self();
return ret;
#endif
return 0;
}
*snip*
Best regards,
Byron Campen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20081105/e06ba54f/attachment.htm>
More information about the resiprocate-devel
mailing list