| 174 | } |
| 175 | |
| 176 | static void TestHKDF_SHA256_32(const std::string &ikm_hex, const std::string &salt_hex, const std::string &info_hex, const std::string &okm_check_hex) { |
| 177 | std::vector<unsigned char> initial_key_material = ParseHex(ikm_hex); |
| 178 | std::vector<unsigned char> salt = ParseHex(salt_hex); |
| 179 | std::vector<unsigned char> info = ParseHex(info_hex); |
| 180 | |
| 181 | |
| 182 | // our implementation only supports strings for the "info" and "salt", stringify them |
| 183 | std::string salt_stringified(reinterpret_cast<char*>(salt.data()), salt.size()); |
| 184 | std::string info_stringified(reinterpret_cast<char*>(info.data()), info.size()); |
| 185 | |
| 186 | CHKDF_HMAC_SHA256_L32 hkdf32(initial_key_material.data(), initial_key_material.size(), salt_stringified); |
| 187 | unsigned char out[32]; |
| 188 | hkdf32.Expand32(info_stringified, out); |
| 189 | BOOST_CHECK(HexStr(out) == okm_check_hex); |
| 190 | } |
| 191 | |
| 192 | static std::string LongTestString() |
| 193 | { |