[openssl/openssl] 156347: Don't setup a default context while tearing down p...

0 views
Skip to first unread message

Neil Horman

unread,
Feb 5, 2026, 12:15:36 PM (2 days ago) Feb 5
to openssl...@openssl.org
Branch: refs/heads/master
Home: https://github.com/openssl/openssl
Commit: 156347ff2cc9145fa5f4f4a3a7f7546e242accc8
https://github.com/openssl/openssl/commit/156347ff2cc9145fa5f4f4a3a7f7546e242accc8
Author: Neil Horman <nho...@openssl.org>
Date: 2026-02-05 (Thu, 05 Feb 2026)

Changed paths:
M crypto/context.c
M include/internal/cryptlib.h

Log Message:
-----------
Don't setup a default context while tearing down private contexts

In providers/applications that create custom libctx'es via
OSSL_LIB_CTX_new, its possible, if the default provider has never been
initaialized during the lifetime of the linked libcrypto, that we
actually wind up creating the default libctx when we free the
aforementioned custom libctx via, as an example:

legacy_teardown->
OSSL_LIB_CTX_free->
ossl_lib_ctx_is_default->
get_default_context->
get_thread_default_context->
default_context_do_init

While this isn't catastrophic, its needless, and in some cases has the
potential to leak memory (for instance if a provider is loaded and
unloaded repeatedly in an environment in which the provider is linked to
libcrypto.so while the calling application is statically linked to
libcrypto.a

Its also fairly easy to clean up, by adding an internal parameter to
gate the creation of the default libctx on the request of the caller, so
do that here

Fixes openssl/project#1846

Reviewed-by: Eugene Syromiatnikov <es...@openssl.org>
Reviewed-by: Paul Dale <paul...@oracle.com>
MergeDate: Thu Feb 5 17:08:13 2026
(Merged from https://github.com/openssl/openssl/pull/29830)



To unsubscribe from these emails, change your notification settings at https://github.com/openssl/openssl/settings/notifications
Reply all
Reply to author
Forward
0 new messages