frodo_kem/
error.rs

1use thiserror::Error;
2
3/// The errors that can occur for FrodoKEM
4#[derive(Error, Copy, Clone, Debug)]
5pub enum Error {
6    /// The secret key length is invalid
7    #[error("Invalid secret key length: {0}")]
8    InvalidSecretKeyLength(usize),
9    /// The public key length is invalid
10    #[error("Invalid public key length: {0}")]
11    InvalidPublicKeyLength(usize),
12    /// The ciphertext length is invalid
13    #[error("Invalid ciphertext length: {0}")]
14    InvalidCiphertextLength(usize),
15    /// The shared secret length is invalid
16    #[error("Invalid shared secret length: {0}")]
17    InvalidSharedSecretLength(usize),
18    /// The message length is invalid
19    #[error("Invalid message length: {0}")]
20    InvalidMessageLength(usize),
21    /// Parsing string to algorithm
22    #[error("Unsupported algorithm")]
23    UnsupportedAlgorithm,
24}
25
26/// The result type for FrodoKEM
27pub type FrodoResult<T> = Result<T, Error>;