Skip to content

Commit

Permalink
Rename to HSS_COMPRESSED_USED_LEAFS_SIZE
Browse files Browse the repository at this point in the history
  • Loading branch information
aewag committed Sep 2, 2024
1 parent ec6ffa0 commit 437109c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ pub const fn prng_len(seed_len: usize) -> usize {
23 + seed_len
}

pub const LMS_LEAF_IDENTIFIERS_SIZE: usize = 8;
pub const HSS_COMPRESSED_USED_LEAFS_SIZE: usize = 8;
pub const REF_IMPL_MAX_ALLOWED_HSS_LEVELS: usize = 8;
pub const REF_IMPL_MAX_PRIVATE_KEY_SIZE: usize =
LMS_LEAF_IDENTIFIERS_SIZE + REF_IMPL_MAX_ALLOWED_HSS_LEVELS + MAX_SEED_LEN;
HSS_COMPRESSED_USED_LEAFS_SIZE + REF_IMPL_MAX_ALLOWED_HSS_LEVELS + MAX_SEED_LEN;

pub const MAX_HASH_SIZE: usize = 32;
pub const MAX_HASH_BLOCK_SIZE: usize = 64;
Expand Down
8 changes: 4 additions & 4 deletions src/hss/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ pub fn hss_keygen<H: HashChain>(
mod tests {
use crate::util::helper::test_helper::gen_random_seed;
use crate::{
constants::{LMS_LEAF_IDENTIFIERS_SIZE, MAX_HASH_SIZE},
constants::{HSS_COMPRESSED_USED_LEAFS_SIZE, MAX_HASH_SIZE},
hasher::{
sha256::{Sha256_128, Sha256_192, Sha256_256},
shake256::{Shake256_128, Shake256_192, Shake256_256},
Expand Down Expand Up @@ -338,8 +338,8 @@ mod tests {

assert_ne!(signing_key.as_slice(), signing_key_const.as_slice());
assert_eq!(
signing_key.as_slice()[LMS_LEAF_IDENTIFIERS_SIZE..],
signing_key_const.as_slice()[LMS_LEAF_IDENTIFIERS_SIZE..]
signing_key.as_slice()[HSS_COMPRESSED_USED_LEAFS_SIZE..],
signing_key_const.as_slice()[HSS_COMPRESSED_USED_LEAFS_SIZE..]
);
}

Expand All @@ -366,7 +366,7 @@ mod tests {

for index in 0..keypair_lifetime {
assert_eq!(
signing_key.as_slice()[..LMS_LEAF_IDENTIFIERS_SIZE],
signing_key.as_slice()[..HSS_COMPRESSED_USED_LEAFS_SIZE],
index.to_be_bytes(),
);
assert_eq!(
Expand Down
4 changes: 2 additions & 2 deletions src/hss/reference_impl_private_key.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
constants::{
LmsTreeIdentifier, D_TOPSEED, ILEN, LMS_LEAF_IDENTIFIERS_SIZE, MAX_ALLOWED_HSS_LEVELS,
LmsTreeIdentifier, D_TOPSEED, ILEN, HSS_COMPRESSED_USED_LEAFS_SIZE, MAX_ALLOWED_HSS_LEVELS,
MAX_HASH_SIZE, MAX_SEED_LEN, REF_IMPL_MAX_PRIVATE_KEY_SIZE, SEED_CHILD_SEED,
SEED_SIGNATURE_RANDOMIZER_SEED, TOPSEED_D, TOPSEED_LEN, TOPSEED_SEED, TOPSEED_WHICH,
},
Expand Down Expand Up @@ -125,7 +125,7 @@ impl<H: HashChain> ReferenceImplPrivateKey<H> {
let mut index = 0;

let compressed_used_leafs_indexes =
read_and_advance(data, LMS_LEAF_IDENTIFIERS_SIZE, &mut index);
read_and_advance(data, HSS_COMPRESSED_USED_LEAFS_SIZE, &mut index);
result.compressed_used_leafs_indexes =
CompressedUsedLeafsIndexes::from_slice(compressed_used_leafs_indexes);

Expand Down

0 comments on commit 437109c

Please sign in to comment.