Fix a memleak in the FIPS provider
authorMatt Caswell <matt@openssl.org>
Thu, 20 May 2021 10:52:56 +0000 (11:52 +0100)
committerPauli <pauli@openssl.org>
Sun, 23 May 2021 23:39:15 +0000 (09:39 +1000)
commitc9732f095363251131e6e6a4cbbe45deea285ed0
treef79bc658c3ef64ec292e41bb9d0f87a5edf27ac4
parentb3135f56a663711a1234e3d419aaae5fe6915f7f
Fix a memleak in the FIPS provider

If the DRBG is used within the scope of the FIPS OSSL_provider_init
function then it attempts to register a thread callback via c_thread_start.
However the implementation of c_thread_start assumed that the provider's
provctx was already present. However because OSSL_provider_init is still
running it was actually NULL. This means the thread callback fail to work
correctly and a memory leak resulted.

Instead of having c_thread_start use the provctx as the callback argument
we change the definition of c_thread_start to have an explicit callback
argument to use.

Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15278)
crypto/initthread.c
crypto/provider_core.c
include/crypto/cryptlib.h
include/openssl/core_dispatch.h