mod aes128_ctr;
mod aes128_gcm;
mod aes192_ctr;
mod aes192_gcm;
mod aes256_ctr;
mod aes256_gcm;
mod bytes;
mod none;
mod string;
const KEY: [u8; 32] = [b'x'; 32];
const IV: [u8; 16] = [b'y'; 16];
macro_rules! ctx_test {
($name:ident, $cipher:ident . $method:ident, $num:literal, [ $($input:literal),* ] -> [ $($expected:literal),* ]) => {
#[test]
fn $name() {
use crate::cipher::tests::{IV, KEY};
use crate::cipher::CipherContext;
let key_len = Cipher::$cipher.key_len();
let input = [$($input),*];
let expected = [$($expected),*];
let mut ctx = CipherContext::new(Cipher::$cipher);
ctx.copy_from_slice($num, &input);
let output = ctx.$method(&KEY[..key_len], &IV).unwrap();
assert_eq!(output, expected);
}
};
}
pub(crate) use ctx_test;