Botan: Botan::EGD_EntropySource Class Reference

Botan 1.10.12

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Member Functions | List of all members
Botan::EGD_EntropySource Class Reference

`#include <es_egd.h>`

Inheritance diagram for Botan::EGD_EntropySource:

## Public Member Functions
| EGD_EntropySource (const std::vector< std::string > &)
std::string | name () const
void | poll (Entropy_Accumulator &accum)
| ~EGD_EntropySource ()

## Detailed Description

EGD Entropy Source

Definition at line 20 of file es_egd.h.

## Constructor & Destructor Documentation

Botan::EGD_EntropySource::EGD_EntropySource | ( | const std::vector< std::string > & | paths | ) |

EGD_EntropySource constructor

Definition at line 122 of file es_egd.cpp.

Referenced by name().

123 {
124 for(size_t i = 0; i != paths.size(); ++i)
125 sockets.push_back(EGD_Socket(paths[i]));
126 }

Botan::EGD_EntropySource::~EGD_EntropySource | ( |  | ) |

Definition at line 128 of file es_egd.cpp.

Referenced by name().

129 {
130 for(size_t i = 0; i != sockets.size(); ++i)
131 sockets[i].close();
132 sockets.clear();
133 }

## Member Function Documentation

std::string Botan::EGD_EntropySource::name | ( |  | ) | const
| inlinevirtual

Returns
  name identifying this entropy source

Implements Botan::EntropySource.

Definition at line 23 of file es_egd.h.

References EGD_EntropySource(), poll(), and ~EGD_EntropySource().

23 { return "EGD/PRNGD"; }

void Botan::EGD_EntropySource::poll | ( | Entropy_Accumulator & | accum | ) |
| virtual

Gather Entropy from EGD

Implements Botan::EntropySource.

Definition at line 138 of file es_egd.cpp.

References Botan::Entropy_Accumulator::add(), Botan::Entropy_Accumulator::desired_remaining_bits(), and Botan::Entropy_Accumulator::get_io_buffer().

Referenced by name().

139 {
140 size_t go_get = std::min<size_t>(accum.desired_remaining_bits() / 8, 32);
141
142 MemoryRegion<byte>& io_buffer = accum.get_io_buffer(go_get);
143
144 for(size_t i = 0; i != sockets.size(); ++i)
145 {
146 size_t got = sockets[i].read(&io_buffer[0], io_buffer.size());
147
148 if(got)
149 {
150 accum.add(&io_buffer[0], got, 6);
151 break;
152 }
153 }
154 }

The documentation for this class was generated from the following files:

- src/entropy/egd/es_egd.h
- src/entropy/egd/es_egd.cpp