I'm sure David will have more to say about how the locking callbacks are used in OpenSSL. But my understanding is that just because you implement these, you still cannot freely call SSL_read/SSL_write from different threads without the proper locking. The reason is because you have direct access to the SSL* obj passed to these 2 functions. The locking callbacks probably provide the library with the locks necessary for it to protect objects it uses internally that need syncrhonization. But the SSL object is used in "your" code and it is totally up to you to provide the necessary locking yourself.
At least that I my understanding, which so far seems to work in my multi-threaded application. Ed > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Mark > Sent: Thursday, October 05, 2006 3:24 AM > To: openssl-users@openssl.org > Subject: RE: Need help: Understanding SSL object in > multi-threaded environment > > David, > > > > 1. Is OpenSSL thread-safe? > > > Yes (with limitations: an SSL connection may not > > concurrently be used by multiple threads) > > > > This means exactly what it says. A single SSL connection may not be > > used concurrently by multiple threads. This means it is illegal > > > for one thread to do a 'write' on the connection at the same time > another > > thread might be doing, say, a 'read'. > > > > You can share an SSL connection object among threads, but you must > > protect it yourself with a mutex or similar lock. > > I assume this a reason why OpenSSL has the locking callback functions. > As long as you use these it is safe to share the object AFAIK. > > Regards, Mark > ______________________________________________________________________ > OpenSSL Project http://www.openssl.org > User Support Mailing List openssl-users@openssl.org > Automated List Manager [EMAIL PROTECTED] > ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]