summary refs log tree commit diff
path: root/src/encryption/DeviceVerificationFlow.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2022-06-12 19:09:07 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2022-06-12 19:09:07 +0200
commit62b3b461ec59b9b3ecd47d92b036d403359d229d (patch)
tree89c8e93628e19647a8b8d20d50f2096e84d6fc89 /src/encryption/DeviceVerificationFlow.cpp
parentProperly handle glare when verifying (diff)
downloadnheko-62b3b461ec59b9b3ecd47d92b036d403359d229d.tar.xz
Fix comparison for glare algorithm
Diffstat (limited to 'src/encryption/DeviceVerificationFlow.cpp')
-rw-r--r--src/encryption/DeviceVerificationFlow.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/encryption/DeviceVerificationFlow.cpp b/src/encryption/DeviceVerificationFlow.cpp

index 32473522..cc12bb9b 100644 --- a/src/encryption/DeviceVerificationFlow.cpp +++ b/src/encryption/DeviceVerificationFlow.cpp
@@ -15,6 +15,7 @@ #include <QDateTime> #include <QTimer> #include <iostream> +#include <tuple> static constexpr int TIMEOUT = 2 * 60 * 1000; // 2 minutes @@ -569,10 +570,10 @@ DeviceVerificationFlow::handleStartMessage(const mtx::events::msg::KeyVerificati this->canonical_json = nlohmann::json(msg); else { // resolve glare - if (utils::localUser().toStdString() > this->toClient.to_string() && - http::client()->device_id() > this->deviceId.toStdString()) { - // treat this as if the user with the smaller mxid and deviceid was the sender of - // "start" + if (std::tuple(this->toClient.to_string(), this->deviceId.toStdString()) < + std::tuple(utils::localUser().toStdString(), http::client()->device_id())) { + // treat this as if the user with the smaller mxid or smaller deviceid (if the mxid + // was the same) was the sender of "start" this->canonical_json = nlohmann::json(msg); this->sender = false; }