Fix crash when device has no keys to verify

This commit is contained in:
Nicolas Werner 2022-08-13 18:01:16 +02:00
parent 242b7d5506
commit 1cfbac4c92
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
1 changed files with 8 additions and 0 deletions

View File

@ -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),