hkdf/
errors.rs

1use core::fmt;
2
3/// Error that is returned when supplied pseudorandom key (PRK) is not long enough.
4#[derive(Copy, Clone, Debug)]
5pub struct InvalidPrkLength;
6
7impl fmt::Display for InvalidPrkLength {
8    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
9        f.write_str("invalid pseudorandom key length, too short")
10    }
11}
12
13#[cfg(feature = "std")]
14#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
15impl ::std::error::Error for InvalidPrkLength {}
16
17/// Structure for InvalidLength, used for output error handling.
18#[derive(Copy, Clone, Debug)]
19pub struct InvalidLength;
20
21impl fmt::Display for InvalidLength {
22    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
23        f.write_str("invalid number of blocks, too large output")
24    }
25}
26
27#[cfg(feature = "std")]
28#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
29impl ::std::error::Error for InvalidLength {}