projects
/
rust-lightning
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add KeysInterface::get_node_id method
[rust-lightning]
/
lightning
/
src
/
util
/
chacha20poly1305rfc.rs
diff --git
a/lightning/src/util/chacha20poly1305rfc.rs
b/lightning/src/util/chacha20poly1305rfc.rs
index 1dbd91e65e0488168f59d439cdd4565f8d56803f..3254e8b0134d298517fcc9095792fb48c9935b50 100644
(file)
--- a/
lightning/src/util/chacha20poly1305rfc.rs
+++ b/
lightning/src/util/chacha20poly1305rfc.rs
@@
-74,6
+74,11
@@
mod real_chachapoly {
self.mac.raw_result(out_tag);
}
self.mac.raw_result(out_tag);
}
+ pub fn encrypt_full_message_in_place(&mut self, input_output: &mut [u8], out_tag: &mut [u8]) {
+ self.encrypt_in_place(input_output);
+ self.finish_and_get_tag(out_tag);
+ }
+
// Encrypt `input_output` in-place. To finish and calculate the tag, use `finish_and_get_tag`
// below.
pub(super) fn encrypt_in_place(&mut self, input_output: &mut [u8]) {
// Encrypt `input_output` in-place. To finish and calculate the tag, use `finish_and_get_tag`
// below.
pub(super) fn encrypt_in_place(&mut self, input_output: &mut [u8]) {
@@
-284,6
+289,11
@@
mod fuzzy_chachapoly {
self.finished = true;
}
self.finished = true;
}
+ pub fn encrypt_full_message_in_place(&mut self, input_output: &mut [u8], out_tag: &mut [u8]) {
+ self.encrypt_in_place(input_output);
+ self.finish_and_get_tag(out_tag);
+ }
+
pub(super) fn encrypt_in_place(&mut self, _input_output: &mut [u8]) {
assert!(self.finished == false);
}
pub(super) fn encrypt_in_place(&mut self, _input_output: &mut [u8]) {
assert!(self.finished == false);
}
@@
-325,7
+335,7
@@
mod tests {
use util::ser::{self, FixedLengthReader, LengthReadableArgs, Writeable};
// Used for for testing various lengths of serialization.
use 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<u8>,
field2: Vec<u8>,
struct TestWriteable {
field1: Vec<u8>,
field2: Vec<u8>,