Merge pull request #1715 from TheBlueMatt/2022-09-fix-msg-send
[rust-lightning] / lightning / src / util / chacha20poly1305rfc.rs
index 1dbd91e65e0488168f59d439cdd4565f8d56803f..5fddb57eb36a0c1a2d119baeabd7d0a757509ee6 100644 (file)
@@ -74,6 +74,11 @@ mod real_chachapoly {
                        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]) {
@@ -284,6 +289,11 @@ mod fuzzy_chachapoly {
                        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);
                }