aboutsummaryrefslogtreecommitdiffstats
path: root/src/entropy/egd
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-10-12 20:23:47 +0000
committerlloyd <[email protected]>2010-10-12 20:23:47 +0000
commit6385602fcccfd9c561b1c097095ddd2edf1a2357 (patch)
tree63374ebafd20b09ff4ad77d624a4b27c87b1062c /src/entropy/egd
parentab1f661083053df745daf1e1b8f4859f5a92065d (diff)
Use size_t instead of u32bit in entropy and rng
Diffstat (limited to 'src/entropy/egd')
-rw-r--r--src/entropy/egd/es_egd.cpp10
-rw-r--r--src/entropy/egd/es_egd.h2
2 files changed, 6 insertions, 6 deletions
diff --git a/src/entropy/egd/es_egd.cpp b/src/entropy/egd/es_egd.cpp
index 7efcf204d..d2ce2706b 100644
--- a/src/entropy/egd/es_egd.cpp
+++ b/src/entropy/egd/es_egd.cpp
@@ -63,7 +63,7 @@ int EGD_EntropySource::EGD_Socket::open_socket(const std::string& path)
/**
* Attempt to read entropy from EGD
*/
-u32bit EGD_EntropySource::EGD_Socket::read(byte outbuf[], u32bit length)
+size_t EGD_EntropySource::EGD_Socket::read(byte outbuf[], size_t length)
{
if(length == 0)
return 0;
@@ -79,7 +79,7 @@ u32bit EGD_EntropySource::EGD_Socket::read(byte outbuf[], u32bit length)
{
// 1 == EGD command for non-blocking read
byte egd_read_command[2] = {
- 1, static_cast<byte>(std::min<u32bit>(length, 255)) };
+ 1, static_cast<byte>(std::min<size_t>(length, 255)) };
if(::write(m_fd, egd_read_command, 2) != 2)
throw std::runtime_error("Writing entropy read command to EGD failed");
@@ -96,7 +96,7 @@ u32bit EGD_EntropySource::EGD_Socket::read(byte outbuf[], u32bit length)
if(count != out_len)
throw std::runtime_error("Reading entropy result from EGD failed");
- return static_cast<u32bit>(count);
+ return static_cast<size_t>(count);
}
catch(std::exception)
{
@@ -137,13 +137,13 @@ EGD_EntropySource::~EGD_EntropySource()
*/
void EGD_EntropySource::poll(Entropy_Accumulator& accum)
{
- u32bit go_get = std::min<u32bit>(accum.desired_remaining_bits() / 8, 32);
+ size_t go_get = std::min<size_t>(accum.desired_remaining_bits() / 8, 32);
MemoryRegion<byte>& io_buffer = accum.get_io_buffer(go_get);
for(size_t i = 0; i != sockets.size(); ++i)
{
- u32bit got = sockets[i].read(&io_buffer[0], io_buffer.size());
+ size_t got = sockets[i].read(&io_buffer[0], io_buffer.size());
if(got)
{
diff --git a/src/entropy/egd/es_egd.h b/src/entropy/egd/es_egd.h
index defe88a54..02c52b9a3 100644
--- a/src/entropy/egd/es_egd.h
+++ b/src/entropy/egd/es_egd.h
@@ -33,7 +33,7 @@ class EGD_EntropySource : public EntropySource
EGD_Socket(const std::string& path);
void close();
- u32bit read(byte outbuf[], u32bit length);
+ size_t read(byte outbuf[], size_t length);
private:
static int open_socket(const std::string& path);