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");
38 std::vector<uint8_t>
hkdf(
41 const std::span<const uint8_t>& ikm,
42 const std::span<const uint8_t>& salt = {},
43 const std::span<const uint8_t>& info = {});
61 if (EVP_Digest(data, size, r.data(), &len, o_md_type,
nullptr) != 1)
63 throw std::runtime_error(
"OpenSSL hash update error");
75 void update_hash(std::span<const uint8_t> data)
override;
79 EVP_MD_CTX*
ctx =
nullptr;
82 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:210
EVP_MD_CTX * ctx
Definition hash.h:79
void update_hash(std::span< const uint8_t > data) override
Definition hash.cpp:196
~ISha256OpenSSL() override
Definition hash.cpp:188
ISha256OpenSSL()
Definition hash.cpp:174
HashBytes hash(const uint8_t *data, size_t size, MDType type) const override
Definition hash.h:55
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