From 6d4fb1d59e61aacefa25edc4fe5acfe1ac93f743 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Mon, 4 Apr 2016 16:12:39 +0100 Subject: 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: Tim Hudson Reviewed-by: Richard Levitte --- crypto/engine/eng_int.h | 6 +++--- crypto/engine/eng_lib.c | 6 +++--- crypto/engine/eng_list.c | 2 +- crypto/include/internal/engine.h | 1 + crypto/init.c | 8 ++++---- 5 files changed, 12 insertions(+), 11 deletions(-) (limited to 'crypto') diff --git a/crypto/engine/eng_int.h b/crypto/engine/eng_int.h index f6a54d8567..70b9517b7e 100644 --- a/crypto/engine/eng_int.h +++ b/crypto/engine/eng_int.h @@ -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 { diff --git a/crypto/engine/eng_lib.c b/crypto/engine/eng_lib.c index dd4734202e..492a249361 100644 --- a/crypto/engine/eng_lib.c +++ b/crypto/engine/eng_lib.c @@ -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, diff --git a/crypto/engine/eng_list.c b/crypto/engine/eng_list.c index 4883d14fff..26c6a6b077 100644 --- a/crypto/engine/eng_list.c +++ b/crypto/engine/eng_list.c @@ -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. */ diff --git a/crypto/include/internal/engine.h b/crypto/include/internal/engine.h index abdb8cc49f..ee5394e96b 100644 --- a/crypto/include/internal/engine.h +++ b/crypto/include/internal/engine.h @@ -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); diff --git a/crypto/init.c b/crypto/init.c index 170d11b91c..ca19408bef 100644 --- a/crypto/init.c +++ b/crypto/init.c @@ -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 -- cgit v1.2.3