Ed25519 self-signature in NODEINFO + fix sync sequence and zero-key bug
Add x25519_self_sig[64] to TOPOMSG_NODE/TOPO_NODE: - topo_node.h: add field to both structs (wire format + memory) - topo_node.c: compute Ed25519_sign(ed25519_privkey, x25519_pubkey) for own node - topo_node.c: serialize/deserialize x25519_self_sig - topo_group.c: verify Ed25519 self-sig on NODEINFO receive, reject forgery Fix Ed25519 pubkey zero-key bug: - topo_node_sqlite.c: get_ed25519_pubkey rejects all-zero key (MUST be non-zero) Delay db_sync until Ed25519 key is available: - db_sync.c: db_sync_on_conn_up checks db_get_ed25519_pubkey before starting - db_sync.c: db_sync_peer_check_cb also checks Ed25519 key availability - This prevents sync starting before NODEINFO with verified Ed25519 arrives
This commit is contained in:
1 parent
3890d2038d
commit
85269d1da3
5 files changed
+32
-6
No files matched your search
@@ -555,7 +555,7 @@ int topo_node_sqlite_get_ed25519_pubkey(sqlite3* db, uint64_t node_id, uint8_t p
|
||||
if (sqlite3_step(stmt) == SQLITE_ROW) {
|
||||
const void* b = sqlite3_column_blob(stmt, 0);
|
||||
int bytes = sqlite3_column_bytes(stmt, 0);
|
||||
if (b && bytes >= 32) { memcpy(pubkey_out, b, 32); rc = 0; }
|
||||
if (b && bytes >= 32) { uint64_t chk; memcpy(&chk, b, 8); if (chk != 0) { memcpy(pubkey_out, b, 32); rc = 0; } }
|
||||
}
|
||||
sqlite3_finalize(stmt);
|
||||
return rc;
|
||||
|
||||
Reference in new issue
Block a user