|
Botan 3.13.0
Crypto and TLS for C&
|
#include <stateful_key_index_registry.h>
Classes | |
| class | KeyId |
Public Member Functions | |
| uint64_t | current_index (const KeyId &key_id) |
| Stateful_Key_Index_Registry & | operator= (const Stateful_Key_Index_Registry &)=delete |
| Stateful_Key_Index_Registry & | operator= (Stateful_Key_Index_Registry &&)=delete |
| uint64_t | remaining_operations (const KeyId &key_id) |
| std::optional< uint64_t > | reserve_next_index (const KeyId &key_id) |
| void | set_index_lower_bound (const KeyId &key_id, uint64_t min) |
| Stateful_Key_Index_Registry (const Stateful_Key_Index_Registry &)=delete | |
| Stateful_Key_Index_Registry (Stateful_Key_Index_Registry &&)=delete | |
| ~Stateful_Key_Index_Registry () | |
Static Public Member Functions | |
| static Stateful_Key_Index_Registry & | global () |
A process-wide registry mapping stateful key identity to a shared monotonic counter. Ensures that independent copies of the same key material (e.g. deserialized separately) share a single leaf index, preventing catastrophic one-time signature reuse.
The same key material used with different algorithm parameters is tracked independently, since the parameters are part of the key identity. The maximum operation count is a function of the identity.
Used by XMSS and HSS-LMS.
If this registry or a key identity is inherited across fork(), it fails closed and refuses to issue further indices in the child process.
Definition at line 36 of file stateful_key_index_registry.h.
|
delete |
References Stateful_Key_Index_Registry().
Referenced by global(), operator=(), operator=(), Stateful_Key_Index_Registry(), Stateful_Key_Index_Registry(), and ~Stateful_Key_Index_Registry().
|
delete |
References Stateful_Key_Index_Registry().
|
default |
References Stateful_Key_Index_Registry().
| uint64_t Botan::Stateful_Key_Index_Registry::current_index | ( | const KeyId & | key_id | ) |
Return the current counter
Definition at line 122 of file stateful_key_index_registry.cpp.
References Botan::lock().
Referenced by Botan::HSS_LMS_PrivateKeyInternal::to_bytes().
|
static |
Retrieve the process-wide instance
Definition at line 18 of file stateful_key_index_registry.cpp.
References Stateful_Key_Index_Registry().
Referenced by Botan::HSS_LMS_PrivateKeyInternal::remaining_operations(), Botan::HSS_LMS_PrivateKeyInternal::set_idx(), and Botan::HSS_LMS_PrivateKeyInternal::to_bytes().
|
delete |
References Stateful_Key_Index_Registry().
|
delete |
References Stateful_Key_Index_Registry().
| uint64_t Botan::Stateful_Key_Index_Registry::remaining_operations | ( | const KeyId & | key_id | ) |
If the current counter is >= the key's maximum returns 0, otherwise maximum - counter
Definition at line 146 of file stateful_key_index_registry.cpp.
References Botan::lock(), and Botan::Stateful_Key_Index_Registry::KeyId::max_operations().
| std::optional< uint64_t > Botan::Stateful_Key_Index_Registry::reserve_next_index | ( | const KeyId & | key_id | ) |
Reserve and return the next counter value, or nullopt if the counter has already reached the key's maximum. The counter never increments past the maximum, so it cannot wrap, and an exhausted key remains exhausted.
Definition at line 128 of file stateful_key_index_registry.cpp.
References Botan::lock(), and Botan::Stateful_Key_Index_Registry::KeyId::max_operations().
| void Botan::Stateful_Key_Index_Registry::set_index_lower_bound | ( | const KeyId & | key_id, |
| uint64_t | min ) |
Set the counter to at least min (but if already higher it will retain its current value)
Definition at line 139 of file stateful_key_index_registry.cpp.
References BOTAN_ARG_CHECK, Botan::lock(), and Botan::Stateful_Key_Index_Registry::KeyId::max_operations().
Referenced by Botan::HSS_LMS_PrivateKeyInternal::set_idx().