aboutsummaryrefslogtreecommitdiffstats
path: root/checks/rng.cpp
blob: 03c4d9990fed81b0c34dc3be4b54e9217f3ebfa0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

#include "common.h"
#include <botan/x931_rng.h>
#include <botan/randpool.h>
#include <botan/es_dev.h>
#include <botan/parsing.h>

using namespace Botan;

RandomNumberGenerator& global_rng()
   {
   static RandomNumberGenerator* rng = 0;

   if(!rng)
      {
      rng = new ANSI_X931_RNG("AES-256", new Randpool("AES-256", "HMAC(SHA-256)"));

      Device_EntropySource dev(split_on("/dev/random:/dev/srandom:/dev/urandom", ':'));

      rng->add_entropy(dev);
      }

   return *rng;
   }