android: voice messages + attachments architecture plan, build fixes
This commit is contained in:
1 parent
f8d7c21a79
commit
e751e6ee69
17 files changed
+299
-329
No files matched your search
+3
-6
@@ -10,7 +10,7 @@
|
||||
#include "../../lib/debug_config.h"
|
||||
#include "../../lib/mem.h"
|
||||
#include "../../lib/u_async.h"
|
||||
#include "../../lib/sha256.h"
|
||||
#include <openssl/sha.h>
|
||||
#include "../../lib/sqlite3.h"
|
||||
#include "../../lib/platform_compat.h"
|
||||
#include <string.h>
|
||||
@@ -131,10 +131,7 @@ static void db_sqlite_close(struct DB_SYNC* db)
|
||||
|
||||
static void db_sha256(const uint8_t* data, size_t len, uint8_t hash[32])
|
||||
{
|
||||
SC_SHA256_CTX ctx;
|
||||
sc_sha256_init(&ctx);
|
||||
sc_sha256_update(&ctx, data, len);
|
||||
sc_sha256_final(&ctx, hash);
|
||||
SHA256(data, len, hash);
|
||||
}
|
||||
|
||||
static uint64_t db_hash64(const uint8_t* data, size_t len)
|
||||
@@ -1220,7 +1217,7 @@ static void db_sync_recv_cb(struct ETCP_CONN* conn, struct ll_entry* entry)
|
||||
const char* tbl = (const char*)sqlite3_column_text(st, 0);
|
||||
const char* ch_id = (const char*)sqlite3_column_text(st, 1);
|
||||
if (!ch_id || !ch_id[0]) continue;
|
||||
uint64_t h; { uint8_t sh[32]; SC_SHA256_CTX ctx; sc_sha256_init(&ctx); sc_sha256_update(&ctx, (const uint8_t*)ch_id, strlen(ch_id)); sc_sha256_final(&ctx, sh); memcpy(&h, sh, 8); }
|
||||
uint64_t h; { uint8_t sh[32]; SHA256((const uint8_t*)ch_id, strlen(ch_id), sh); memcpy(&h, sh, 8); }
|
||||
if (h == hash) {
|
||||
si = db_sync_instance_add(db->inst, tbl, hash, 1);
|
||||
if (si) { si_peer_add(si, src); }
|
||||
|
||||
Reference in new issue
Block a user