12#include <botan/internal/ct_utils.h>
13#include <botan/internal/lm_ots.h>
104 static LMS_Params create_or_throw(std::string_view hash_name, uint8_t h);
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; }
129 std::unique_ptr<HashFunction>
hash()
const {
return HashFunction::create_or_throw(hash_name()); }
144 std::string m_hash_name;
157 m_lms_params(std::move(lms_params)),
158 m_lmots_params(std::move(lmots_params)),
159 m_identifier(std::move(identifier)) {}
196 LMS_Instance(std::move(lms_params), std::move(lmots_params), std::move(I)), m_seed(std::move(seed)) {}
251 std::vector<uint8_t> to_bytes()
const;
256 static size_t size(
const LMS_Params& lms_params);
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;
Representation of a LM-OTS signature.
Base class for LMS private and public key. Contains public data associated with this LMS instance.
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.
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)
void _const_time_unpoison() const
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.
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.
LMS_Algorithm_Type
Enum of available LMS algorithm types.
constexpr size_t LMS_IDENTIFIER_LEN
The length in bytes of the LMS identifier (I).
bool verify_signature(std::span< const uint8_t, ED448_LEN > pk, bool phflag, std::span< const uint8_t > context, std::span< const uint8_t > sig, std::span< const uint8_t > msg)
Verify a signature(RFC 8032 5.2.7)