#include <internal/thread_once.h>
-#ifdef OPENSSL_FIPS
-# include <openssl/fips.h>
-#endif
-
-#ifdef BN_DEBUG
+#if defined(BN_DEBUG) || defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
# define PREDICT
#endif
DEFINE_RUN_ONCE_STATIC(do_rand_lock_init)
{
+ OPENSSL_init_crypto(0, NULL);
rand_lock = CRYPTO_THREAD_lock_new();
rand_tmp_lock = CRYPTO_THREAD_lock_new();
return rand_lock != NULL && rand_tmp_lock != NULL;
if (!num)
return 1;
+#ifdef PREDICT
+ if (rand_predictable)
+ return 1;
+#endif
+
/*
* (Based on the rand(3) manpage)
*
#ifdef PREDICT
if (rand_predictable) {
- static unsigned char val = 0;
+ unsigned char val = 1;
for (i = 0; i < num; i++)
buf[i] = val++;