]> git.ipfire.org Git - thirdparty/openssl.git/commit
Don't hold any locks while calling the provider init function
authorMatt Caswell <matt@openssl.org>
Mon, 21 Jun 2021 11:49:59 +0000 (12:49 +0100)
committerMatt Caswell <matt@openssl.org>
Thu, 24 Jun 2021 13:48:15 +0000 (14:48 +0100)
commitf109e96559097b882ad772b6b6396abfb1818cfe
tree45322b4ffb4e16984bb65c407a04cf3fa8e384dd
parentb91687c567abdd37cc1920be543eb1961a7351b4
Don't hold any locks while calling the provider init function

Previously providers were added to the store first, and then subsequently
initialised. This meant that during initialisation the provider object
could be shared between multiple threads and hence the locks needed to be
held. However this causes problems because the provider init function is
essentially a user callback and could do virtually anything. There are
many API calls that could be invoked that could subsequently attempt to
acquire the locks. This will fail because the locks are already held.

However, now we have refactored things so that the provider is created and
initialised before being added to the store. Therefore at the point of
initialisation the provider object is not shared with other threads and so
no locks need to be held.

Fixes #15793
Fixes #15712

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15854)
crypto/provider_core.c