1use crate::chacha::Key;
4use crate::{ChaChaCore, R20};
5use cipher::{
6 IvSizeUser, KeyIvInit, KeySizeUser, StreamCipherCoreWrapper,
7 array::Array,
8 consts::{U8, U32},
9};
10
11pub type LegacyNonce = Array<u8, U8>;
13use crate::variants::Legacy;
14
15pub type ChaCha20Legacy = StreamCipherCoreWrapper<ChaCha20LegacyCore>;
17
18pub type ChaCha20LegacyCore = ChaChaCore<R20, Legacy>;
20
21impl KeySizeUser for ChaCha20LegacyCore {
22 type KeySize = U32;
23}
24
25impl IvSizeUser for ChaCha20LegacyCore {
26 type IvSize = U8;
27}
28
29impl KeyIvInit for ChaCha20LegacyCore {
30 #[inline(always)]
31 fn new(key: &Key, iv: &LegacyNonce) -> Self {
32 ChaChaCore::<R20, Legacy>::new_internal(key.as_ref(), iv.as_ref())
33 }
34}