From f3cd81d6538e6295eaa279acd65ad10faeccd2ed Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Wed, 6 Apr 2016 11:19:55 +0100 Subject: Deprecate RAND_cleanup() and make it a no-op RAND_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/include/internal/rand.h | 11 +++++++++++ crypto/init.c | 10 +++++----- crypto/rand/rand_lib.c | 4 ++-- 3 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 crypto/include/internal/rand.h (limited to 'crypto') diff --git a/crypto/include/internal/rand.h b/crypto/include/internal/rand.h new file mode 100644 index 0000000000..f1a9389425 --- /dev/null +++ b/crypto/include/internal/rand.h @@ -0,0 +1,11 @@ +/* + * Licensed under the OpenSSL licenses, (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * https://www.openssl.org/source/license.html + * or in the file LICENSE in the source distribution. + */ + +#include + +void rand_cleanup_intern(void); diff --git a/crypto/init.c b/crypto/init.c index 3699145ac6..d93f282818 100644 --- a/crypto/init.c +++ b/crypto/init.c @@ -58,7 +58,7 @@ #include #include #include -#include +#include #include #include #include @@ -453,7 +453,7 @@ void OPENSSL_cleanup(void) #ifdef OPENSSL_INIT_DEBUG fprintf(stderr, "OPENSSL_INIT: OPENSSL_cleanup: " - "RAND_cleanup()\n"); + "rand_cleanup_intern()\n"); fprintf(stderr, "OPENSSL_INIT: OPENSSL_cleanup: " "CONF_modules_free()\n"); #ifndef OPENSSL_NO_ENGINE @@ -471,14 +471,14 @@ void OPENSSL_cleanup(void) #endif /* * Note that cleanup order is important: - * - RAND_cleanup could call an ENINGE's RAND cleanup function so must be - * called before ENGINE_cleanup() + * - rand_cleanup_intern could call an ENINGE's RAND cleanup function so + * must be called before ENGINE_cleanup() * - 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() */ - RAND_cleanup(); + rand_cleanup_intern(); CONF_modules_free(); #ifndef OPENSSL_NO_ENGINE ENGINE_cleanup(); diff --git a/crypto/rand/rand_lib.c b/crypto/rand/rand_lib.c index 36b41cda80..f5998f80aa 100644 --- a/crypto/rand/rand_lib.c +++ b/crypto/rand/rand_lib.c @@ -59,7 +59,7 @@ #include #include "internal/cryptlib.h" #include -#include +#include "internal/rand.h" #include @@ -125,7 +125,7 @@ int RAND_set_rand_engine(ENGINE *engine) } #endif -void RAND_cleanup(void) +void rand_cleanup_intern(void) { const RAND_METHOD *meth = RAND_get_rand_method(); if (meth && meth->cleanup) -- cgit v1.2.3