10#define BOTAN_LM_OTS_H_ 
   12#include <botan/hash.h> 
   13#include <botan/internal/stl_util.h> 
  125      size_t n()
 const { 
return m_n; }
 
  130      uint8_t 
w()
 const { 
return m_w; }
 
  135      uint8_t 
coef_max()
 const { 
return (1 << m_w) - 1; }
 
  140      uint16_t 
p()
 const { 
return m_p; }
 
  145      uint8_t 
ls()
 const { 
return m_ls; }
 
  150      const std::string& 
hash_name()
 const { 
return m_hash_name; }
 
  172      std::string m_hash_name;
 
 
  197      std::span<const uint8_t> 
C()
 const { 
return m_C; }
 
  213      std::vector<uint8_t> m_C;
 
  214      std::vector<uint8_t> m_y_buffer;
 
  215      std::vector<StrongSpan<const LMOTS_Node>> m_y;
 
 
  292      void derive_random_C(std::span<uint8_t> out, 
HashFunction& hash) 
const;
 
  295      std::vector<LMOTS_Node> m_ots_sk;
 
 
static std::unique_ptr< HashFunction > create_or_throw(std::string_view algo_spec, std::string_view provider="")
 
static LMOTS_Params create_or_throw(LMOTS_Algorithm_Type type)
Create the LM-OTS parameters from a known algorithm type.
 
uint8_t coef_max() const
The maximum the winternitz coefficients can have.
 
std::unique_ptr< HashFunction > hash() const
Construct a new hash instance for the OTS instance.
 
LMOTS_Algorithm_Type algorithm_type() const
Returns the LM-OTS algorithm type.
 
size_t n() const
The number of bytes of the output of the hash function.
 
uint8_t w() const
The width (in bits) of the Winternitz coefficients.
 
const std::string & hash_name() const
Name of the hash function to use.
 
uint8_t ls() const
The number of left-shift bits used in the checksum function Cksm.
 
uint16_t p() const
The number of n-byte string elements that make up the LM-OTS signature.
 
Representation of an LMOTS private key.
 
const LMOTS_Node & chain_input(uint16_t chain_idx) const
The secret chain input at a given chain index. (x[] in RFC 8554 4.2).
 
LMOTS_Private_Key(const LMOTS_Params ¶ms, const LMS_Identifier &identifier, LMS_Tree_Node_Idx q, const LMS_Seed &seed)
Derive a LMOTS private key for a given seed.
 
const LMOTS_K & K() const
The public key final hash value (K in RFC 8554 4.3 )
 
LMOTS_Public_Key(const LMOTS_Private_Key &lmots_sk)
Derivivation of an LMOTS public key using an LMOTS_Private_Key as defined in RFC 8554 4....
 
LMOTS_Public_Key(const LMOTS_Params ¶ms, const LMS_Identifier &identifier, LMS_Tree_Node_Idx q, LMOTS_K K)
Construct a new LMOTS public key object using the bytes.
 
Representation of a LM-OTS signature.
 
static size_t size(const LMOTS_Params ¶ms)
The expected size of the signature.
 
StrongSpan< const LMOTS_Node > y(uint16_t chain_idx) const
Returns the part of the signature for chain_idx.
 
LMOTS_Algorithm_Type algorithm_type() const
Returns the LM-OTS algorithm type.
 
static LMOTS_Signature from_bytes_or_throw(BufferSlicer &slicer)
Parse a LM-OTS signature.
 
std::span< const uint8_t > C() const
The n-byte randomizer of the signature.
 
const LMS_Identifier & identifier() const
The LMS identifier of the LMS tree containing this OTS instance ('I' in RFC 8554)
 
OTS_Instance(const LMOTS_Params ¶ms, const LMS_Identifier &identifier, LMS_Tree_Node_Idx q)
Constructor storing the specific OTS parameters.
 
LMS_Tree_Node_Idx q() const
The index of the LMS tree leaf associated with this OTS instance.
 
const LMOTS_Params & params() const
The LMOTS parameters.
 
auto at(size_type i) const
 
LMOTS_K lmots_compute_pubkey_from_sig(const LMOTS_Signature &sig, const LMS_Message &msg, const LMS_Identifier &identifier, LMS_Tree_Node_Idx q)
Compute a public key candidate for an OTS-signature-message pair and the OTS instance parameters.
 
Strong< std::vector< uint8_t >, struct LMOTS_K_ > LMOTS_K
The K value from the LM-OTS public key.
 
Strong< std::vector< uint8_t >, struct LMS_Identifier_ > LMS_Identifier
The identifier of an LMS tree (I in RFC 8554)
 
LMOTS_Algorithm_Type
Enum of available LM-OTS algorithm types.
 
Strong< secure_vector< uint8_t >, struct LMS_SEED_ > LMS_Seed
Seed of the LMS tree, used to generate the LM-OTS private keys.
 
Strong< secure_vector< uint8_t >, struct LMOTS_Node_ > LMOTS_Node
One node within one LM-OTS hash chain.
 
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.
 
Strong< std::vector< uint8_t >, struct LMOTS_Signature_Bytes_ > LMOTS_Signature_Bytes
Byte vector of an LM-OTS signature.