[openssl-dev] [openssl-team] Discussion: design issue: async and -lpthread

Nico Williams nico at cryptonector.com
Wed Dec 9 09:27:51 UTC 2015


On Wed, Dec 09, 2015 at 02:33:46AM -0600, Nico Williams wrote:
> No more installing callbacks to get locking and atomics.

I should explain why.

First, lock callbacks are a serious detriment to usability.

Second, they are an admission that OpenSSL is incomplete.

Third, if we have lock callbacks to install, then we have the risk of
racing (by multiple libraries using OpenSSL) to install them.  Unless
there's a single function to install *all* such callbacks, then there's
no way to install callbacks atomically.  But every once in a while we'll
need to add an Nth callback, thus breaking the ABI or atomicity.

So, no, no lock callbacks.  OpenSSL should work thread-safely out of the
box like other libraries.  That means that the default configuration
should be to use pthreads on *nix, for example.  We'll need an atomics
library (e.g., OpenPA, or something new) with safe and sane -if not very
performant- defaults that use global locks for platform/compiler
combinations where there's no built-in atomics intrinsics or system
library.  It should be possible to have a no-threads configuration where
the locks and atomics are non-concurrent-safe implementations.

Nico
-- 


More information about the openssl-dev mailing list