aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/rng/rng.cpp
blob: 14c7196d177cb28d8675d3f7deee38e75a9885e9 (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
25
26
27
28
29
30
31
32
33
34
/*
* Random Number Generator Base
* (C) 1999-2008 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/

#include <botan/rng.h>
#include <botan/hmac_rng.h>
#include <botan/libstate.h>

namespace Botan {

RandomNumberGenerator* RandomNumberGenerator::make_rng()
   {
   return make_rng(global_state().algorithm_factory()).release();
   }

/*
* Create and seed a new RNG object
*/
std::unique_ptr<RandomNumberGenerator> RandomNumberGenerator::make_rng(Algorithm_Factory& af)
   {
   std::unique_ptr<RandomNumberGenerator> rng(
      new HMAC_RNG(af.make_mac("HMAC(SHA-512)"),
                   af.make_mac("HMAC(SHA-256)"))
      );

   rng->reseed(256);

   return rng;
   }

}