/* * Copyright (c) 2023, stelar7 * Copyright (c) 2024, Ben Wiederhake * Copyright (c) 2025, Altomani Gianluca * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include namespace Crypto::Hash { class HKDF { public: HKDF(HashKind hash_kind); ~HKDF() { EVP_KDF_free(m_kdf); } // Note: The output is different for a salt of length zero and an absent salt, // so Optional really is the correct type. ErrorOr derive_key(Optional maybe_salt, ReadonlyBytes input_keying_material, ReadonlyBytes info, u32 key_length_bytes); private: EVP_KDF* m_kdf; HashKind m_hash_kind; }; }