hbs_lms/lms/
mod.rs

1use crate::hasher::HashChain;
2use crate::hss::aux::MutableExpandedAuxData;
3use crate::hss::parameter::HssParameter;
4use crate::hss::reference_impl_private_key::SeedAndLmsTreeIdentifier;
5use crate::lms::definitions::LmsPrivateKey;
6use crate::lms::definitions::LmsPublicKey;
7
8pub mod definitions;
9mod helper;
10pub mod parameters;
11pub mod signing;
12pub mod verify;
13
14pub struct LmsKeyPair<H: HashChain> {
15    pub private_key: LmsPrivateKey<H>,
16    pub public_key: LmsPublicKey<H>,
17}
18
19pub fn generate_key_pair<H: HashChain>(
20    seed: &SeedAndLmsTreeIdentifier<H>,
21    parameter: &HssParameter<H>,
22    used_leafs_index: &u32,
23    aux_data: &mut Option<MutableExpandedAuxData>,
24) -> LmsKeyPair<H> {
25    let lmots_parameter = parameter.get_lmots_parameter();
26    let lms_parameter = parameter.get_lms_parameter();
27
28    let private_key = LmsPrivateKey::new(
29        seed.seed.clone(),
30        seed.lms_tree_identifier,
31        *used_leafs_index,
32        *lmots_parameter,
33        *lms_parameter,
34    );
35    let public_key = LmsPublicKey::new(&private_key, aux_data);
36
37    LmsKeyPair {
38        private_key,
39        public_key,
40    }
41}