12#include <botan/internal/ct_utils.h>
13#include <botan/internal/lm_ots.h>
89class LMS_Params final {
114 uint8_t
h()
const {
return m_h; }
119 size_t m()
const {
return m_m; }
124 const std::string&
hash_name()
const {
return m_hash_name; }
144 std::string m_hash_name;
251 std::vector<uint8_t>
to_bytes()
const;
285 LMS_Tree_Node m_lms_root;
340 m_q(q), m_lmots_sig(std::move(lmots_sig)), m_lms_type(lms_type), m_auth_path(std::move(auth_path)) {}
342 LMS_Tree_Node_Idx m_q;
343 LMOTS_Signature m_lmots_sig;
344 LMS_Algorithm_Type m_lms_type;
345 LMS_AuthenticationPath m_auth_path;
static std::unique_ptr< HashFunction > create_or_throw(std::string_view algo_spec, std::string_view provider="")
Representation of a LM-OTS signature.
const LMS_Params & lms_params() const
The LMS parameters for this LMS instance.
const LMOTS_Params & lmots_params() const
The LMOTS parameters used for OTS instances of this LMS instance.
const LMS_Identifier & identifier() const
The identifier of this LMS tree ('I' in RFC 8554)
LMS_Instance(LMS_Params lms_params, LMOTS_Params lmots_params, LMS_Identifier identifier)
Constructor storing the provided LMS data.
const std::string & hash_name() const
Returns the name of the hash function to use.
size_t m() const
Returns the number of bytes associated with each node.
std::unique_ptr< HashFunction > hash() const
Construct a new hash instance for the LMS instance.
LMS_Algorithm_Type algorithm_type() const
Retuns the LMS algorithm type.
uint8_t h() const
Returns the height of the LMS tree.
static LMS_Params create_or_throw(LMS_Algorithm_Type type)
Create the LMS parameters from a known algorithm type.
Representation of an LMS Private key.
LMS_PrivateKey(LMS_Params lms_params, LMOTS_Params lmots_params, LMS_Identifier I, LMS_Seed seed)
Construct storing the LMS instance data and the secret seed.
const LMS_Seed & seed() const
The secret seed used for LMOTS' WOTS chain input creation (RFC 8554 Appendix A)
static size_t size(const LMS_Params &lms_params)
The expected size of an LMS public key for given lms_params.
std::vector< uint8_t > to_bytes() const
Bytes of the full lms public key according to 8554 5.3.
static LMS_PublicKey from_bytes_or_throw(BufferSlicer &slicer)
Parse a public LMS key.
void _const_time_unpoison() const
LMS_PublicKey(LMS_Params lms_params, LMOTS_Params lmots_params, LMS_Identifier I, LMS_Tree_Node lms_root)
Construct a public key for given public key data.
bool verify_signature(const LMS_Message &msg, const LMS_Signature &sig) const
Verify a LMS signature.
Container for LMS Signature data.
const LMOTS_Signature & lmots_sig() const
The LMOTS signature object containing the parsed LMOTS signature bytes contained in the LMS signature...
LMS_Tree_Node_Idx q() const
The index of the signing leaf given by the signature.
static LMS_Signature from_bytes_or_throw(BufferSlicer &slicer)
Parse the bytes of a lms signature into a LMS Signature object.
LMS_Algorithm_Type lms_type() const
The LMS algorithm type given by the signature.
StrongSpan< const LMS_AuthenticationPath > auth_path() const
The authentication path bytes given by the signature.
constexpr void unpoison(const T *p, size_t n)
LMS_Algorithm_Type
Enum of available LMS algorithm types.
constexpr size_t LMS_IDENTIFIER_LEN
The length in bytes of the LMS identifier (I).
Strong< std::vector< uint8_t >, struct LMS_Tree_Node_ > LMS_Tree_Node
A node with the LMS tree.
Strong< std::vector< uint8_t >, struct LMS_Signature_Bytes_ > LMS_Signature_Bytes
Raw bytes of an LMS signature.
Strong< std::vector< uint8_t >, struct LMS_AuthenticationPath_ > LMS_AuthenticationPath
The authentication path of an LMS signature.
Strong< std::vector< uint8_t >, struct LMS_Identifier_ > LMS_Identifier
The identifier of an LMS tree (I in RFC 8554)
Strong< secure_vector< uint8_t >, struct LMS_SEED_ > LMS_Seed
Seed of the LMS tree, used to generate the LM-OTS private keys.
Strong< std::vector< uint8_t >, struct LMS_Message_ > LMS_Message
A message that is signed with an LMS tree.
Strong< uint32_t, struct LMS_Tree_Node_Idx_, EnableArithmeticWithPlainNumber > LMS_Tree_Node_Idx
The index of a node within a specific LMS tree layer.