Add ASSERT to check m_fd for values <0
We are seeing RNG falures on HURD, but we are not throwing when constructing BlockingRng or NonblockingRng. This is despite the fact that /dev/urandom is missing during testing. NonblockingRng should always thwo when /dev/urandom is missing.pull/877/head
parent
6028587b9f
commit
197f5fb1df
|
|
@ -134,6 +134,9 @@ NonblockingRng::NonblockingRng()
|
|||
m_fd = open("/dev/urandom",O_RDONLY);
|
||||
if (m_fd == -1)
|
||||
throw OS_RNG_Err("open /dev/urandom");
|
||||
|
||||
// Do some OSes return -NNN instead of -1?
|
||||
CRYPTOPP_ASSERT(m_fd >= 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -203,6 +206,9 @@ BlockingRng::BlockingRng()
|
|||
m_fd = open(CRYPTOPP_BLOCKING_RNG_FILENAME,O_RDONLY);
|
||||
if (m_fd == -1)
|
||||
throw OS_RNG_Err("open " CRYPTOPP_BLOCKING_RNG_FILENAME);
|
||||
|
||||
// Do some OSes return -NNN instead of -1?
|
||||
CRYPTOPP_ASSERT(m_fd >= 0);
|
||||
}
|
||||
|
||||
BlockingRng::~BlockingRng()
|
||||
|
|
|
|||
Loading…
Reference in New Issue