Is CRYPTO_set_locking_callback still needed if mutexes in threads are already being used to prevent race conditions?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, I am developing a Windows C++ application that uses OpenSSL.

The application has 2 threads created by CreateThread that perform SSL 
functions such as connecting to a website over HTTPS and 
sending/receiving data

I am already using a mutex  to prevent race conditions, like this:

static HANDLE sslmutex=0;  // global variable at top of file

*inside thread #1:*
while(1)
{
     WaitForSingleObject(sslmutex,INFINITE);
     DoSsl();
     ReleaseMutex(sslmutex);
     Sleep(1000);
}

*inside thread #2:*

while(1)
{
     WaitForSingleObject(sslmutex,INFINITE);
     DoSsl();
     ReleaseMutex(sslmutex);
     Sleep(1000);
}

All SSL related code is in the DoSsl function including 
SSL_library_init(), sending/receiving data, and necessary clean up 
operations.

Is it still necessary for me to use CRYPTO_set_locking_callback or is my 
code already thread safe?

Any assistance greatly appreciated.

Best Regards,

-Avery


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150118/2f09921e/attachment.html>


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux