projects
/
rust-lightning
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rename APIError::MonitorUpdateFailed to MonitorUpdateInProgress
[rust-lightning]
/
lightning
/
src
/
util
/
chacha20poly1305rfc.rs
diff --git
a/lightning/src/util/chacha20poly1305rfc.rs
b/lightning/src/util/chacha20poly1305rfc.rs
index befe5d19f5f18f06454fd9140caf3fe026e9e8ec..5fddb57eb36a0c1a2d119baeabd7d0a757509ee6 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,12
+289,17
@@
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);
- self.finished = true;
}
pub(super) fn finish_and_get_tag(&mut self, out_tag: &mut [u8]) {
}
pub(super) fn finish_and_get_tag(&mut self, out_tag: &mut [u8]) {
+ assert!(self.finished == false);
out_tag.copy_from_slice(&self.tag);
self.finished = true;
}
out_tag.copy_from_slice(&self.tag);
self.finished = true;
}