/* * EGD EntropySource * (C) 1999-2007 Jack Lloyd * * Botan is released under the Simplified BSD License (see license.txt) */ #ifndef BOTAN_ENTROPY_SRC_EGD_H__ #define BOTAN_ENTROPY_SRC_EGD_H__ #include #include #include #include namespace Botan { /** * EGD Entropy Source */ class EGD_EntropySource final : public Entropy_Source { public: std::string name() const override { return "egd"; } void poll(Entropy_Accumulator& accum) override; EGD_EntropySource(const std::vector&); ~EGD_EntropySource(); private: class EGD_Socket { public: EGD_Socket(const std::string& path); void close(); size_t read(byte outbuf[], size_t length); private: static int open_socket(const std::string& path); std::string m_socket_path; int m_fd; // cached fd }; std::mutex m_mutex; std::vector m_sockets; }; } #endif