code wiki / _hdl_build / nx_tor_aes.nx

nx_tor_aes.nx

buildroot/runtime/_hdl_build/nx_tor_aes.nx

2746 B53 linesdepth 4pulls 4 transitivereach 3 importersview sourcekind librarytopic tor
docsdependenciesstructsconstsfunctions

about

nx_tor_aes.nx -- AES-128-CTR for the Tor RELAY-cell cipher (tor-spec sec.5.5). THIN wrapper over the existing FIPS-197 AES-128 core (nx_aes.nx): the ONLY difference from nx_aes_ctr.nx is a FULL 128-bit big-endian counter increment (OpenSSL/Tor semantics) instead of the 32-bit low-word increment -- Tor's relay cipher is a CONTINUOUS keystream across many cells, so (a) the counter must carry past byte 12, and (b) it must advance every block INCLUDING the last so the next call/cell resumes at the right block. IV for relay use = 16 zero bytes; the per-hop key Kf/Kb comes from the ntor KDF (Phase 1). Reuses aes128_expand_key + aes128_encrypt_block; no new cipher. Gated vs NIST SP 800-38A F.5.1/F.5.2. license_tier: ORIGINAL

dependencies 2 imports · 2 importers

nx_syscalls.nx nx_aes.nx nx_tor_aes.nx nx_tor_aes_gate.nx nx_tor_relay.nx

imports: nx_syscalls.nxnx_aes.nx

imported by: nx_tor_aes_gate.nxnx_tor_relay.nx

structs

none

consts

none

functions

14func tor_ctr_inc128(ctr: *u8) -> i64
25func tor_aes128_ctr_crypt(sched: *u8, ctr16: *u8, in_buf: *u8, in_len: i64, out_buf: *u8) -> i64
47func tor_aes128_ctr(key16: *u8, iv16: *u8, in_buf: *u8, in_len: i64, out_buf: *u8) -> i64