diff options
author | lloyd <[email protected]> | 2008-11-10 16:35:39 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-11-10 16:35:39 +0000 |
commit | 94d01fa17b1a6c5c8b8ae0726ab310c6be11ffb9 (patch) | |
tree | 703a18d438599509b217a6cd4bde22add4ddf9e2 /src/entropy/dev_random/es_dev.h | |
parent | 9ebe6ec5d24c6b28eb8d44b4204e42dda600fb4d (diff) |
The device reader constructors were being called too soon. Instead
close the fds in the entropy source destructor.
Diffstat (limited to 'src/entropy/dev_random/es_dev.h')
-rw-r--r-- | src/entropy/dev_random/es_dev.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/entropy/dev_random/es_dev.h b/src/entropy/dev_random/es_dev.h index ff6a14f2c..db64b75fa 100644 --- a/src/entropy/dev_random/es_dev.h +++ b/src/entropy/dev_random/es_dev.h @@ -21,6 +21,7 @@ class BOTAN_DLL Device_EntropySource : public EntropySource std::string name() const { return "RNG Device Reader"; } Device_EntropySource(const std::vector<std::string>& fsnames); + ~Device_EntropySource(); u32bit slow_poll(byte[], u32bit); u32bit fast_poll(byte[], u32bit); @@ -34,9 +35,12 @@ class BOTAN_DLL Device_EntropySource : public EntropySource public: typedef int fd_type; + // Does not own fd, a transient class Device_Reader(fd_type device_fd) : fd(device_fd) {} - ~Device_Reader(); - u32bit get(byte out[], u32bit length); + + void close(); + + u32bit get(byte out[], u32bit length, u32bit ms_wait_time); static fd_type open(const std::string& pathname); private: |