diff --git a/src/hash_to_curve/expand_msg.rs b/src/hash_to_curve/expand_msg.rs index 9f6192d3..2b9beca6 100644 --- a/src/hash_to_curve/expand_msg.rs +++ b/src/hash_to_curve/expand_msg.rs @@ -248,6 +248,10 @@ where if ell > 255 { panic!("Invalid ExpandMsgXmd usage: ell > 255"); } + if len_in_bytes > u16::MAX as usize { + panic!("Invalid ExpandMsgXmd usage: len_in_bytes > u16::MAX"); + } + let dst = ExpandMsgDst::for_xmd::(dst); let mut hash_b_0 = H::default().chain(GenericArray::::BlockSize>::default());