Skip to content

Commit

Permalink
Use forward-declared Jitter_RNG_Data
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkz committed Sep 11, 2024
1 parent ddf8b02 commit b60a8be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/lib/entropy/entropy_srcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ class Jitter_RNG_EntropySource final : public Entropy_Source {
public:
size_t poll(RandomNumberGenerator& rng) override {
const size_t poll_bits = BOTAN_RNG_RESEED_POLL_BITS;
rng.reseed_from_rng(m_rng, poll_bits);
rng.reseed_from_rng(*m_rng, poll_bits);
return poll_bits;
}

std::string name() const override { return m_rng.name(); }
std::string name() const override { return m_rng->name(); }

private:
Jitter_RNG m_rng;
std::unique_ptr<Jitter_RNG> m_rng;
};

#endif
Expand Down
14 changes: 2 additions & 12 deletions src/lib/rng/jitter_rng/jitter_rng.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,9 @@

#include <botan/rng.h>

struct rand_data;

namespace Botan {

class BOTAN_DLL Jitter_RNG_Data {
public:
Jitter_RNG_Data();
~Jitter_RNG_Data();
void collect_into_buffer(std::span<uint8_t> buf);

private:
rand_data* m_jitter;
};
class BOTAN_DLL Jitter_RNG_Data;

/*
* RNG using libjitterentropy.
Expand All @@ -41,7 +31,7 @@ class BOTAN_PUBLIC_API(3, 6) Jitter_RNG final : public RandomNumberGenerator {
void fill_bytes_with_input(std::span<uint8_t> out, std::span<const uint8_t> in) override;

private:
Jitter_RNG_Data m_jitter;
std::unique_ptr<Jitter_RNG_Data> m_jitter;
};
} // namespace Botan

Expand Down

0 comments on commit b60a8be

Please sign in to comment.