Skip to content

Commit

Permalink
WIP test
Browse files Browse the repository at this point in the history
  • Loading branch information
aewag committed Sep 3, 2024
1 parent dbff88f commit fff50c6
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions src/hss/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::{
signing::LmsSignature,
},
sst::helper::get_subtree_node_idx,
sst::parameters::SstExtension,
//sst::parameters::SstExtension,
util::helper::read_and_advance,
};

Expand All @@ -44,29 +44,31 @@ impl<H: HashChain> HssPrivateKey<H> {
pub fn from(
private_key: &ReferenceImplPrivateKey<H>,
aux_data: &mut Option<MutableExpandedAuxData>,
tree_identifier: Option<&[u8; ILEN]>,
_tree_identifier: Option<&[u8; ILEN]>,
) -> Result<Self, ()> {
let mut hss_private_key: HssPrivateKey<H> = Default::default();

let mut current_seed = private_key.generate_root_seed_and_lms_tree_identifier();

if let Some(tree_identifier) = tree_identifier {
current_seed
.lms_tree_identifier
.clone_from_slice(tree_identifier);
}
//if let Some(tree_identifier) = tree_identifier {
// current_seed
// .lms_tree_identifier
// .clone_from_slice(tree_identifier);
//}

let parameters = private_key.compressed_parameter.to::<H>()?;
let used_leafs_indexes = private_key.compressed_used_leafs_indexes.to(&parameters);

let mut sst_ext_option = None;
let sst_ext = SstExtension {
signing_entity_idx: private_key.sst_ext.signing_entity_idx,
l0_top_div: private_key.sst_ext.l0_top_div,
};
if private_key.sst_ext.signing_entity_idx != 0 {
sst_ext_option = Some(sst_ext);
}
//let sst_ext = SstExtension {
// signing_entity_idx: private_key.sst_ext.signing_entity_idx,
// l0_top_div: private_key.sst_ext.l0_top_div,
//};
let sst_ext_option = None;
//let sst_ext_option = if sst_ext != SstExtension::default() {
// Some(sst_ext)
//} else {
// None
//};

let lms_private_key = LmsPrivateKey {
seed: current_seed.seed.clone(),
Expand Down

0 comments on commit fff50c6

Please sign in to comment.