LMS on 0.1.0-rc.2 breaks at compile-time when the bigger types (HLen >= 15) are being used.
Apparently, it breaks because hybrid-array does not support sizes used by the type TreeLen in modes.rs.
Adding this type (U65535) into hybrid-array does let it compile, but it seems to cause a Stack Overflow at runtime when compiled in dev mode.
I added the size for HLen = 15 to a local copy of hybrid-array by adding the below to sizes.rs.
diff --git a/src/sizes.rs b/src/sizes.rs
index 43cb00e..c07c1a1 100644
--- a/src/sizes.rs
+++ b/src/sizes.rs
@@ -864,6 +864,7 @@ mod extra_sizes {
pub type U2180 = uint!(0 0 1 0 0 0 0 1 0 0 0 1);
pub type U4292 = uint!(0 0 1 0 0 0 1 1 0 0 0 0 1);
pub type U8516 = uint!(0 0 1 0 0 0 1 0 1 0 0 0 0 1);
+ pub type U65535 = uint!(1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1);
// FrodoKEM640 sizes
@@ -1154,6 +1155,7 @@ mod extra_sizes {
2180 => U2180,
4292 => U4292,
8516 => U8516,
+ 65535 => U65535,
}
// Frodo sizes
My minimal example:
use lms_signature::lms::{LmsSha256M32H15, SigningKey};
use lms_signature::ots::LmsOtsSha256N32W2;
use getrandom::{SysRng, rand_core::UnwrapErr};
use signature::{RandomizedSignerMut, Verifier};
fn main() {
let mut rng = UnwrapErr(SysRng);
let mut sigkey = SigningKey::<LmsSha256M32H15<LmsOtsSha256N32W2>>::new(&mut rng);
let pubkey = sigkey.public();
let sig = sigkey.try_sign_with_rng(&mut rng, "example".as_bytes()).unwrap();
let sig_valid = pubkey.verify("example".as_bytes(), &sig).is_ok();
if sig_valid {
println!("Signature valid!");
} else {
println!("Signature invalid!");
}
}
Compiling with --release seems to work in my minimal example, although I don't know what may have been optimized out there.
LMS on 0.1.0-rc.2 breaks at compile-time when the bigger types (
HLen>= 15) are being used.Apparently, it breaks because hybrid-array does not support sizes used by the type
TreeLenin modes.rs.Adding this type (
U65535) into hybrid-array does let it compile, but it seems to cause a Stack Overflow at runtime when compiled in dev mode.I added the size for
HLen = 15to a local copy of hybrid-array by adding the below to sizes.rs.My minimal example:
Compiling with
--releaseseems to work in my minimal example, although I don't know what may have been optimized out there.