updated comment

This commit is contained in:
mamoniot 2022-12-27 10:25:17 -05:00
parent fb20bbc538
commit 402cf69b72

View file

@ -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;