* Version 3.1.9 (unreleased)
-** certtool: option --to-p12 will now ask for a password to generate
+** certtool: Option --to-p12 will now ask for a password to generate
a PKCS #12 file from an encrypted key file. Reported by Yan Fiz.
** libgnutls: Corrected issue in gnutls_pubkey_verify_data().
-** libgnutls: corrected parsing issue in XMPP within a subject
+** libgnutls: Corrected parsing issue in XMPP within a subject
alternative name. Reported by James Cloos.
** libgnutls: gnutls_pkcs11_reinit() will reinitialize all PKCS #11
** libgnutls: Added function to check whether the private key is
still available (inserted).
+** libgnutls: Try to detect fork even during nonce generation.
+
** API and ABI modifications:
gnutls_handshake_set_random: Added
gnutls_transport_set_int2: Added
static int
do_device_source (int init)
{
- int ret, reseed = 0;
+ int ret;
static int (*do_source) (int init) = NULL;
/* using static var here is ok since we are
* always called with mutexes down
}
else
{
-#ifdef HAVE_GETPID
- if (getpid() != pid)
- { /* fork() detected */
- memset(&device_last_read, 0, sizeof(device_last_read));
- pid = getpid();
- reseed = 1;
- }
-#endif
-
ret = do_source (init);
- if (reseed)
- yarrow256_slow_reseed (&yctx);
-
return ret;
}
}
static int
wrap_nettle_rnd (void *_ctx, int level, void *data, size_t datasize)
{
- int ret;
+ int ret, reseed = 0;
RND_LOCK;
+#ifdef HAVE_GETPID
+ if (getpid() != pid)
+ { /* fork() detected */
+ memset(&device_last_read, 0, sizeof(device_last_read));
+ pid = getpid();
+ reseed = 1;
+ }
+#endif
+
/* update state only when having a non-nonce or if nonce
* and nsecs%4096 == 0, i.e., one out of 4096 times called .
*
* The reason we do that is to avoid any delays when generating nonces.
*/
- if (level != GNUTLS_RND_NONCE)
+ if (level != GNUTLS_RND_NONCE || reseed != 0)
{
gettime(¤t_time);
gnutls_assert ();
return ret;
}
+
+ if (reseed)
+ yarrow256_slow_reseed (&yctx);
}
yarrow256_random (&yctx, datasize, data);
if (fp == NULL)
fail("cannot open file");
- gnutls_rnd (GNUTLS_RND_RANDOM, buf1, sizeof (buf1));
+ gnutls_rnd (GNUTLS_RND_NONCE, buf1, sizeof (buf1));
if (debug) dump("buf1", buf1, sizeof(buf1));
fwrite(buf1, 1, sizeof(buf1), fp);
else
{
/* daddy */
- gnutls_rnd (GNUTLS_RND_RANDOM, buf2, sizeof (buf2));
+ gnutls_rnd (GNUTLS_RND_NONCE, buf2, sizeof (buf2));
if (debug) dump("buf2", buf2, sizeof(buf2));
waitpid(pid, NULL, 0);