8#include <botan/internal/stateful_key_index_registry.h>
10#include <botan/assert.h>
11#include <botan/hash.h>
26 std::span<const uint8_t> key_material_1,
27 std::span<const uint8_t> key_material_2) :
31 hash->update(
"Botan Stateful_Key_Index_Registry KeyID");
32 hash->update_be(
static_cast<uint64_t
>(algo_name.size()));
33 hash->update(algo_name);
34 hash->update_be(algo_params);
35 hash->update_be(
static_cast<uint64_t
>(key_material_1.size()));
36 hash->update(key_material_1);
37 hash->update_be(
static_cast<uint64_t
>(key_material_2.size()));
38 hash->update(key_material_2);
46Stateful_Key_Index_Registry::RegistryMap::iterator Stateful_Key_Index_Registry::lookup(
const KeyId& key_id) {
47 auto [i, _inserted] = m_registry.emplace(key_id, 0);
53 auto idx = this->lookup(key_id);
59 auto idx = this->lookup(key_id);
60 const uint64_t cur = idx->second;
67 auto idx = this->lookup(key_id);
68 idx->second = std::max(idx->second, min);
73 const uint64_t idx = this->lookup(key_id)->second;
#define BOTAN_ASSERT_NOMSG(expr)
static std::unique_ptr< HashFunction > create_or_throw(std::string_view algo_spec, std::string_view provider="")
uint64_t current_index(const KeyId &key_id)
void set_index_lower_bound(const KeyId &key_id, uint64_t min)
static Stateful_Key_Index_Registry & global()
Stateful_Key_Index_Registry(const Stateful_Key_Index_Registry &)=delete
~Stateful_Key_Index_Registry()
uint64_t reserve_next_index(const KeyId &key_id)
uint64_t remaining_operations(const KeyId &key_id, uint64_t max)
secure_vector< T > lock(const std::vector< T > &in)
lock_guard< T > lock_guard_type