Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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
16 class File_Descriptor_Source
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 */
26 class ProcWalking_EntropySource final : public Entropy_Source
27 {
28 public:
29 std::string name() const override { return "proc_walk"; }
30
31 size_t poll(RandomNumberGenerator& rng) override;
32
33 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;
40 secure_vector<uint8_t> m_buf;
41 };
42
43 }
44
45 #endif
Botan::ProcWalking_EntropySource::ProcWalking_EntropySource
ProcWalking_EntropySource(const std::string &root_dir)
Definition: proc_walk.h:33
Botan::RandomNumberGenerator
Definition: rng.h:25
Botan::File_Descriptor_Source::next_fd
virtual int next_fd()=0
Botan::File_Descriptor_Source::~File_Descriptor_Source
virtual ~File_Descriptor_Source()=default
Botan::File_Descriptor_Source
Definition: proc_walk.h:16
Botan::secure_vector
std::vector< T, secure_allocator< T >> secure_vector
Definition: secmem.h:121
Botan
Definition: alg_id.cpp:13
Botan::ProcWalking_EntropySource::name
std::string name() const override
Definition: proc_walk.h:29
Botan::ProcWalking_EntropySource::poll
size_t poll(RandomNumberGenerator &rng) override
Definition: proc_walk.cpp:113
Botan::ProcWalking_EntropySource
Definition: proc_walk.h:26
Botan::Entropy_Source
Definition: entropy_src.h:25