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


_______________________________________________
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users

Reply via email to