diff --git a/zssp/src/counter.rs b/zssp/src/counter.rs index 828785220..7dc479d53 100644 --- a/zssp/src/counter.rs +++ b/zssp/src/counter.rs @@ -95,8 +95,8 @@ impl CounterWindow { #[inline(always)] pub fn message_authenticated(&self, received_counter_value: u32) -> bool { - //if a valid message is received but one of its fragments was lost, it can technically be replayed, since the message is incomplete, we know it still exists in the gather array, so the gather array will deduplicate the replayed message - //eventually the counter of that message will be too OOO to be accepted anymore so it can't be used to DOS + //if a valid message is received but one of its fragments was lost, it can technically be replayed. However since the message is incomplete, we know it still exists in the gather array, so the gather array will deduplicate the replayed message. Even if the gather array gets flushed, that flush still effectively deduplicates the replayed message. + //eventually the counter of that kind of message will be too OOO to be accepted anymore so it can't be used to DOS. let idx = (received_counter_value % COUNTER_MAX_ALLOWED_OOO as u32) as usize; if self.1.swap((u32::MAX/4 < received_counter_value) & (received_counter_value <= u32::MAX/4*3), Ordering::SeqCst) { return self.2[idx].fetch_max(received_counter_value, Ordering::SeqCst) < received_counter_value;