Diagnose admin key derivation failures without exposing secrets
This commit is contained in:
1 parent
49f47a8336
commit
1a293c436a
2 files changed
+4
-3
No files matched your search
@@ -32,10 +32,11 @@
|
||||
|
||||
static int ed25519_pub_from_priv(const uint8_t priv[32], uint8_t pub[32]) {
|
||||
EVP_PKEY* pkey = EVP_PKEY_new_raw_private_key(EVP_PKEY_ED25519, NULL, priv, 32);
|
||||
if (!pkey) return -1;
|
||||
if (!pkey) { DEBUG_ERROR(DEBUG_CATEGORY_CHAT_SYNC, "%s: Ed25519 private key initialization failed", CA_ID); return -1; }
|
||||
size_t plen = 32;
|
||||
int ok = EVP_PKEY_get_raw_public_key(pkey, pub, &plen) == 1 && plen == 32;
|
||||
EVP_PKEY_free(pkey);
|
||||
if (!ok) DEBUG_ERROR(DEBUG_CATEGORY_CHAT_SYNC, "%s: Ed25519 public key derivation failed bytes=%zu", CA_ID, plen);
|
||||
return ok ? 0 : -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ static void cleanup(struct fixture* f) {
|
||||
chat_event_set_handler(f->inst, NULL); active = NULL;
|
||||
utun_instance_destroy(f->inst); uasync_destroy(f->ua, 0);
|
||||
}
|
||||
/* Доставка собственной расшифрованной записи через зарегистрированный callback; сеть здесь не подменяется тестом отправки. */
|
||||
/* Доставка собственной расшифрованной записи через callback; сетевой путь и шифрование проверяются отдельно. */
|
||||
static void receive(struct fixture* f, uint64_t group, const uint8_t ed[32], const uint8_t x[32]) {
|
||||
struct ll_entry* e = ll_alloc_lldgram(ROUTER_SVC_HDR_SIZE + 72); assert(e);
|
||||
e->len = ROUTER_SVC_HDR_SIZE + 72; memset(e->dgram, 0, e->len);
|
||||
@@ -212,6 +212,6 @@ int main(void) {
|
||||
test_faults(); test_sql_and_replay(); test_outer_transaction(); test_rollback_failure();
|
||||
for (unsigned i = SAVEPOINT; i < FAULTS; i++) assert(hits[i] == (i == FINALIZE || i == RELEASE ? 3 : 2));
|
||||
assert(rollback_hits == 1 && u_get_allocated_count() == baseline);
|
||||
DEBUG_INFO(DEBUG_CATEGORY_CHAT_SYNC, "PASS admin: NULL context, 22 injected failures, no tracked allocations remain");
|
||||
DEBUG_INFO(DEBUG_CATEGORY_CHAT_SYNC, "PASS admin: NULL context, 22 SQL/crypto faults + rollback fault, allocations restored");
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user