* Process ID of the "find" process that we use for
* entropy gathering.
*/
-static pid_t genproc;
+static struct GNUNET_OS_Process *genproc;
/**
* Function called by libgcrypt whenever we are
return;
if (current == total)
{
- if (genproc != 0)
+ if (genproc != NULL)
{
- if (0 != PLIBC_KILL (genproc, SIGTERM))
+ if (0 != GNUNET_OS_process_kill (genproc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "kill");
GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (genproc));
- genproc = 0;
+ GNUNET_OS_process_close (genproc);
+ genproc = NULL;
}
return;
}
- if (genproc != 0)
+ if (genproc != NULL)
{
ret = GNUNET_OS_process_status (genproc, &type, &code);
if (ret == GNUNET_NO)
GNUNET_break (0);
return;
}
- if (0 != PLIBC_KILL (genproc, SIGTERM))
+ if (0 != GNUNET_OS_process_kill (genproc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "kill");
GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (genproc));
- genproc = 0;
+ GNUNET_OS_process_close (genproc);
+ genproc = NULL;
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_("Starting `%s' process to generate entropy\n"), "find");
static void
killfind ()
{
- if (genproc != 0)
+ if (genproc != NULL)
{
- PLIBC_KILL (genproc, SIGKILL);
- genproc = 0;
+ GNUNET_OS_process_kill (genproc, SIGKILL);
+ GNUNET_OS_process_close (genproc);
+ genproc = NULL;
}
}
void __attribute__ ((constructor)) GNUNET_CRYPTO_random_init ()
{
- SRANDOM (time (NULL));
gcry_control (GCRYCTL_DISABLE_SECMEM, 0);
if (!gcry_check_version (GCRYPT_VERSION))
{
#endif
gcry_set_progress_handler (&entropy_generator, NULL);
atexit (&killfind);
+ SRANDOM (time (NULL) ^ GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX));
}
/* end of crypto_random.c */
+