aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/rng/rdrand_rng/rdrand_rng.cpp16
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)