Fix a failure where fetches can return NULL in multi-threaded code
authorMatt Caswell <matt@openssl.org>
Tue, 12 Jan 2021 16:50:17 +0000 (16:50 +0000)
committerMatt Caswell <matt@openssl.org>
Thu, 14 Jan 2021 17:30:46 +0000 (17:30 +0000)
commitb11ba50fd9bd3c33e1627ca5c64f08b403e88173
tree36ad101a7314dd26aa660ac045851cc6ae0c3d3e
parent7dd2cb569358591bb832af66fdabd6a6c580c1d4
Fix a failure where fetches can return NULL in multi-threaded code

When a fetch is attempted simultaneously from multiple threads then both
threads can attempt to construct the method. However only one of those
will get added to the global evp method store. The one that "lost" the
race to add the method to the global evp method store ended up with the
fetch call returning NULL, instead of returning the method that was
already available.

Fixes #13682

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/13660)
crypto/core_fetch.c