Exemple #1
0
/* Basic initialization which is required to initialize mutexes and
   such.  It does not run a full initialization so that the filling of
   the random pool can be delayed until it is actually needed.  We
   assume that this function is used before any concurrent access
   happens. */
static void
initialize_basics(void)
{
  static int initialized;
  int err;

  if (!initialized)
	{
	  initialized = 1;
	  err = ath_mutex_init (&pool_lock);
	  if (err)
		log_fatal ("failed to create the pool lock: %s\n", strerror (err) );
	  
	  err = ath_mutex_init (&nonce_buffer_lock);
	  if (err)
		log_fatal ("failed to create the nonce buffer lock: %s\n",
				   strerror (err) );

#ifdef USE_RANDOM_DAEMON
	  _gcry_daemon_initialize_basics ();
#endif /*USE_RANDOM_DAEMON*/

	  /* Make sure that we are still using the values we have
		 traditionally used for the random levels.  */
	  gcry_assert (GCRY_WEAK_RANDOM == 0 
				   && GCRY_STRONG_RANDOM == 1
				   && GCRY_VERY_STRONG_RANDOM == 2);
	}
}
Exemple #2
0
/* Basic initialization which is required to initialize mutexes and
   such.  It does not run a full initialization so that the filling of
   the random pool can be delayed until it is actually needed.  We
   assume that this function is used before any concurrent access
   happens. */
static void
initialize_basics(void)
{
  static int initialized;

  if (!initialized)
    {
      initialized = 1;

#ifdef USE_RANDOM_DAEMON
      _gcry_daemon_initialize_basics ();
#endif /*USE_RANDOM_DAEMON*/

      /* Make sure that we are still using the values we have
         traditionally used for the random levels.  */
      gcry_assert (GCRY_WEAK_RANDOM == 0
                   && GCRY_STRONG_RANDOM == 1
                   && GCRY_VERY_STRONG_RANDOM == 2);
    }
}