3
|
1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis |
|
2 * |
|
3 * LibTomCrypt is a library that provides various cryptographic |
|
4 * algorithms in a highly modular and flexible manner. |
|
5 * |
|
6 * The library is free for all purposes without any express |
|
7 * guarantee it works. |
|
8 * |
|
9 * Tom St Denis, [email protected], http://libtomcrypt.org |
|
10 */ |
|
11 |
|
12 /* A secure PRNG using the RNG functions. Basically this is a |
|
13 * wrapper that allows you to use a secure RNG as a PRNG |
|
14 * in the various other functions. |
|
15 */ |
|
16 #include "mycrypt.h" |
|
17 |
|
18 #ifdef SPRNG |
|
19 |
|
20 const struct _prng_descriptor sprng_desc = |
|
21 { |
|
22 "sprng", |
|
23 &sprng_start, |
|
24 &sprng_add_entropy, |
|
25 &sprng_ready, |
|
26 &sprng_read |
|
27 }; |
|
28 |
|
29 int sprng_start(prng_state *prng) |
|
30 { |
|
31 return CRYPT_OK; |
|
32 } |
|
33 |
|
34 int sprng_add_entropy(const unsigned char *buf, unsigned long len, prng_state *prng) |
|
35 { |
|
36 return CRYPT_OK; |
|
37 } |
|
38 |
|
39 int sprng_ready(prng_state *prng) |
|
40 { |
|
41 return CRYPT_OK; |
|
42 } |
|
43 |
|
44 unsigned long sprng_read(unsigned char *buf, unsigned long len, prng_state *prng) |
|
45 { |
|
46 _ARGCHK(buf != NULL); |
|
47 return rng_get_bytes(buf, len, NULL); |
|
48 } |
|
49 |
|
50 #endif |
|
51 |
|
52 |
|
53 |