From b34400dbd55a340b3ff6ace3b39081a6977d209b Mon Sep 17 00:00:00 2001 From: Michele Esposito Date: Sat, 2 Dec 2023 02:02:42 +0100 Subject: [PATCH] fix: keystream seeker --- cipher/src/chacha20/core.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cipher/src/chacha20/core.rs b/cipher/src/chacha20/core.rs index bf2e2da..be5190b 100644 --- a/cipher/src/chacha20/core.rs +++ b/cipher/src/chacha20/core.rs @@ -78,9 +78,9 @@ pub fn chacha20_rounds(out: &mut [u32; 16], add: Option<[u32; 16]>) { pub fn seek_keystream(state: &[u32; 16], n: u64) -> [u32; 16] { let mut state = state.clone(); - let mut keystream = state; - safe_2words_counter_increment_n(&mut state[12..14], n); + + let mut keystream = state; chacha20_rounds(&mut keystream, Some(state)); keystream