diff options
author | Jack Lloyd <[email protected]> | 2017-08-03 10:31:42 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-08-03 10:31:42 -0400 |
commit | 62da578b1a166fa7885940457ad186cd0c948bab (patch) | |
tree | 13136570d03bbe87eb76f81cdcd218130e3e1481 /src/lib | |
parent | 5b5e262146ee6121cdf73e95ea32620588310f51 (diff) |
Add explicit tests for RDRAND_RNG and System_RNG
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/rng/rdrand_rng/rdrand_rng.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/lib/rng/rdrand_rng/rdrand_rng.cpp b/src/lib/rng/rdrand_rng/rdrand_rng.cpp index d807bd81d..c365a5f76 100644 --- a/src/lib/rng/rdrand_rng/rdrand_rng.cpp +++ b/src/lib/rng/rdrand_rng/rdrand_rng.cpp @@ -24,15 +24,13 @@ RDRAND_RNG::RDRAND_RNG() //static uint32_t RDRAND_RNG::rdrand() { - bool ok = false; - uint32_t r = rdrand_status(ok); - - while(!ok) + for(;;) { - r = rdrand_status(ok); + bool ok = false; + uint32_t r = rdrand_status(ok); + if(ok) + return r; } - - return r; } //static @@ -56,11 +54,11 @@ uint32_t RDRAND_RNG::rdrand_status(bool& ok) if(1 == cf) { ok = true; - return r; + break; } } - return 0; + return r; } void RDRAND_RNG::randomize(uint8_t out[], size_t out_len) |