diff --git a/src/constants.rs b/src/constants.rs index bacea1a3..e2975ecc 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -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; diff --git a/src/hss/mod.rs b/src/hss/mod.rs index f542b9ef..cd7db949 100644 --- a/src/hss/mod.rs +++ b/src/hss/mod.rs @@ -293,7 +293,7 @@ pub fn hss_keygen( 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}, @@ -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..] ); } @@ -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!( diff --git a/src/hss/reference_impl_private_key.rs b/src/hss/reference_impl_private_key.rs index 6956b8bb..8c1bbbac 100644 --- a/src/hss/reference_impl_private_key.rs +++ b/src/hss/reference_impl_private_key.rs @@ -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, }, @@ -125,7 +125,7 @@ impl ReferenceImplPrivateKey { 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);