Skip to content

Commit e196e3c

Browse files
committed
Use a 12-byte nonce as an input to Chacha20-Poly1305
Previously, we were using the Chacha20-Poly1305 implementation at `rust-lightning/lightning/src/crypto/chacha20poly1305rfc.rs`. That implementation required us to use an 8-byte nonce. Since we made the switch to the `rust-bitcoin/chacha20_poly1305` implementation, we can now use a full 12-byte nonce as specified in the RFC.
1 parent 5067abc commit e196e3c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/util/storable_builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl<T: EntropySource> StorableBuilder<T> {
4747
&self, input: Vec<u8>, version: i64, data_encryption_key: &[u8; 32], aad: &[u8],
4848
) -> Storable {
4949
let mut nonce = [0u8; NONCE_LENGTH];
50-
self.entropy_source.fill_bytes(&mut nonce[4..]);
50+
self.entropy_source.fill_bytes(&mut nonce);
5151

5252
let mut data_blob = PlaintextBlob { value: input, version }.encode_to_vec();
5353

0 commit comments

Comments
 (0)