ZeroTierOne/third_party/kyber/src/error.rs
Adam Ierymenko 07fc8b2d2b
rustfmt
2022-09-13 10:48:36 -04:00

19 lines
784 B
Rust

#[derive(Debug, PartialEq)]
/// Error types for the failure modes
pub enum KyberError {
/// One or more inputs to a function are incorrectly sized. A likely cause of this is two parties using different security
/// levels while trying to negotiate a key exchange.
InvalidInput,
/// The ciphertext was unable to be authenticated.
/// The shared secret was not decapsulated.
Decapsulation,
}
impl core::fmt::Display for KyberError {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match *self {
KyberError::InvalidInput => write!(f, "Function input is of incorrect length"),
KyberError::Decapsulation => write!(f, "Decapsulation Failure, unable to obtain shared secret from ciphertext"),
}
}
}