From ffc1ac4da043f8fa9a59cc2d83f7fb0744340a14 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Sat, 23 Dec 2017 07:54:44 -0500 Subject: Avoid (implicitly) using std::rand with std::random_shuffle This causes link-time warnings on BSD and may make static analyzers angry. --- src/tests/test_x509_path.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/tests') 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 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(&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, "", -- cgit v1.2.3