#if !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_EC)
static const char rnd_seed[] =
"string to make the random number generator think it has entropy";
-static int rnd_fake = 0;
#endif
#ifdef SIGALRM
#ifndef OPENSSL_NO_DSA
if (RAND_status() != 1) {
RAND_seed(rnd_seed, sizeof rnd_seed);
- rnd_fake = 1;
}
for (testnum = 0; testnum < DSA_NUM; testnum++) {
int st = 0;
dsa_doit[testnum] = 0;
}
}
- if (rnd_fake)
- RAND_cleanup();
#endif
#ifndef OPENSSL_NO_EC
if (RAND_status() != 1) {
RAND_seed(rnd_seed, sizeof rnd_seed);
- rnd_fake = 1;
}
for (testnum = 0; testnum < EC_NUM; testnum++) {
int st = 1;
}
}
}
- if (rnd_fake)
- RAND_cleanup();
#endif
#ifndef OPENSSL_NO_EC
if (RAND_status() != 1) {
RAND_seed(rnd_seed, sizeof rnd_seed);
- rnd_fake = 1;
}
for (testnum = 0; testnum < EC_NUM; testnum++) {
if (!ecdh_doit[testnum])
ecdh_doit[testnum] = 0;
}
}
- if (rnd_fake)
- RAND_cleanup();
#endif
#ifndef NO_FORK
show_res:
return NULL;
}
-static const char rnd_seed[] =
- "string to make the random number generator think it has entropy";
-static int rnd_fake = 0;
--- /dev/null
+/*
+ * 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 <openssl/rand.h>
+
+void rand_cleanup_intern(void);
#include <internal/threads.h>
#include <internal/cryptlib_int.h>
#include <openssl/err.h>
-#include <openssl/rand.h>
+#include <internal/rand.h>
#include <openssl/evp.h>
#include <internal/evp_int.h>
#include <internal/conf.h>
#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
#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();
#include <time.h>
#include "internal/cryptlib.h"
#include <openssl/opensslconf.h>
-#include <openssl/rand.h>
+#include "internal/rand.h"
#include <openssl/engine.h>
}
#endif
-void RAND_cleanup(void)
+void rand_cleanup_intern(void)
{
const RAND_METHOD *meth = RAND_get_rand_method();
if (meth && meth->cleanup)
#include <openssl/rand.h>
- void RAND_cleanup(void);
+ #if OPENSSL_API_COMPAT < 0x10100000L
+ # define RAND_cleanup()
+ #endif
=head1 DESCRIPTION
-RAND_cleanup() erases the memory used by the PRNG.
+Prior to OpenSSL 1.1.0 RAND_cleanup() erases the memory used by the PRNG. This
+function is deprecated and as of version 1.1.0 does nothing. No explicit
+initialisation or de-initialisation is necessary. See L<OPENSSL_init_crypto(3)>.
=head1 RETURN VALUE
L<rand(3)>
+=head1 HISTORY
+
+RAND_cleanup() was deprecated in OpenSSL 1.1.0.
+
=cut
} RAND_METHOD;
The components point to the implementation of RAND_seed(),
-RAND_bytes(), RAND_cleanup(), RAND_add(), RAND_pseudo_rand()
+RAND_bytes(), internal RAND cleanup, RAND_add(), RAND_pseudo_rand()
and RAND_status().
Each component may be NULL if the function is not implemented.
const RAND_METHOD *RAND_get_rand_method(void);
RAND_METHOD *RAND_OpenSSL(void);
- void RAND_cleanup(void);
-
/* For Win32 only */
void RAND_screen(void);
int RAND_event(UINT, WPARAM, LPARAM);
+Deprecated:
+
+ #if OPENSSL_API_COMPAT < 0x10100000L
+ # define RAND_cleanup()
+ #endif
+
=head1 DESCRIPTION
Since the introduction of the ENGINE API, the recommended way of controlling
int RAND_set_rand_engine(ENGINE *engine);
# endif
RAND_METHOD *RAND_OpenSSL(void);
-void RAND_cleanup(void);
+#if OPENSSL_API_COMPAT < 0x10100000L
+# define RAND_cleanup()
+#endif
int RAND_bytes(unsigned char *buf, int num);
DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num))
void RAND_seed(const void *buf, int num);