Commit 6d4fb1d5 authored by Matt Caswell's avatar Matt Caswell
Browse files

Deprecate ENGINE_cleanup() and make it a no-op



ENGINE_cleanup() should not be called expicitly - we should leave
auto-deinit to clean this up instead.

Reviewed-by: default avatarTim Hudson <tjh@openssl.org>
Reviewed-by: default avatarRichard Levitte <levitte@openssl.org>
parent 7b8cc9b3
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -99,9 +99,9 @@ extern CRYPTO_RWLOCK *global_engine_lock;

/*
 * Any code that will need cleanup operations should use these functions to
 * register callbacks. ENGINE_cleanup() will call all registered callbacks in
 * order. NB: both the "add" functions assume the engine lock to already be
 * held (in "write" mode).
 * register callbacks. engine_cleanup_intern() will call all registered
 * callbacks in order. NB: both the "add" functions assume the engine lock to
 * already be held (in "write" mode).
 */
typedef void (ENGINE_CLEANUP_CB) (void);
typedef struct st_engine_cleanup_item {
+3 −3
Original line number Diff line number Diff line
@@ -148,8 +148,8 @@ int ENGINE_free(ENGINE *e)
/* Cleanup stuff */

/*
 * ENGINE_cleanup() is coded such that anything that does work that will need
 * cleanup can register a "cleanup" callback here. That way we don't get
 * engine_cleanup_intern() is coded such that anything that does work that will
 * need cleanup can register a "cleanup" callback here. That way we don't get
 * linker bloat by referring to all *possible* cleanups, but any linker bloat
 * into code "X" will cause X's cleanup function to end up here.
 */
@@ -200,7 +200,7 @@ static void engine_cleanup_cb_free(ENGINE_CLEANUP_ITEM *item)
    OPENSSL_free(item);
}

void ENGINE_cleanup(void)
void engine_cleanup_intern(void)
{
    if (int_cleanup_check(0)) {
        sk_ENGINE_CLEANUP_ITEM_pop_free(cleanup_stack,
+1 −1
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ static ENGINE *engine_list_tail = NULL;

/*
 * This cleanup function is only needed internally. If it should be called,
 * we register it with the "ENGINE_cleanup()" stack to be called during
 * we register it with the "engine_cleanup_intern()" stack to be called during
 * cleanup.
 */

+1 −0
Original line number Diff line number Diff line
@@ -62,3 +62,4 @@ void engine_load_padlock_internal(void);
void engine_load_capi_internal(void);
void engine_load_dasync_internal(void);
void engine_load_afalg_internal(void);
void engine_cleanup_intern(void);
+4 −4
Original line number Diff line number Diff line
@@ -460,7 +460,7 @@ void OPENSSL_cleanup(void)
                    "CONF_modules_free()\n");
#ifndef OPENSSL_NO_ENGINE
    fprintf(stderr, "OPENSSL_INIT: OPENSSL_cleanup: "
                    "ENGINE_cleanup()\n");
                    "engine_cleanup_intern()\n");
#endif
    fprintf(stderr, "OPENSSL_INIT: OPENSSL_cleanup: "
                    "crypto_cleanup_all_ex_data_intern()\n");
@@ -474,16 +474,16 @@ void OPENSSL_cleanup(void)
    /*
     * Note that cleanup order is important:
     * - rand_cleanup_intern could call an ENINGE's RAND cleanup function so
     * must be called before ENGINE_cleanup()
     * must be called before engine_cleanup_intern()
     * - ENGINEs use CRYPTO_EX_DATA and therefore, must be cleaned up
     * before the ex data handlers are wiped in CRYPTO_cleanup_all_ex_data().
     * - CONF_modules_free() can end up in ENGINE code so must be called before
     * ENGINE_cleanup()
     * engine_cleanup_intern()
     */
    rand_cleanup_intern();
    CONF_modules_free();
#ifndef OPENSSL_NO_ENGINE
    ENGINE_cleanup();
    engine_cleanup_intern();
#endif
    crypto_cleanup_all_ex_data_intern();
#ifndef OPENSSL_NO_SOCK
Loading