summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2022-08-13 18:01:16 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2022-08-13 18:01:16 +0200
commit1cfbac4c92cca260f7c272ea9e0c74d6817820a8 (patch)
treeb2bc2804373c0f4611117da7907a32871973d369 /src
parentFix crash when fetching global profile (diff)
downloadnheko-1cfbac4c92cca260f7c272ea9e0c74d6817820a8.tar.xz
Fix crash when device has no keys to verify
Diffstat (limited to 'src')
-rw-r--r--src/Cache.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Cache.cpp b/src/Cache.cpp
index c2c59066..558eb334 100644
--- a/src/Cache.cpp
+++ b/src/Cache.cpp
@@ -4381,6 +4381,14 @@ Cache::updateUserKeys(const std::string &sync_token, const mtx::responses::Query
                             nhlog::crypto()->warn("device {}:{} has no signature", user, device_id);
                             continue;
                         }
+                        if (!device_keys.keys.count(device_signing_key) ||
+                            !device_keys.keys.count("curve25519:" + device_id)) {
+                            nhlog::crypto()->warn(
+                              "Device key has no curve25519 or ed25519 key  {}:{}",
+                              user,
+                              device_id);
+                            continue;
+                        }
 
                         if (!mtx::crypto::ed25519_verify_signature(
                               device_keys.keys.at(device_signing_key),