merge/upstream-full #105

Manually merged
jabber.developer merged 407 commits from merge/upstream-full into master 2026-05-26 17:54:34 +00:00
251 changed files with 7738 additions and 28598 deletions
Showing only changes of commit bc13a726b6 - Show all commits

View File

@@ -666,8 +666,13 @@ omemo_start_device_session(const char* const jid, uint32_t device_id,
}
int prekey_index;
size_t prekeys_len = g_list_length(prekeys);
if (prekeys_len == 0) {
log_error("[OMEMO] No prekeys found for %s device %d", jid, device_id);
goto out;
}
gcry_randomize(&prekey_index, sizeof(int), GCRY_STRONG_RANDOM);
prekey_index %= g_list_length(prekeys);
prekey_index %= prekeys_len;
omemo_key_t* prekey = g_list_nth_data(prekeys, prekey_index);
curve_decode_point(&prekey_public, prekey->data, prekey->length, omemo_ctx.signal);