8#include <openssl/evp.h>
9#include <openssl/kdf.h>
12#define FMT_HEADER_ONLY
13#include <fmt/format.h>
34 throw std::runtime_error(
"Unsupported hash algorithm");
39 std::vector<uint8_t>
hkdf(
42 const std::span<const uint8_t>& ikm,
43 const std::span<const uint8_t>& salt = {},
44 const std::span<const uint8_t>& info = {});
62 if (EVP_Digest(data, size, r.data(), &len, o_md_type,
nullptr) != 1)
64 throw std::runtime_error(
"OpenSSL hash update error");
76 void update_hash(std::span<const uint8_t> data)
override;
80 EVP_MD_CTX*
ctx =
nullptr;
83 void openssl_sha256(
const std::span<const uint8_t>& data, uint8_t* h);
Definition hash_provider.h:17
Definition hash_provider.h:35
Sha256Hash finalise() override
Definition hash.cpp:212
EVP_MD_CTX * ctx
Definition hash.h:80
void update_hash(std::span< const uint8_t > data) override
Definition hash.cpp:198
~ISha256OpenSSL() override
Definition hash.cpp:190
ISha256OpenSSL()
Definition hash.cpp:176
HashBytes Hash(const uint8_t *data, size_t size, MDType type) const override
Definition hash.h:56
Definition sha256_hash.h:16
const EVP_MD * get_md_type(MDType type)
Definition hash.h:19
std::vector< uint8_t > hkdf(MDType md_type, size_t length, const std::span< const uint8_t > &ikm, const std::span< const uint8_t > &salt={}, const std::span< const uint8_t > &info={})
Definition hash.cpp:51
MDType
Definition md_type.h:10
std::vector< uint8_t > HashBytes
Definition hash_bytes.h:10