[openssl-users] Is CRYPTO_set_locking_callback necessary in multi-threaded OpenSSL program that already uses mutexes to make sure threads can't run at the same time?

Avery A. Tarasov Avery.A.Tarasov at SecurityEngineer.Pro
Fri Jan 23 15:34:29 UTC 2015


I am using OpenSSL 1.0.1l in Win32 environment.

In the main section of the program I initialize the SSL library and load 
the error strings.

Then I create two threads that run concurrently.  One sends GET requests 
to a website and the other sends POST requests to a website using SSL -- 
both threads do this in an infinite loop with a 100 millisecond pause.  
No variables are shared between the two threads.  Everything is declared 
locally.

I use a mutex to make sure it is impossible for the two threads to be 
running at the time (so basically each thread does its work between a 
WaitForSingleObject and ReleaseMutex call)

In this situation, am I correct that there is no need to use 
CRYPTO_set_locking_callback ?   My  program has been running for 3+ days 
and never had a crash or error.
  Although the documention says this CRYPTO_set_locking_callback 
function is needed for mufti-threaded programs, I don't see why in the 
above situation it would be.

Please advise.

Thanks,

-Avery
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150123/d12fdb70/attachment.html>


More information about the openssl-users mailing list