X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Futil%2Fchacha20poly1305rfc.rs;h=a5bec2c82b8cf00da2a597d3c68026aa7e87152f;hb=a61746246c369dada11469c25dd739f4807c042b;hp=5fddb57eb36a0c1a2d119baeabd7d0a757509ee6;hpb=45ec1db2e04cc1c8b142dbeccf85d9c62dbe8da5;p=rust-lightning diff --git a/lightning/src/util/chacha20poly1305rfc.rs b/lightning/src/util/chacha20poly1305rfc.rs index 5fddb57e..a5bec2c8 100644 --- a/lightning/src/util/chacha20poly1305rfc.rs +++ b/lightning/src/util/chacha20poly1305rfc.rs @@ -10,14 +10,14 @@ // This is a port of Andrew Moons poly1305-donna // https://github.com/floodyberry/poly1305-donna -use ln::msgs::DecodeError; -use util::ser::{FixedLengthReader, LengthRead, LengthReadableArgs, Readable, Writeable, Writer}; -use io::{self, Read, Write}; +use crate::ln::msgs::DecodeError; +use crate::util::ser::{FixedLengthReader, LengthRead, LengthReadableArgs, Readable, Writeable, Writer}; +use crate::io::{self, Read, Write}; #[cfg(not(fuzzing))] mod real_chachapoly { - use util::chacha20::ChaCha20; - use util::poly1305::Poly1305; + use crate::util::chacha20::ChaCha20; + use crate::util::poly1305::Poly1305; use bitcoin::hashes::cmp::fixed_time_eq; #[derive(Clone, Copy)] @@ -228,7 +228,6 @@ impl<'a, T: Writeable> Writeable for ChaChaPolyWriteAdapter<'a, T> { /// Enables the use of the serialization macros for objects that need to be simultaneously decrypted and /// deserialized. This allows us to avoid an intermediate Vec allocation. pub(crate) struct ChaChaPolyReadAdapter { - #[allow(unused)] // This will be used soon for onion messages pub readable: R, } @@ -330,21 +329,21 @@ pub use self::fuzzy_chachapoly::ChaCha20Poly1305RFC; #[cfg(test)] mod tests { - use ln::msgs::DecodeError; + use crate::ln::msgs::DecodeError; use super::{ChaChaPolyReadAdapter, ChaChaPolyWriteAdapter}; - use util::ser::{self, FixedLengthReader, LengthReadableArgs, Writeable}; + use crate::util::ser::{self, FixedLengthReader, LengthReadableArgs, Writeable}; // Used for for testing various lengths of serialization. - #[derive(Debug, PartialEq)] + #[derive(Debug, PartialEq, Eq)] struct TestWriteable { field1: Vec, field2: Vec, field3: Vec, } impl_writeable_tlv_based!(TestWriteable, { - (1, field1, vec_type), - (2, field2, vec_type), - (3, field3, vec_type), + (1, field1, required_vec), + (2, field2, required_vec), + (3, field3, required_vec), }); #[test] @@ -412,7 +411,7 @@ mod tests { #[test] fn chacha_stream_adapters_ser_macros() { // Test that our stream adapters work as expected with the TLV macros. - // This also serves to test the `option: $trait` variant of the `decode_tlv` ser macro. + // This also serves to test the `option: $trait` variant of the `_decode_tlv` ser macro. do_chacha_stream_adapters_ser_macros().unwrap() } }