aboutsummaryrefslogtreecommitdiffstats
path: root/src/entropy/dev_random/es_dev.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-11-07 15:52:35 +0000
committerlloyd <[email protected]>2008-11-07 15:52:35 +0000
commitedd4a752d1127c8a72be70565dd03ba0d5b7a6a4 (patch)
tree817663c1718a311b434bbc82fa36901f077df7e7 /src/entropy/dev_random/es_dev.h
parent6a6cd361d4bf28cfcb6a32c2c55b226fef3f9b23 (diff)
Cache device descriptors in Device_EntropySource
Diffstat (limited to 'src/entropy/dev_random/es_dev.h')
-rw-r--r--src/entropy/dev_random/es_dev.h23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/entropy/dev_random/es_dev.h b/src/entropy/dev_random/es_dev.h
index 2c9d93369..ff6a14f2c 100644
--- a/src/entropy/dev_random/es_dev.h
+++ b/src/entropy/dev_random/es_dev.h
@@ -20,13 +20,30 @@ class BOTAN_DLL Device_EntropySource : public EntropySource
public:
std::string name() const { return "RNG Device Reader"; }
- Device_EntropySource(const std::vector<std::string>& fs) :
- fsnames(fs) {}
+ Device_EntropySource(const std::vector<std::string>& fsnames);
u32bit slow_poll(byte[], u32bit);
u32bit fast_poll(byte[], u32bit);
private:
- std::vector<std::string> fsnames;
+
+ /**
+ A class handling reading from a Unix character device
+ */
+ class Device_Reader
+ {
+ public:
+ typedef int fd_type;
+
+ Device_Reader(fd_type device_fd) : fd(device_fd) {}
+ ~Device_Reader();
+ u32bit get(byte out[], u32bit length);
+
+ static fd_type open(const std::string& pathname);
+ private:
+ fd_type fd;
+ };
+
+ std::vector<Device_Reader> devices;
};
}