Changes between 1.1.0f and 1.1.1 [xx XXX xxxx]
+ *) Add "atfork" functions. If building on a system that without
+ pthreads, see doc/man3/OPENSSL_fork_prepare.pod for application
+ requirements. The RAND facility now uses/requires this.
+ [Rich Salz]
+
*) Add SHA3.
[Andy Polyakov]
#include <openssl/rand.h>
void rand_cleanup_int(void);
+void rand_fork(void);
void OPENSSL_fork_child(void)
{
+ rand_fork();
}
#endif
}
drbg->size = RANDOMNESS_NEEDED;
drbg->randomness = ucp;
-
+ drbg->fork_count = rand_fork_count;
drbg->parent = parent;
if (RAND_DRBG_set(drbg, type, flags) < 0)
goto err;
return 0;
}
+ if (drbg->fork_count != rand_fork_count) {
+ drbg->fork_count = rand_fork_count;
+ drbg->state = DRBG_RESEED;
+ }
+
if (drbg->reseed_counter >= drbg->reseed_interval)
drbg->state = DRBG_RESEED;
CRYPTO_RWLOCK *lock;
RAND_DRBG *parent;
int nid; /* the underlying algorithm */
+ int fork_count;
unsigned short flags; /* various external flags */
unsigned short filled;
/*
extern RAND_DRBG rand_drbg;
extern RAND_DRBG priv_drbg;
+/* How often we've forked (only incremented in child). */
+extern int rand_fork_count;
+
/* Hardware-based seeding functions. */
void rand_read_tsc(RAND_poll_fn cb, void *arg);
int rand_read_cpu(RAND_poll_fn cb, void *arg);
static const RAND_METHOD *default_RAND_meth;
static CRYPTO_ONCE rand_init = CRYPTO_ONCE_STATIC_INIT;
RAND_BYTES_BUFFER rand_bytes;
+int rand_fork_count;
#ifdef OPENSSL_RAND_SEED_RDTSC
/*
RAND_DRBG_uninstantiate(drbg);
}
+void rand_fork()
+{
+ rand_fork_count++;
+}
+
DEFINE_RUN_ONCE_STATIC(do_rand_init)
{
int ret = 1;
return ret;
}
-
void rand_cleanup_int(void)
{
const RAND_METHOD *meth = default_RAND_meth;