diff options
author | Jack Lloyd <[email protected]> | 2016-01-01 10:14:42 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-01-01 10:14:42 -0500 |
commit | 7583a2a882f4c9d71d947db853c266394f3ca760 (patch) | |
tree | da42920e915cd94249de1bf93810df0bb2a9d1f9 /src | |
parent | 948eb5448c9ffbd9217780b746f5cbfc8b5b11e4 (diff) |
Remove RNG::gen_mask, which had undefined behavior when bits >= 32
Bug found by Daniel Neus
The function wasn't being used anywhere in the library (and was only
added in 1.11.20) so it seems easier to remove than fix. And removing
it serves to put any user on notice that something bad happened;
Daniel tested this as returning just 0 when bits >= 32 with his
system's compiler.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/rng/rng.h | 12 |
1 files changed, 0 insertions, 12 deletions
diff --git a/src/lib/rng/rng.h b/src/lib/rng/rng.h index 23e974b92..a01212359 100644 --- a/src/lib/rng/rng.h +++ b/src/lib/rng/rng.h @@ -61,18 +61,6 @@ class BOTAN_DLL RandomNumberGenerator } /** - * Return a value in range [0,2^bits) - */ - u64bit gen_mask(size_t bits) - { - if(bits == 0 || bits > 64) - throw Invalid_Argument("RandomNumberGenerator::gen_mask invalid argument"); - - const u64bit mask = ((1 << bits) - 1); - return this->get_random<u64bit>() & mask; - } - - /** * Return a random byte * @return random byte */ |