Skip to content

Commit dde2c82

Browse files
joostjagerclaude
andcommitted
fuzz: fix ChaCha20 encrypt_single_block to preserve data
The fuzzing ChaCha20 implementation's encrypt_single_block was not copying src to dest, causing encrypted data to be lost (dest remained zeros). This broke payment flows where metadata is encrypted into payment_secret - the receiver would decrypt zeros and detect the wrong payment method (LdkPaymentHash instead of UserPaymentHash), causing payments to fail with "mismatching preimage". Fix by making encrypt_single_block copy src to dest (identity encryption), matching the behavior of the process() method. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 7fcfb39 commit dde2c82

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

lightning/src/crypto/chacha20.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ mod fuzzy_chacha {
321321
) {
322322
debug_assert_eq!(dest.len(), src.len());
323323
debug_assert!(dest.len() <= 32);
324+
dest.copy_from_slice(src);
324325
}
325326

326327
pub fn encrypt_single_block_in_place(

0 commit comments

Comments
 (0)