mirror of
https://gitlab.redox-os.org/CoffeeCode/redox-ssh.git
synced 2025-12-28 15:22:18 +01:00
Literally just inserts `dyn` keywords. This was deprecated but accepted in Rust 2015 but is a hard error in Rust 2021!
24 lines
576 B
Rust
24 lines
576 B
Rust
use crypto::aes::{KeySize, ctr};
|
|
use crypto::symmetriccipher::SynchronousStreamCipher;
|
|
|
|
use encryption::Encryption;
|
|
|
|
pub struct AesCtr {
|
|
cipher: Box<dyn SynchronousStreamCipher + 'static>,
|
|
}
|
|
|
|
impl AesCtr {
|
|
pub fn new(key: &[u8], iv: &[u8]) -> AesCtr {
|
|
AesCtr { cipher: ctr(KeySize::KeySize256, key, &iv[0..16]) }
|
|
}
|
|
}
|
|
|
|
impl Encryption for AesCtr {
|
|
fn encrypt(&mut self, data: &[u8], buf: &mut [u8]) {
|
|
self.cipher.process(data, buf);
|
|
}
|
|
|
|
fn decrypt(&mut self, data: &[u8], buf: &mut [u8]) {
|
|
self.cipher.process(data, buf);
|
|
}
|
|
}
|