Botan  2.8.0
Crypto and TLS for C++11
proc_walk.h
Go to the documentation of this file.
1 /*
2 * File Tree Walking EntropySource
3 * (C) 1999-2008 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #ifndef BOTAN_ENTROPY_SRC_PROC_WALK_H_
9 #define BOTAN_ENTROPY_SRC_PROC_WALK_H_
10 
11 #include <botan/entropy_src.h>
12 #include <botan/mutex.h>
13 
14 namespace Botan {
15 
17  {
18  public:
19  virtual int next_fd() = 0;
20  virtual ~File_Descriptor_Source() = default;
21  };
22 
23 /**
24 * File Tree Walking Entropy Source
25 */
27  {
28  public:
29  std::string name() const override { return "proc_walk"; }
30 
31  size_t poll(RandomNumberGenerator& rng) override;
32 
33  explicit ProcWalking_EntropySource(const std::string& root_dir) :
34  m_path(root_dir), m_dir(nullptr) {}
35 
36  private:
37  const std::string m_path;
38  mutex_type m_mutex;
39  std::unique_ptr<File_Descriptor_Source> m_dir;
41  };
42 
43 }
44 
45 #endif
ProcWalking_EntropySource(const std::string &root_dir)
Definition: proc_walk.h:33
virtual ~File_Descriptor_Source()=default
int(* final)(unsigned char *, CTX *)
Definition: alg_id.cpp:13
std::string name() const override
Definition: proc_walk.h:29
size_t poll(RandomNumberGenerator &rng) override
Definition: proc_walk.cpp:112
std::vector< T, secure_allocator< T > > secure_vector
Definition: secmem.h:88