From: Tomas Mraz Date: Fri, 12 Mar 2021 16:29:53 +0000 (+0100) Subject: provider_core: Remove two TODO 3.0 X-Git-Tag: openssl-3.0.0-alpha14~273 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a23deef2812a1ffa816aacb85f3e9b7ffb504ef5;p=thirdparty%2Fopenssl.git 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 (Merged from https://github.com/openssl/openssl/pull/14535) --- diff --git a/crypto/provider_core.c b/crypto/provider_core.c index f5d54b22ec5..64bed25e047 100644 --- a/crypto/provider_core.c +++ b/crypto/provider_core.c @@ -911,7 +911,6 @@ void *ossl_provider_prov_ctx(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; } @@ -1113,7 +1112,14 @@ static OPENSSL_CORE_CTX *core_get_libctx(const OSSL_CORE_HANDLE *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, @@ -1135,8 +1141,8 @@ static int core_thread_start(const OSSL_CORE_HANDLE *handle, */ #ifndef FIPS_MODULE /* - * TODO(3.0) These error functions should use |handle| to select the proper - * library context to report in the correct error stack, at least if error + * These error functions should use |handle| to select the proper + * library context to report in the correct error stack if error * stacks become tied to the library context. * We cannot currently do that since there's no support for it in the * ERR subsystem.