diff --git a/zssp/src/tests.rs b/zssp/src/tests.rs index 0b0f65fce..96e4e62bb 100644 --- a/zssp/src/tests.rs +++ b/zssp/src/tests.rs @@ -209,7 +209,7 @@ mod tests { ) .is_ok()); } - if (test_loop % 8) == 0 && test_loop >= 8 && host.this_name.eq("alice") { + if (test_loop % 8) == 0 && test_loop >= 8 { session.service(host, send_to_other, &[], mtu_buffer.len(), test_loop as i64, true); } } diff --git a/zssp/src/zssp.rs b/zssp/src/zssp.rs index bf1fcf3ce..8025fb3f8 100644 --- a/zssp/src/zssp.rs +++ b/zssp/src/zssp.rs @@ -773,7 +773,7 @@ impl ReceiveContext { // Check rate limits. if let Some(session) = session.as_ref() { - if (current_time - session.state.read().unwrap().last_remote_offer) < Application::REKEY_RATE_LIMIT_MS { + if current_time < session.state.read().unwrap().last_remote_offer + Application::REKEY_RATE_LIMIT_MS { return Err(Error::RateLimited); } } else { @@ -867,7 +867,7 @@ impl ReceiveContext { if let Some(k) = state.session_keys[key_id as usize].as_ref() { if k.role == Role::Bob { // The local party is not allowed to be Bob twice in a row - // this prevents rekeying failure from both parties attempting to rekey at the same time + // This prevents rekeying failure from both parties attempting to rekey at the same time return Ok(ReceiveResult::Ignored); } if public_fingerprint_of_secret(k.ratchet_key.as_bytes())[..16].eq(alice_ratchet_key_fingerprint) {