diff options
author | Jack Lloyd <[email protected]> | 2016-07-06 14:09:55 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-07-17 10:43:42 -0400 |
commit | 8f2f800c7ea841fa5ab963349178ac3a9f56a513 (patch) | |
tree | 6bfd690f9add2e5196f5c2cb4556407332091329 /src/lib/rng/system_rng | |
parent | d7864303e89a5e04294f8efd1d0e4ac26a1491e5 (diff) |
Address some review comments from @cordney
Use consistent naming for the max output before reseed
parameter. The constant (default) value is renamed to
BOTAN_RNG_DEFAULT_MAX_OUTPUT_BEFORE_RESEED, since without
the DEFAULT_ it reads like a compile time maximum instead.
Use uint8_t instead of byte.
Diffstat (limited to 'src/lib/rng/system_rng')
-rw-r--r-- | src/lib/rng/system_rng/system_rng.cpp | 12 | ||||
-rw-r--r-- | src/lib/rng/system_rng/system_rng.h | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/rng/system_rng/system_rng.cpp b/src/lib/rng/system_rng/system_rng.cpp index a503c2198..135f4fabd 100644 --- a/src/lib/rng/system_rng/system_rng.cpp +++ b/src/lib/rng/system_rng/system_rng.cpp @@ -38,9 +38,9 @@ class System_RNG_Impl final : public RandomNumberGenerator void clear() override {} - void randomize(Botan::byte out[], size_t len) override; + void randomize(uint8_t out[], size_t len) override; - void add_entropy(const byte in[], size_t length) override; + void add_entropy(const uint8_t in[], size_t length) override; std::string name() const override; @@ -90,7 +90,7 @@ System_RNG_Impl::~System_RNG_Impl() #endif } -void System_RNG_Impl::add_entropy(const byte input[], size_t len) +void System_RNG_Impl::add_entropy(const uint8_t input[], size_t len) { #if defined(BOTAN_TARGET_OS_HAS_CRYPTGENRANDOM) /* @@ -102,14 +102,14 @@ void System_RNG_Impl::add_entropy(const byte input[], size_t len) for(size_t i = 0; i != len; ++i) { - byte b = input[i]; + uint8_t b = input[i]; ::CryptGenRandom(m_prov, 1, &b); } */ if(len > 0) { - secure_vector<byte> buf(input, input + len); + secure_vector<uint8_t> buf(input, input + len); ::CryptGenRandom(m_prov, static_cast<DWORD>(buf.size()), buf.data()); } #else @@ -144,7 +144,7 @@ void System_RNG_Impl::add_entropy(const byte input[], size_t len) #endif } -void System_RNG_Impl::randomize(byte buf[], size_t len) +void System_RNG_Impl::randomize(uint8_t buf[], size_t len) { #if defined(BOTAN_TARGET_OS_HAS_CRYPTGENRANDOM) ::CryptGenRandom(m_prov, static_cast<DWORD>(len), buf); diff --git a/src/lib/rng/system_rng/system_rng.h b/src/lib/rng/system_rng/system_rng.h index a789631d6..9cf31e78b 100644 --- a/src/lib/rng/system_rng/system_rng.h +++ b/src/lib/rng/system_rng/system_rng.h @@ -27,9 +27,9 @@ class BOTAN_DLL System_RNG final : public RandomNumberGenerator public: std::string name() const override { return system_rng().name(); } - void randomize(Botan::byte out[], size_t len) override { system_rng().randomize(out, len); } + void randomize(uint8_t out[], size_t len) override { system_rng().randomize(out, len); } - void add_entropy(const byte in[], size_t length) override { system_rng().add_entropy(in, length); } + void add_entropy(const uint8_t in[], size_t length) override { system_rng().add_entropy(in, length); } bool is_seeded() const override { return true; } |