Encrypt+MAC most P2P messages in-place 2022-09-fix-msg-send
authorMatt Corallo <git@bluematt.me>
Mon, 12 Sep 2022 15:20:37 +0000 (15:20 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 12 Sep 2022 18:06:52 +0000 (18:06 +0000)
commit45ec1db2e04cc1c8b142dbeccf85d9c62dbe8da5
tree385be5d6d14788b688f8d4eabdef048fce246db4
parent8ec92f5b6bb2b204708252427b1fd6835f358c58
Encrypt+MAC most P2P messages in-place

For non-gossip-broadcast messages, our current flow is to first
serialize the message into a `Vec`, and then allocate a new `Vec`
into which we write the encrypted+MAC'd message and header.

This is somewhat wasteful, and its rather simple to instead
allocate only one buffer and encrypt the message in-place.
fuzz/src/peer_crypt.rs
lightning/src/ln/peer_channel_encryptor.rs
lightning/src/ln/peer_handler.rs
lightning/src/util/chacha20poly1305rfc.rs