X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Futil%2Fchacha20.rs;h=dd90b20f694587f754e1f6e7fe16ecc13db4892d;hb=d7ac68701f6d169438b0337919fde7c715b2e94c;hp=7bab9c1e386d7d96b5ff4c0416feac0c7a1e2a75;hpb=09c7f2f641d2496c2a6280b032f62b6249298a0f;p=rust-lightning diff --git a/src/util/chacha20.rs b/src/util/chacha20.rs index 7bab9c1e..dd90b20f 100644 --- a/src/util/chacha20.rs +++ b/src/util/chacha20.rs @@ -13,7 +13,6 @@ mod real_chacha { use std::cmp; use util::byte_utils::{slice_to_le32, le32_to_array}; - use crypto::symmetriccipher::SynchronousStreamCipher; #[derive(Clone, Copy, PartialEq, Eq)] #[allow(non_camel_case_types)] @@ -224,10 +223,8 @@ mod real_chacha { self.offset = 0; } - } - impl SynchronousStreamCipher for ChaCha20 { - fn process(&mut self, input: &[u8], output: &mut [u8]) { + pub fn process(&mut self, input: &[u8], output: &mut [u8]) { assert!(input.len() == output.len()); let len = input.len(); let mut i = 0; @@ -258,8 +255,6 @@ pub use self::real_chacha::ChaCha20; #[cfg(feature = "fuzztarget")] mod fuzzy_chacha { - use crypto::symmetriccipher::SynchronousStreamCipher; - pub struct ChaCha20 {} impl ChaCha20 { @@ -268,10 +263,8 @@ mod fuzzy_chacha { assert!(nonce.len() == 8 || nonce.len() == 12); Self {} } - } - impl SynchronousStreamCipher for ChaCha20 { - fn process(&mut self, input: &[u8], output: &mut [u8]) { + pub fn process(&mut self, input: &[u8], output: &mut [u8]) { output.copy_from_slice(input); } } @@ -284,7 +277,6 @@ mod test { use std::iter::repeat; use super::ChaCha20; - use crypto::symmetriccipher::SynchronousStreamCipher; #[test] fn test_chacha20_256_tls_vectors() {