aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-09-22 13:55:28 -0400
committerJack Lloyd <[email protected]>2017-09-22 13:55:42 -0400
commita9f894773b4c7edcd80948c6ba70fa17f37e29be (patch)
tree29a3615cf4c7d9539400e6154bbfd91993a87d01 /src/tests
parent1463be46fc3146528eb79a56e42606f1fc93073f (diff)
Test a couple more functions of PKCS11_RNG
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/test_pkcs11_high_level.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/tests/test_pkcs11_high_level.cpp b/src/tests/test_pkcs11_high_level.cpp
index 6cb7a2724..7b4f749fb 100644
--- a/src/tests/test_pkcs11_high_level.cpp
+++ b/src/tests/test_pkcs11_high_level.cpp
@@ -1378,8 +1378,8 @@ Test::Result test_rng_generate_random()
TestSession test_session(true);
PKCS11_RNG rng(test_session.session());
-
result.confirm("RNG already seeded", rng.is_seeded());
+
std::vector<uint8_t> random(20);
rng.randomize(random.data(), random.size());
result.test_ne("random data generated", random, std::vector<uint8_t>(20));
@@ -1394,6 +1394,14 @@ Test::Result test_rng_add_entropy()
PKCS11_RNG rng(test_session.session());
+ result.confirm("RNG already seeded", rng.is_seeded());
+ rng.clear();
+ result.confirm("RNG ignores call to clear", rng.is_seeded());
+
+ result.test_eq("RNG ignores calls to reseed",
+ rng.reseed(Botan::Entropy_Sources::global_sources(), 256, std::chrono::milliseconds(300)),
+ 0);
+
auto random = Test::rng().random_vec(20);
rng.add_entropy(random.data(), random.size());
result.test_success("entropy added");