provider_core: Remove two TODO 3.0

We need to keep the check for prov == NULL in ossl_provider_libctx
but it is not needed in core_get_libctx as there it can happen only when
there is a serious coding error in a third party provider and returning
NULL as libctx would be seriously wrong as that has a special meaning.

The second TODO is valid but not something that is relevant
for 3.0. Change it into a normal comment.

Fixes #14377

Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14535)
This commit is contained in:
Tomas Mraz 2021-03-12 17:29:53 +01:00
parent a8275fbc4a
commit a23deef281
1 changed files with 10 additions and 4 deletions

View File

@ -911,7 +911,6 @@ void *ossl_provider_prov_ctx(const OSSL_PROVIDER *prov)
OSSL_LIB_CTX *ossl_provider_libctx(const OSSL_PROVIDER *prov) OSSL_LIB_CTX *ossl_provider_libctx(const OSSL_PROVIDER *prov)
{ {
/* TODO(3.0) just: return prov->libctx; */
return prov != NULL ? prov->libctx : NULL; return prov != NULL ? prov->libctx : NULL;
} }
@ -1113,7 +1112,14 @@ static OPENSSL_CORE_CTX *core_get_libctx(const OSSL_CORE_HANDLE *handle)
*/ */
OSSL_PROVIDER *prov = (OSSL_PROVIDER *)handle; OSSL_PROVIDER *prov = (OSSL_PROVIDER *)handle;
return (OPENSSL_CORE_CTX *)ossl_provider_libctx(prov); /*
* Using ossl_provider_libctx would be wrong as that returns
* NULL for |prov| == NULL and NULL libctx has a special meaning
* that does not apply here. Here |prov| == NULL can happen only in
* case of a coding error.
*/
(void)ossl_assert(prov != NULL);
return (OPENSSL_CORE_CTX *)prov->libctx;
} }
static int core_thread_start(const OSSL_CORE_HANDLE *handle, static int core_thread_start(const OSSL_CORE_HANDLE *handle,
@ -1135,8 +1141,8 @@ static int core_thread_start(const OSSL_CORE_HANDLE *handle,
*/ */
#ifndef FIPS_MODULE #ifndef FIPS_MODULE
/* /*
* TODO(3.0) These error functions should use |handle| to select the proper * These error functions should use |handle| to select the proper
* library context to report in the correct error stack, at least if error * library context to report in the correct error stack if error
* stacks become tied to the library context. * stacks become tied to the library context.
* We cannot currently do that since there's no support for it in the * We cannot currently do that since there's no support for it in the
* ERR subsystem. * ERR subsystem.