code wiki / _hdl_build / nx_tor_relay.nx
nx_tor_relay.nx
buildroot/runtime/_hdl_build/nx_tor_relay.nx
about
nx_tor_relay.nx -- Tor circuit-handshake + RELAY-cell payloads (tor-spec sec.5.1/sec.5.1.2/sec.6.1).
Phase 3 onion layer: CREATE2/CREATED2 (wrap the Phase-1 ntor onion skin), the RELAY cell format with
its running digest + recognized field, per-hop AES-128-CTR onion (de)cryption, and EXTEND2/EXTENDED2
for multi-hop circuit build. STRUCTURAL (no live relay); composes nx_tor_cell + nx_tor_aes + nx_sha1.
HONEST SCOPE: this is the cell/onion FRAMING + the recognized/digest mechanism, gated byte-exact and by
round-trip/self-consistency. The running digest here is SHA-1(Df_seed || payload) per cell (equivalent to
Tor's stateful running digest for the first cell); byte-exact interop vs a live relay is a later phase.
anon_is_anonymizing() stays 0. license_tier: ORIGINAL
dependencies 4 imports · 1 importers
imports: nx_syscalls.nxnx_tor_cell.nxnx_tor_aes.nxnx_sha1.nx
imported by: nx_tor_relay_gate.nx
structs
| none |
consts
| 16 | const TOR_HTYPE_NTOR: i64 = 2 |
| 18 | const TOR_RELAY_BEGIN: i64 = 1 |
| 19 | const TOR_RELAY_DATA: i64 = 2 |
| 20 | const TOR_RELAY_END: i64 = 3 |
| 21 | const TOR_RELAY_EXTEND2: i64 = 14 |
| 22 | const TOR_RELAY_EXTENDED2: i64 = 15 |
| 24 | const TOR_LS_IPV4: i64 = 0 |
| 25 | const TOR_LS_IPV6: i64 = 1 |
| 26 | const TOR_LS_LEGACY_ID: i64 = 2 |
| 27 | const TOR_LS_ED25519: i64 = 3 |
| 29 | const TOR_RELAY_HDR: i64 = 11 // relay_cmd(1) recognized(2) streamid(2) digest(4) length(2) |
| 31 | const TOR_E_SHORT: i64 = 0 - 1 |
| 32 | const TOR_E_FORMAT: i64 = 0 - 2 |
functions
| 36 | func tor_build_create2(htype: i64, hdata: *u8, hlen: i64, out: *u8) -> i64 |
| 44 | func tor_parse_create2(pl: *u8, pllen: i64, out_htype: *i64, out_hlen: *i64, out_hoff: *i64) -> i64 |
| 53 | func tor_build_created2(hdata: *u8, hlen: i64, out: *u8) -> i64 |
| 59 | func tor_parse_created2(pl: *u8, pllen: i64, out_hlen: *i64, out_hoff: *i64) -> i64 |
| 69 | func tor_running_digest4(df_seed: *u8, payload509: *u8, out4: *u8) -> i64 |
| 81 | func tor_relay_build(relay_cmd: i64, streamid: i64, data: *u8, dlen: i64, df_seed: *u8, out509: *u8) -> i64 |
| 98 | func tor_relay_recognized(pl509: *u8, df_seed: *u8) -> i64 |
| 110 | func tor_onion_crypt(kf16: *u8, in509: *u8, out509: *u8) -> i64 |
| 117 | func tor_ls_ipv4(ip4: *u8, port: i64, out: *u8) -> i64 |
| 124 | func tor_ls_legacy_id(id20: *u8, out: *u8) -> i64 called by 1: main |
| 131 | func tor_build_extend2(nspec: i64, specs: *u8, specs_len: i64, htype: i64, hdata: *u8, hlen: i64, out: *u8) -> i64 |
| 144 | func tor_parse_extend2(pl: *u8, pllen: i64, out_nspec: *i64, out_htype: *i64, out_hlen: *i64, out_hoff: *i64) -> i64 |