Skip to content

Commit

Permalink
lms/definitions: Minor rework
Browse files Browse the repository at this point in the history
  • Loading branch information
aewag committed Sep 3, 2024
1 parent 382b3b6 commit 11d52e2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/lms/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ impl<H: HashChain> LmsPrivateKey<H> {

pub fn use_lmots_private_key(&mut self) -> Result<LmotsPrivateKey<H>, ()> {
let number_of_lm_ots_keys = {
if let Some(my_sst_ext) = &self.sst_ext {
// our last leafs function returns 0..total_num-1, but here we need 1..total_num
1 + get_sst_last_leaf_idx(&self.lms_parameter, my_sst_ext)
if let Some(sst_ext) = &self.sst_ext {
// last leaf idx is total_num-1, hence add 1
get_sst_last_leaf_idx(&self.lms_parameter, sst_ext) as usize + 1
} else {
self.lms_parameter.number_of_lm_ots_keys() as u32
self.lms_parameter.number_of_lm_ots_keys()
}
};

if self.used_leafs_index >= number_of_lm_ots_keys {
if self.used_leafs_index as usize >= number_of_lm_ots_keys {
return Err(());
}

Expand Down

0 comments on commit 11d52e2

Please sign in to comment.