projects
/
rust-lightning
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use `impl<bounds>` instead of a `where` clause to help bindings
[rust-lightning]
/
lightning
/
src
/
util
/
chacha20poly1305rfc.rs
diff --git
a/lightning/src/util/chacha20poly1305rfc.rs
b/lightning/src/util/chacha20poly1305rfc.rs
index 3908116cccc85f03624c73cdb73d2ead507f0712..e0e155ced4cdf0499fd4e7ede0feb41174c40543 100644
(file)
--- a/
lightning/src/util/chacha20poly1305rfc.rs
+++ b/
lightning/src/util/chacha20poly1305rfc.rs
@@
-10,14
+10,12
@@
// This is a port of Andrew Moons poly1305-donna
// https://github.com/floodyberry/poly1305-donna
// This is a port of Andrew Moons poly1305-donna
// https://github.com/floodyberry/poly1305-donna
-#[cfg(not(f
eature = "fuzztarget"
))]
+#[cfg(not(f
uzzing
))]
mod real_chachapoly {
use util::chacha20::ChaCha20;
use util::poly1305::Poly1305;
use bitcoin::hashes::cmp::fixed_time_eq;
mod real_chachapoly {
use util::chacha20::ChaCha20;
use util::poly1305::Poly1305;
use bitcoin::hashes::cmp::fixed_time_eq;
- use util::byte_utils;
-
#[derive(Clone, Copy)]
pub struct ChaCha20Poly1305RFC {
cipher: ChaCha20,
#[derive(Clone, Copy)]
pub struct ChaCha20Poly1305RFC {
cipher: ChaCha20,
@@
-67,8
+65,8
@@
mod real_chachapoly {
self.mac.input(output);
ChaCha20Poly1305RFC::pad_mac_16(&mut self.mac, self.data_len);
self.finished = true;
self.mac.input(output);
ChaCha20Poly1305RFC::pad_mac_16(&mut self.mac, self.data_len);
self.finished = true;
- self.mac.input(&
byte_utils::le64_to_array(self.aad_len
));
- self.mac.input(&
byte_utils::le64_to_array(self.data_len as u64
));
+ self.mac.input(&
self.aad_len.to_le_bytes(
));
+ self.mac.input(&
(self.data_len as u64).to_le_bytes(
));
self.mac.raw_result(out_tag);
}
self.mac.raw_result(out_tag);
}
@@
-82,8
+80,8
@@
mod real_chachapoly {
self.data_len += input.len();
ChaCha20Poly1305RFC::pad_mac_16(&mut self.mac, self.data_len);
self.data_len += input.len();
ChaCha20Poly1305RFC::pad_mac_16(&mut self.mac, self.data_len);
- self.mac.input(&
byte_utils::le64_to_array(self.aad_len
));
- self.mac.input(&
byte_utils::le64_to_array(self.data_len as u64
));
+ self.mac.input(&
self.aad_len.to_le_bytes(
));
+ self.mac.input(&
(self.data_len as u64).to_le_bytes(
));
let mut calc_tag = [0u8; 16];
self.mac.raw_result(&mut calc_tag);
let mut calc_tag = [0u8; 16];
self.mac.raw_result(&mut calc_tag);
@@
-96,10
+94,10
@@
mod real_chachapoly {
}
}
}
}
}
}
-#[cfg(not(f
eature = "fuzztarget"
))]
+#[cfg(not(f
uzzing
))]
pub use self::real_chachapoly::ChaCha20Poly1305RFC;
pub use self::real_chachapoly::ChaCha20Poly1305RFC;
-#[cfg(f
eature = "fuzztarget"
)]
+#[cfg(f
uzzing
)]
mod fuzzy_chachapoly {
#[derive(Clone, Copy)]
pub struct ChaCha20Poly1305RFC {
mod fuzzy_chachapoly {
#[derive(Clone, Copy)]
pub struct ChaCha20Poly1305RFC {
@@
-143,5
+141,5
@@
mod fuzzy_chachapoly {
}
}
}
}
}
}
-#[cfg(f
eature = "fuzztarget"
)]
+#[cfg(f
uzzing
)]
pub use self::fuzzy_chachapoly::ChaCha20Poly1305RFC;
pub use self::fuzzy_chachapoly::ChaCha20Poly1305RFC;