#include "validate.h" #include #include #include #include #include using namespace Botan; namespace { secure_vector kdf(const std::string& algo, size_t outlen, const secure_vector& secret, const secure_vector& salt) { std::unique_ptr kdf(get_kdf(algo)); return kdf->derive_key(outlen, secret, salt); } std::string kdf_test(const std::string& algo, size_t outlen, const std::string& secret, const std::string& salt) { return hex_encode(kdf(algo, outlen, hex_decode_locked(secret), hex_decode_locked(salt))); } } void test_kdf() { std::ifstream vec("checks/kdf.vec"); run_tests(vec, "KDF", "Output", true, [](std::map m) { return kdf_test(m["KDF"], to_u32bit(m["OutputLen"]), m["Secret"], m["Salt"]); }); }