diff options
author | lloyd <[email protected]> | 2006-09-21 04:16:28 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-09-21 04:16:28 +0000 |
commit | 623917ff27073b3471b7e2fc200d4f2e9217fd86 (patch) | |
tree | 9f9cb60d8aa25c1422f4355f3d96dadfaccd1274 /src/init_def.cpp | |
parent | f7169dce7f61182bdda6b4bc8ac598ed830d82b2 (diff) |
Simplify the initial RNG seeding operation
Diffstat (limited to 'src/init_def.cpp')
-rw-r--r-- | src/init_def.cpp | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/src/init_def.cpp b/src/init_def.cpp index 6faa5d86f..f85af086c 100644 --- a/src/init_def.cpp +++ b/src/init_def.cpp @@ -65,26 +65,15 @@ void LibraryInitializer::initialize(const InitializerOptions& args, if(args.seed_rng()) { - const u32bit min_entropy = - global_config().option_as_u32bit("rng/min_entropy"); - - if(min_entropy != 0) + for(u32bit j = 0; j != 4; ++j) { - u32bit bits_so_far = 0; - - for(u32bit j = 0; j != 4; ++j) - { - u32bit to_get = min_entropy - bits_so_far; - - bits_so_far += global_state().seed_prng(true, to_get); - - if(bits_so_far >= min_entropy) - break; - } - - if(bits_so_far < min_entropy) - throw PRNG_Unseeded("Unable to collect sufficient entropy"); + global_state().seed_prng(true, 384); + if(global_state().rng_is_seeded()) + break; } + + if(!global_state().rng_is_seeded()) + throw PRNG_Unseeded("Unable to collect sufficient entropy"); } if(args.fips_mode() || args.self_test()) |