mod aes;
pub(crate) mod blowfish;
mod cbc;
mod ccm;
mod cfb;
mod chacha20;
mod chacha20poly1305;
mod ctr;
mod des;
mod gcm;
mod kw;
mod ofb;
mod poly1305;
pub(crate) mod salsa20;
mod xts;
pub use aes::{Aes128, Aes192, Aes256};
pub use cbc::Cbc;
pub use ccm::{Aes128Ccm, Aes128Ccm8, Aes192Ccm, Aes256Ccm, Aes256Ccm8, Ccm};
pub use cfb::Cfb;
pub use chacha20::ChaCha20;
pub use chacha20poly1305::ChaCha20Poly1305;
pub use ctr::Ctr;
pub use des::{Cbc64, Des, TdesEde2, TdesEde3};
pub use gcm::{Aes128Gcm, Aes256Gcm, Gcm};
pub use kw::{
Aes128Kw, Aes128Kwp, Aes192Kw, Aes192Kwp, Aes256Kw, Aes256Kwp, AesKw, AesKwp, KwError,
kw_ciphertext_len, kwp_ciphertext_len,
};
pub use ofb::Ofb;
pub use poly1305::Poly1305;
pub use xts::{Aes128Xts, Aes256Xts, Xts};
pub trait BlockCipher {
const BLOCK_SIZE: usize;
const KEY_SIZE: usize;
fn encrypt_block(&self, block: &mut [u8; 16]);
fn decrypt_block(&self, block: &mut [u8; 16]);
}
pub trait BlockCipher64 {
const KEY_SIZE: usize;
fn encrypt_block(&self, block: &mut [u8; 8]);
fn decrypt_block(&self, block: &mut [u8; 8]);
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct InvalidLength;
impl core::fmt::Display for InvalidLength {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.write_str("input length is not a multiple of the block size")
}
}
impl core::error::Error for InvalidLength {}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct TagMismatch;
impl core::fmt::Display for TagMismatch {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.write_str("AEAD authentication tag mismatch")
}
}
impl core::error::Error for TagMismatch {}