Lock for SSL_accept method

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Lock for SSL_accept method

OpenSSL - User mailing list

Hi All,

 

I used a mutex lock to prevent the SSL_accept() method being called by multiple thread concurrently since it may get coredump if there is no lock on SSL_accept() method. I am just wondering is the lock is still needed for openssl 1.0.2e version?

 

        mutex.lock();

        int rt = SSL_accept(SslSessionObject);

        mutex.unlock();

 

Thank you very much!

Bob

 

 


--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: Lock for SSL_accept method

Matt Caswell-2


On 08/02/18 00:43, Yan, Bob via openssl-users wrote:

> I used a mutex lock to prevent the SSL_accept() method being called by
> multiple thread concurrently since it may get coredump if there is no
> lock on SSL_accept() method. I am just wondering is the lock is still
> needed for openssl 1.0.2e version?
>
>  
>
>         mutex.lock();
>
>         int rt = SSL_accept(SslSessionObject);
>
>         mutex.unlock();

Hmmm. Well it depends what you mean exactly. The first question is: have
you set up the thread locking callbacks?

https://www.openssl.org/docs/faq.html#PROG1

As long as you have done the above then SSL_accept() is thread safe in
as much as it can be called concurrently with different SSL objects
passed as a parameter.

It is never safe to call SSL_accept() concurrently with the *same* SSL
object passed as a parameter. If you want to call SSL_accept() from
multiple threads with the same SSL object then you would have to arrange
your own locking.

Matt

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