On Sun, May 13, 2012, Vladimir Belov wrote:

> Hello.
> 
> 1) If I will use each OpenSSL object only by one thread at the
> moment, it can be different thread each time but never two or more
> threads will use one object simultaneously do I need to use
> locking_function and threadid_func or no?
> 

Yes because some structures need to be locked internally. An example is the
error queue.

> 2) Performance of dynamic locks in comparison with "static" locks.
> In thread3(3) documentation page there is a phrase: "OpenSSL
> supports dynamic locks, and sometimes, some parts of OpenSSL need it
> for better performance".
> I don't understand how dynamic locks can increase performance of the
> application! If we use static locks with locking_function and
> threadid_func then all necessary locking objects are created at
> starting, we get their quantity with CRYPTO_num_locks(), and during
> working of the application only locking and unlocking occurs. If we
> will use dynamic locks then OpenSSL will spend additional time for
> creating dynamic lock and destroying it. Maybe here more pertinent
> to speak about saving of resources and memory not about performance?
> 
> And also I don't understand the phrase from threads(3) documentation page:
> "Also, dynamic locks are currently not used INTERNALLY by OpenSSL,
> but may do so in the future".
> If they are not used internally how they can guard internal OpenSSL
> objects in Multi-threaded application?
> 
> It would be very nice if somebody from the developers team also
> would answer to the second question and I will be very grateful for
> the response. For example, Dr Stephen N. Henson. Because it is not a
> general question but about a one detail.
> 

Currently dynamical locks aren't used for much. The only example I can
immediately think of is the CHIL ENGINE.

At some point dynamic locks might be used more generally. The reason they
could increase performance is that currently locks are global and related to
structures. So if you need to perform locking on an X509 structure you lock
*all* X509 structures while this is going on. It would be more efficient if
only the single affected X509 structure was locked.

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to