Commit 4f9c1f3711 for openssl.org

commit 4f9c1f371136277c25b24b104534ac333106a4cc
Author: Bernd Edlinger <bernd.edlinger@hotmail.de>
Date:   Sun Sep 20 18:52:57 2026 +0200

    Use NO_ATEXIT in non-static legacy provider

    Because that is known to cause problems when a different
    libcrypto version is used in the calling application.

    Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
    Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
    Merge-date: Thu Sep 24 11:11:30 2026
    Merged-from: https://github.com/openssl/openssl/pull/32896

diff --git a/providers/legacyprov.c b/providers/legacyprov.c
index cf3365f4fb..e5faff9bcb 100644
--- a/providers/legacyprov.c
+++ b/providers/legacyprov.c
@@ -255,6 +255,10 @@ int OSSL_provider_init(const OSSL_CORE_HANDLE *handle,
     }
 #endif

+#ifndef STATIC_LEGACY
+    OPENSSL_init_crypto(OPENSSL_INIT_NO_ATEXIT, NULL);
+#endif
+
     if ((*provctx = ossl_prov_ctx_new()) == NULL
         || (libctx = OSSL_LIB_CTX_new_child(handle, in)) == NULL) {
         OSSL_LIB_CTX_free(libctx);