aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-12-23 07:54:44 -0500
committerJack Lloyd <[email protected]>2017-12-23 07:54:44 -0500
commitffc1ac4da043f8fa9a59cc2d83f7fb0744340a14 (patch)
tree95f58c571e501a516fc98f2013eb09bd6b18fb5b
parentdadbc6c843171996cf1c15b3230be94945ef6eb3 (diff)
Avoid (implicitly) using std::rand with std::random_shuffle
This causes link-time warnings on BSD and may make static analyzers angry.
-rw-r--r--src/tests/test_x509_path.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/tests/test_x509_path.cpp b/src/tests/test_x509_path.cpp
index 912610ab1..3b84cfd54 100644
--- a/src/tests/test_x509_path.cpp
+++ b/src/tests/test_x509_path.cpp
@@ -552,9 +552,16 @@ std::vector<Test::Result> BSI_Path_Validation_Tests::run()
* the validation function may be relevant, i.e. if issuer DNs are
* ambiguous.
*/
+ auto uniform_shuffle = [](size_t m) -> size_t
+ {
+ size_t s;
+ Test::rng().randomize(reinterpret_cast<uint8_t*>(&s), sizeof(s));
+ return s % m;
+ };
+
for (size_t r = 0; r < 16; r++)
{
- std::random_shuffle(++(certs.begin()), certs.end());
+ std::random_shuffle(++(certs.begin()), certs.end(), uniform_shuffle);
Botan::Path_Validation_Result validation_result =
Botan::x509_path_validate(certs, restrictions, trusted, "",