blob: dc93b56f67b727c8a0f4813e3a201a72f5529913 (
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
/*************************************************
* Global RNG Source File *
* (C) 1999-2007 Jack Lloyd *
*************************************************/
#include <botan/rng.h>
#include <botan/libstate.h>
namespace Botan {
namespace Global_RNG {
/*************************************************
* Get random bits from the global RNG *
*************************************************/
void randomize(byte output[], u32bit size)
{
global_state().randomize(output, size);
}
/*************************************************
* Get random bits from the global RNG *
*************************************************/
byte random()
{
byte ret = 0;
randomize(&ret, 1);
return ret;
}
/*************************************************
* Add entropy to the global RNG *
*************************************************/
void add_entropy(const byte entropy[], u32bit size)
{
global_state().add_entropy(entropy, size);
}
/*************************************************
* Add entropy to the global RNG *
*************************************************/
void add_entropy(EntropySource& src, bool slow_poll)
{
global_state().add_entropy(src, slow_poll);
}
/*************************************************
* Add an EntropySource to the RNG seed list *
*************************************************/
void add_es(EntropySource* src, bool last)
{
global_state().add_entropy_source(src, last);
}
/*************************************************
* Seed the global RNG *
*************************************************/
u32bit seed(bool slow_poll, u32bit bits_to_get)
{
return global_state().seed_prng(slow_poll, bits_to_get);
}
}
}
|