crypto: Properly clamp the rotation period of the outbound session

master
Damir Jelić 2021-01-18 20:46:34 +01:00
parent d07063af2b
commit 4af9b74776
1 changed files with 3 additions and 3 deletions

View File

@ -22,7 +22,7 @@ use matrix_sdk_common::{
uuid::Uuid, uuid::Uuid,
}; };
use std::{ use std::{
cmp::min, cmp::max,
fmt, fmt,
sync::{ sync::{
atomic::{AtomicBool, AtomicU64, Ordering}, atomic::{AtomicBool, AtomicU64, Ordering},
@ -279,9 +279,9 @@ impl OutboundGroupSession {
count >= self.settings.rotation_period_msgs count >= self.settings.rotation_period_msgs
|| self.creation_time.elapsed() || self.creation_time.elapsed()
// Since the encryption settings are provided by users and not // Since the encryption settings are provided by users and not
// checked someone could set a really low rotation perdiod so // checked someone could set a really low rotation period so
// clamp it at a minute. // clamp it at a minute.
>= min(self.settings.rotation_period, Duration::from_secs(3600)) >= max(self.settings.rotation_period, Duration::from_secs(3600))
} }
/// Has the session been invalidated. /// Has the session been invalidated.