// It is not repeatable. AddEntropy() contributes random entropy to a global pool (only).
//
class DevRandomGenerator {
+ struct Readonly : public UnixPlusPlus::FileDesc {
+ Readonly() { open("/dev/random", O_RDONLY); }
+ };
+
+ struct Writable : public UnixPlusPlus::FileDesc {
+ Writable() { open("/dev/random", O_RDWR); }
+ };
+
public:
DevRandomGenerator(bool writable = false);
void addEntropy(const void *data, size_t length);
private:
- static ModuleNexus<UnixPlusPlus::FileDesc> mDevRandom;
+ static ModuleNexus<Readonly> mReader;
+ static ModuleNexus<Writable> mWriter;
};