From a5e3ac13d602173e2820e7f4399fa89e25db7821 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Mon, 4 Apr 2016 14:38:45 +0100 Subject: [PATCH] Deprecate CRYPTO_cleanup_all_ex_data() and make it a no-op CRYPTO_cleanup_all_ex_data() should not be called expicitly - we should leave auto-deinit to clean this up instead. Reviewed-by: Tim Hudson Reviewed-by: Richard Levitte --- crypto/ex_data.c | 2 +- crypto/include/internal/cryptlib.h | 1 + crypto/init.c | 4 ++-- include/openssl/crypto.h | 5 +++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/crypto/ex_data.c b/crypto/ex_data.c index 6984a1fb2e..573aa48106 100644 --- a/crypto/ex_data.c +++ b/crypto/ex_data.c @@ -175,7 +175,7 @@ static void cleanup_cb(EX_CALLBACK *funcs) * called under potential race-conditions anyway (it's for program shutdown * after all). */ -void CRYPTO_cleanup_all_ex_data(void) +void crypto_cleanup_all_ex_data_intern(void) { int i; diff --git a/crypto/include/internal/cryptlib.h b/crypto/include/internal/cryptlib.h index 8fe9057935..86adaea734 100644 --- a/crypto/include/internal/cryptlib.h +++ b/crypto/include/internal/cryptlib.h @@ -113,6 +113,7 @@ void OPENSSL_cpuid_setup(void); extern unsigned int OPENSSL_ia32cap_P[]; void OPENSSL_showfatal(const char *fmta, ...); extern int OPENSSL_NONPIC_relocated; +void crypto_cleanup_all_ex_data_intern(void); #ifdef __cplusplus } diff --git a/crypto/init.c b/crypto/init.c index d93f282818..3bfe4502eb 100644 --- a/crypto/init.c +++ b/crypto/init.c @@ -461,7 +461,7 @@ void OPENSSL_cleanup(void) "ENGINE_cleanup()\n"); #endif fprintf(stderr, "OPENSSL_INIT: OPENSSL_cleanup: " - "CRYPTO_cleanup_all_ex_data()\n"); + "crypto_cleanup_all_ex_data_intern()\n"); fprintf(stderr, "OPENSSL_INIT: OPENSSL_cleanup: " "BIO_sock_cleanup()\n"); fprintf(stderr, "OPENSSL_INIT: OPENSSL_cleanup: " @@ -483,7 +483,7 @@ void OPENSSL_cleanup(void) #ifndef OPENSSL_NO_ENGINE ENGINE_cleanup(); #endif - CRYPTO_cleanup_all_ex_data(); + crypto_cleanup_all_ex_data_intern(); #ifndef OPENSSL_NO_SOCK BIO_sock_cleanup(); #endif diff --git a/include/openssl/crypto.h b/include/openssl/crypto.h index d775e9e0b2..d0ec86a46c 100644 --- a/include/openssl/crypto.h +++ b/include/openssl/crypto.h @@ -297,13 +297,14 @@ void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); */ int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val); void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx); + +# if OPENSSL_API_COMPAT < 0x10100000L /* * This function cleans up all "ex_data" state. It mustn't be called under * potential race-conditions. */ -void CRYPTO_cleanup_all_ex_data(void); +# define CRYPTO_cleanup_all_ex_data() -# if OPENSSL_API_COMPAT < 0x10100000L /* * The old locking functions have been removed completely without compatibility * macros. This is because the old functions either could not properly report -- 2.34.1