code wiki / (root) / nx_ssh_lib.nx

nx_ssh_lib.nx

buildroot/runtime/nx_ssh_lib.nx

21395 B497 linesdepth 9pulls 21 transitivereach 32 importersview sourcekind librarytopic ssh
docsdependenciesstructsconstsfunctions

about

nx_ssh_lib.nx -- shared core of the sovereign SSH-2 client: wire helpers, binary-packet framing, the curve25519-sha256 KEX (fills an SshState with the exchange hash H/session_id + mpint(K)), and the chacha20-poly1305@openssh.com encrypted transport. Composed by nx_ssh_kex (KEX proof) and nx_ssh_client (full session). Bits-up: our own X25519 / Ed25519 / SHA-256 / ChaCha20 / Poly1305. license_tier: ORIGINAL

dependencies 8 imports · 32 importers

nx_syscalls.nx nx_connect.nx nx_x25519_ephemeral.nx nx_ed25519_signature.nx nx_sha256.nx nx_chacha20.nx nx_poly1305.nx nx_base64.nx nx_ssh_lib.nx nx_aw_fetch.nx nx_aw_hostctl.nx nx_aw_lsdir.nx nx_aw_nasfix.nx nx_aw_nasrecon.nx nx_aw_push.nx nx_aw_routerfix.nx nx_aw_send.nx nx_aw_sftp.nx nx_aw_sudo.nx

diagram shows first 10 each side; +0 more imports, +22 more importers in the complete lists below.

imports: nx_syscalls.nxnx_connect.nxnx_x25519_ephemeral.nxnx_ed25519_signature.nxnx_sha256.nxnx_chacha20.nxnx_poly1305.nxnx_base64.nx

imported by: nx_aw_fetch.nxnx_aw_hostctl.nxnx_aw_lsdir.nxnx_aw_nasfix.nxnx_aw_nasrecon.nxnx_aw_push.nxnx_aw_routerfix.nxnx_aw_send.nxnx_aw_sftp.nxnx_aw_sudo.nxnx_cad_nas_probe.nxnx_edge_repoint.nxnx_fleet_doctor.nxnx_host_recover.nxnx_host_recover2.nxnx_hostdeploy.nxnx_inet_fetch_deploy.nxnx_put.nxnx_reader_diag.nxnx_router_ctl.nxnx_ssh_client.nxnx_ssh_cmd.nxnx_ssh_deploy.nxnx_ssh_deploy_page.nxnx_ssh_put.nxnx_ssh_put_lib.nxnx_ssh_putpage.nxnx_ssh_recon.nxnx_ssh_recon_docroot.nxnx_translate_deploy.nxnx_vroom_deploy.nxnx_vroom_html.nx

structs

27struct SshState

consts

19const SSH_MAGIC_4096: i64 = 4096
20const SSH_MAGIC_1024: i64 = 1024
21const SSH_MAGIC_65536: i64 = 65536
22const SSH_MAGIC_1048576: i64 = 1048576
23const SSH_MAGIC_16384: i64 = 16384
24const SSH_MAGIC_8192: i64 = 8192
39const SSH_STATE_BYTES: i64 = 96

functions

41func ssh_P(s: *u8, n: i64) -> i64 { sys_write(1, s, n); return 0 }
calls 1: sys_write
42func ssh_puts(s: *u8) -> i64
called by 32: mainmainmainmainmainmain+26 calls 1: sys_write
47func ssh_phex(b: *u8, n: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
57func ssh_sockaddr(sa: *u8, ip: i64, port: i64) -> i64
66func ssh_u32be(b: *u8, off: i64) -> i64
69func ssh_read_full(fd: i64, dst: *u8, n: i64) -> i64
78func ssh_read_line(fd: i64, dst: *u8, max: i64) -> i64
called by 1: ssh_kex calls 1: sys_read
88func ssh_put_u32(b: *u8, idx: i64, v: i64) -> i64
93func ssh_put_byte(b: *u8, idx: i64, v: i64) -> i64 { b[idx] = (v & 0xff) as u8; return idx + 1 }
94func ssh_put_bytes(b: *u8, idx: i64, s: *u8, n: i64) -> i64
99func ssh_put_str(b: *u8, idx: i64, s: *u8, n: i64) -> i64
104func ssh_send_packet(fd: i64, payload: *u8, plen: i64) -> i64
117func ssh_read_packet(fd: i64, payload_out: *u8) -> i64
128func ssh_h_str(ctx: *Sha256, src: *u8, n: i64) -> i64
132func ssh_build_mpint(K: *u8, n: i64, out: *u8) -> i64
called by 1: ssh_kex
143func ssh_kex(st: *SshState) -> i64
233func ssh_derive_key(st: *SshState, letter: i64, need: i64, out: *u8) -> i64
254func ssh_derive_session(st: *SshState) -> i64
263func ssh_seqbuf(seqnr: i64, out8: *u8) -> i64
274func ssh_enc_send(st: *SshState, payload: *u8, plen: i64) -> i64
304func ssh_enc_recv(st: *SshState, payload_out: *u8) -> i64
330func ssh_ed25519_blob(pub32: *u8, out: *u8) -> i64
337func ssh_print_authkeys(pub32: *u8) -> i64
346func ssh_open_session(st: *SshState, ip: i64) -> i64
372func ssh_userauth_password(st: *SshState, user: *u8, ulen: i64, pw: *u8, pwlen: i64) -> i64
395func ssh_load_identity(seed: *u8, pub: *u8) -> i64
412func ssh_userauth_publickey(st: *SshState, user: *u8, ulen: i64, seed32: *u8, pub32: *u8) -> i64
445func ssh_exec(st: *SshState, cmd: *u8, cmdlen: i64) -> i64