diff --git a/src/lib/pubkey/hss_lms/hss.cpp b/src/lib/pubkey/hss_lms/hss.cpp index 45da5fd5404..c31749e1e54 100644 --- a/src/lib/pubkey/hss_lms/hss.cpp +++ b/src/lib/pubkey/hss_lms/hss.cpp @@ -57,11 +57,12 @@ constexpr bool is_supported_hash_function(std::string_view hash_name) { std::vector derive_lms_leaf_indices_from_hss_index(HSS_Sig_Idx hss_idx, const HSS_LMS_Params& hss_params) { std::vector q(hss_params.L().get()); - for(int8_t layer_ctr = hss_params.L().get() - 1; layer_ctr >= 0; --layer_ctr) { + for(int32_t layer_ctr = hss_params.L().get() - 1; layer_ctr >= 0; --layer_ctr) { HSS_Level layer(layer_ctr); const HSS_LMS_Params::LMS_LMOTS_Params_Pair& layer_params = hss_params.params_at_level(layer); size_t layer_h = layer_params.lms_params().h(); - q.at(layer.get()) = LMS_Tree_Node_Idx(hss_idx.get() % (1UL << layer_h)); + auto tmp = hss_idx.get(); + q.at(layer.get()) = LMS_Tree_Node_Idx(static_cast(hss_idx.get() % (1UL << layer_h))); hss_idx = hss_idx >> layer_h; } BOTAN_ARG_CHECK(hss_idx == HSS_Sig_Idx(0), "HSS Tree is exhausted"); diff --git a/src/lib/pubkey/hss_lms/hss.h b/src/lib/pubkey/hss_lms/hss.h index 4d9799d0c15..cb511545f10 100644 --- a/src/lib/pubkey/hss_lms/hss.h +++ b/src/lib/pubkey/hss_lms/hss.h @@ -37,7 +37,7 @@ using HSS_Level = Strong(m_lms_lmots_params.size()); } + HSS_Level L() const { return HSS_Level(m_lms_lmots_params.size()); } /** * @brief The maximal number of signatures allowed for these HSS parameters @@ -122,7 +122,7 @@ class HSS_LMS_Params final { * Note that the format is not specified in the RFC 8554, * and is Botan specific. */ -class HSS_LMS_PrivateKeyInternal final { +class BOTAN_TEST_API HSS_LMS_PrivateKeyInternal final { public: /** * @brief Create an internal HSS-LMS private key. @@ -239,7 +239,7 @@ class HSS_Signature; * Format according to RFC 8554: * u32str(L) || pub[0] */ -class HSS_LMS_PublicKeyInternal final { +class BOTAN_TEST_API HSS_LMS_PublicKeyInternal final { public: /** * @brief Create the public HSS-LMS key from its private key. @@ -318,7 +318,7 @@ class HSS_LMS_PublicKeyInternal final { * Format according to RFC 8554: * u32str(Nspk) || sig[0] || pub[1] || ... || sig[Nspk-1] || pub[Nspk] || sig[Nspk] */ -class HSS_Signature final { +class BOTAN_TEST_API HSS_Signature final { public: /** * @brief A LMS public key signed by the HSS layer above it. diff --git a/src/lib/pubkey/hss_lms/lm_ots.h b/src/lib/pubkey/hss_lms/lm_ots.h index 4063fb7299d..7be3bf6d071 100644 --- a/src/lib/pubkey/hss_lms/lm_ots.h +++ b/src/lib/pubkey/hss_lms/lm_ots.h @@ -99,7 +99,7 @@ enum class LMOTS_Algorithm_Type : uint32_t { * * See RFC 8554 Section 4.1. */ -class LMOTS_Params { +class BOTAN_TEST_API LMOTS_Params { public: /** * @brief Create the LM-OTS parameters from a known algorithm type. @@ -172,7 +172,7 @@ class LMOTS_Params { /** * @brief Representation of a LM-OTS signature. */ -class LMOTS_Signature { +class BOTAN_TEST_API LMOTS_Signature { public: /** * @brief Parse a LM-OTS signature. @@ -216,7 +216,7 @@ class LMOTS_Signature { * @brief Base class for LMOTS private and public key. Contains the parameters for * the specific OTS instance */ -class OTS_Instance { +class BOTAN_TEST_API OTS_Instance { public: /** * @brief Constructor storing the specific OTS parameters @@ -251,7 +251,7 @@ class OTS_Instance { * Contains the OTS params, I, q, the secret LMS seed and its derived * secret chain inputs (x[] in RFC 8554 4.2) */ -class LMOTS_Private_Key : public OTS_Instance { +class BOTAN_TEST_API LMOTS_Private_Key : public OTS_Instance { public: /** * @brief Derive a LMOTS private key for a given @p seed. @@ -300,7 +300,7 @@ class LMOTS_Private_Key : public OTS_Instance { * * u32str(type) || I || u32str(q) || K */ -class LMOTS_Public_Key : public OTS_Instance { +class BOTAN_TEST_API LMOTS_Public_Key : public OTS_Instance { public: /** * @brief Derivivation of an LMOTS public key using an LMOTS_Private_Key as defined diff --git a/src/lib/pubkey/hss_lms/lms.h b/src/lib/pubkey/hss_lms/lms.h index 52c94f53a2a..31a875e6fe6 100644 --- a/src/lib/pubkey/hss_lms/lms.h +++ b/src/lib/pubkey/hss_lms/lms.h @@ -86,7 +86,7 @@ using LMS_Signature_Bytes = Strong, struct LMS_Signature_By * * See RFC 8554 Section 5.1. */ -class LMS_Params { +class BOTAN_TEST_API LMS_Params { public: /** * @brief Create the LMS parameters from a known algorithm type. @@ -143,7 +143,7 @@ class LMS_Params { * @brief Base class for LMS private and public key. Contains public data associated with this * LMS instance. */ -class LMS_Instance { +class BOTAN_TEST_API LMS_Instance { public: /** * @brief Constructor storing the provided LMS data. @@ -182,7 +182,7 @@ class LMS_PublicKey; * Contains the secret seed used for OTS key derivation * as described in RFC 8554 Appendix A. */ -class LMS_PrivateKey : public LMS_Instance { +class BOTAN_TEST_API LMS_PrivateKey : public LMS_Instance { public: /** * @brief Construct storing the LMS instance data and the secret seed @@ -217,7 +217,7 @@ class LMS_Signature; * Format according to RFC 8554: * u32str(type) || u32str(otstype) || I || T[1] */ -class LMS_PublicKey : public LMS_Instance { +class BOTAN_TEST_API LMS_PublicKey : public LMS_Instance { public: /** * @brief Parse a public LMS key. @@ -283,7 +283,7 @@ class LMS_PublicKey : public LMS_Instance { * * Contains a method for secure signature parsing. */ -class LMS_Signature { +class BOTAN_TEST_API LMS_Signature { public: /** * @brief Parse the bytes of a lms signature into a LMS Signature object