aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-09-06 17:39:22 -0400
committerJack Lloyd <[email protected]>2018-09-06 17:39:22 -0400
commitde136a9470204df923d65e0217a4d7a21ae0d7e8 (patch)
treee24dba4d3e8df8024b8ffffc797d2d15c0908f76 /src/tests
parent992d2803181b34415c25e013a40ab935eb71a9e3 (diff)
parent8cbe5195b2ea82bf7a58f1a3b8afcc8c53a7537b (diff)
Merge GH #1672 Add RandomNumberGenerator::accepts_input
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/test_newhope.cpp2
-rw-r--r--src/tests/test_rng.h8
-rw-r--r--src/tests/test_runner.cpp2
3 files changed, 12 insertions, 0 deletions
diff --git a/src/tests/test_newhope.cpp b/src/tests/test_newhope.cpp
index 38e1539ce..be75ebeb7 100644
--- a/src/tests/test_newhope.cpp
+++ b/src/tests/test_newhope.cpp
@@ -71,6 +71,8 @@ class NEWHOPE_RNG final : public Botan::RandomNumberGenerator
return true;
}
+ bool accepts_input() const override { return false; }
+
void add_entropy(const uint8_t[], size_t) override
{
/* ignored */
diff --git a/src/tests/test_rng.h b/src/tests/test_rng.h
index 9ac93577b..942277050 100644
--- a/src/tests/test_rng.h
+++ b/src/tests/test_rng.h
@@ -29,6 +29,8 @@ class Fixed_Output_RNG : public Botan::RandomNumberGenerator
return !m_buf.empty();
}
+ bool accepts_input() const override { return true; }
+
size_t reseed(Botan::Entropy_Sources&,
size_t,
std::chrono::milliseconds) override
@@ -116,6 +118,8 @@ class Fixed_Output_Position_RNG final : public Fixed_Output_RNG
}
}
+ bool accepts_input() const override { return false; }
+
void add_entropy(const uint8_t*, size_t) override
{
throw Botan::Exception("add_entropy() not supported by this RNG, test bug?");
@@ -147,6 +151,8 @@ class SeedCapturing_RNG final : public Botan::RandomNumberGenerator
throw Botan::Exception("SeedCapturing_RNG has no output");
}
+ bool accepts_input() const override { return true; }
+
void add_entropy(const uint8_t input[], size_t len) override
{
m_samples++;
@@ -192,6 +198,8 @@ class Request_Counting_RNG final : public Botan::RandomNumberGenerator
return m_randomize_count;
}
+ bool accepts_input() const override { return false; }
+
bool is_seeded() const override
{
return true;
diff --git a/src/tests/test_runner.cpp b/src/tests/test_runner.cpp
index f69f55c0d..8d3f9b72c 100644
--- a/src/tests/test_runner.cpp
+++ b/src/tests/test_runner.cpp
@@ -32,6 +32,8 @@ class Testsuite_RNG final : public Botan::RandomNumberGenerator
m_a = m_b = m_c = m_d = 0;
}
+ bool accepts_input() const override { return true; }
+
void add_entropy(const uint8_t data[], size_t len) override
{
for(size_t i = 0; i != len; ++i)