diff options
Diffstat (limited to 'src/tests/test_x509_path.cpp')
-rw-r--r-- | src/tests/test_x509_path.cpp | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/src/tests/test_x509_path.cpp b/src/tests/test_x509_path.cpp index 43ecb81e0..22d6f1407 100644 --- a/src/tests/test_x509_path.cpp +++ b/src/tests/test_x509_path.cpp @@ -14,16 +14,16 @@ #include <botan/data_src.h> #include <botan/x509_crl.h> #include <botan/pkcs10.h> + #include <botan/exceptn.h> + + #include <fstream> + #include <string> + #include <vector> + #include <map> + #include <algorithm> + #include <limits> #endif -#include <botan/exceptn.h> - -#include <fstream> -#include <string> -#include <vector> -#include <map> -#include <algorithm> - namespace Botan_Tests { namespace { @@ -578,16 +578,21 @@ 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; - }; + struct random_bit_generator { + using result_type = size_t; + static BOTAN_CONSTEXPR result_type min() { return 0; } + static BOTAN_CONSTEXPR result_type max() { return std::numeric_limits<size_t>::max(); } + result_type operator()() + { + size_t s; + Test::rng().randomize(reinterpret_cast<uint8_t*>(&s), sizeof(s)); + return s; + } + } rbg; for(size_t r = 0; r < 16; r++) { - std::random_shuffle(++(certs.begin()), certs.end(), uniform_shuffle); + std::shuffle(++(certs.begin()), certs.end(), rbg); Botan::Path_Validation_Result validation_result = Botan::x509_path_validate(certs, restrictions, trusted, "", |