interplane.Get Omega
Read in your language

omnet

aien-dev/omnet

Brought by drakestapleton

branch main Branches Tags History

omnet / om / tka / README.md

129 lines · 9838 bytes Raw Blame History Source

Bounded Tailnet Key Authority

Omega implementation of the typed AUM, Key, State and AUM Signature models, signature authorization, state transitions, and an in-memory authority DAG. Behavior is pinned to Tailscale v1.102.0, particularly aum.go, key.go, state.go, tka.go, and sync.go. No production Go code or node-key-signature implementation is included here. Node-key signatures belong to om/tkasig.

Composition

Concatenate om/blake2s/blake2s.om, om/sha512/sha512.om, om/ed25519/ed25519.om, om/cbor/cbor.om, tka.om, tkastate.om, and, for the authority API, tkapool.om, before the caller. The first two TKA files are global-free functions. Include the pool companion only once. There is no filesystem, daemon, persistence, compaction, network configuration, or concurrency in this unit. Callers serialize pool access and persist a successful transaction before publishing it.

Model API

Unless stated otherwise, byte buffers have capacity 65536 and lengths are ulong. Lengths 0–65536 are successful; errors are 65537 (typed CBOR), 65538 (resource limit), 65539 (static validation), 65540 (signature), 65541 (parent/key/state), 65542 (not initialized, transaction misuse, or no sync intersection). Success/error must be checked before consuming output.

Internal token helpers require a successfully normalized model and successful cbrdec; they are not hostile-byte entry points. Public lengths are checked before CBOR or cryptographic calls. The cryptographic implementation is variable-time and has not been constant-time audited.

Authority API

Two independent authority slots permit bounded in-process synchronization. tkaselect(slot) selects 0 or 1 (returns 0 or resource error). tkareset() explicitly clears the selected slot. A slot holds 128 immutable AUM nodes, each with up to 65536 encoded AUM bytes and 65536 state bytes. The two slots reserve approximately 32 MiB plus metadata globally; fixed-size per-operation scratch lives on the Omega stack. State keys are bounded at 512 (including AddKey), disablement values at 32, and key metadata at 512 UTF-8 bytes. Input CBOR retains its existing depth16/array4096/map1024 limits. These are resource errors where tighter than upstream; no eviction or hidden history truncation occurs.

The fork rule is highest unique signer vote sum, then RemoveKey over non-RemoveKey, then lowest canonical AUM hash bytewise. Cached state at every node makes arbitrary retained-branch state lookup bounded, and avoids replay during signature verification. A checkpoint can replace keys and disablement values but cannot change the authority IDs.

Tests

Run TKA_GO=/path/to/go1.26.8 sh om/tka/test/run.sh /path/to/pinned/omc from the repository. tools/omc.sh supplies the pinned compiler when omitted. Requirements: ARM64 Linux, Python3, POSIX shell, Go>=1.26.5, and dependencies pinned in test/oracle/go.mod and go.sum.

The Go oracle imports the real pinned tailscale.com/tka and emits deterministic commands and expected records. The Omega driver executes those same commands. Scenarios cover bootstrap and later-checkpoint bootstrap, add/update/remove/checkpoint, state lookup, StateID rejection, unknown kinds, untrusted and invalid signatures, unknown parents, batch rollback, duplicates, vote and hash fork ties, last-key removal, sync intersections, exact ancestor sampling boundaries, and convergence. Explicit bounded-profile cases check 128-node exhaustion, capacity-failure rollback, and rejection of a 513th key. Existing CBOR structure/hostile/fuzz AUM and State corpora are re-judged through the typed model (not merely generic CBOR well-formedness). A signature-verification mutant must run to normal completion with the same record count and at least one changed result; traps, signals, or an incomplete run fail the harness. The focused suite was executed with Go1.26.8 and the pinned compiler: **PASS, 10,691 differential records**, and the signature mutant completed all 10,691 records with four differences. The separate cross-unit revocation driver also completed successfully: a direct node signature authorizes after bootstrap and rejects after its trusted key is removed by a signed AUM.

test/revocation.om is compiled with both authority and node-signature units by the harness. The oracle's --fixture mode emits JSON with hex genesis, removal, signature, and raw32-byte node fields. It constructs the signed pubkey through upstream NodePublic.MarshalBinary (including the np prefix) and asserts upstream authorization before, and rejection after, revocation. For standalone use: run go run -mod=readonly . --fixture in test/oracle.

Fixed-array hash decoding follows upstream padding/truncation semantics, while byte slices preserve nil versus empty for serialization. Static key-ID equality follows Go bytes.Equal, which treats nil and empty as equal; these semantics have dedicated typed-model cases. An empty-but-present update metadata map is exercised through explicit wire bytes: it clears metadata, then replay of its canonically omitted form is accepted by the already-stored hash without revalidating the now-missing update field. The corpus also exercises all 256 simple-number encodings in seven typed destinations. As upstream fxamacker fillPositiveInt specifies, major7 simple values with additional-information0–19 or24 populate unsigned fields and byte-array elements; Boolean values remain type errors, and null or undefined leave zero values.

Third-party material and notices

Protocol behavior and translated algorithms derive from Tailscale v1.102.0, commit 35283c95445fb198af1ce708dac05714bdfaa037, fetched2026-10-25. Copyright Tailscale Inc & contributors, BSD-3-Clause; the upstream notice is shipped verbatim in tailscale.LICENSE. The Go decoder options are transcribed from tka/tka.go and covered by that notice. Other Go code is only an external test oracle. Shared CBOR vectors retain their provenance and notices in om/cbor.