code wiki / (root) / nx_tls13_mtls_recv_cert.nx

nx_tls13_mtls_recv_cert.nx

buildroot/runtime/nx_tls13_mtls_recv_cert.nx

8564 B137 linesdepth 11pulls 33 transitivereach 3 importersview sourcekind tooltopic tls13
docsdependenciesstructsconstsfunctions

about

nx_tls13_mtls_recv_cert.nx -- R7: receive the client's Certificate record, EMPTY-cert aware. When the server requests a client cert (CertReq) but the browser has none suitable, RFC 8446 ยง4.4.2 says it MUST still send a Certificate message with an EMPTY certificate_list. The server MUST fold that empty message into the transcript (or the client's Finished MAC won't verify) and continue -- this is exactly the NEVER-LOCKOUT path that lets a non-cert browser complete the handshake and fall back to the header session. On a real cert: decrypt + extract the leaf DER + present=1. Extracted from the run loop so the empty-cert branch is GATED, not just compile-checked. license_tier: ORIGINAL expect_exit: 0

dependencies 6 imports · 1 importers

nx_syscalls.nx nx_tls13.nx nx_tls13_record.nx nx_tls13_transcript.nx nx_tls13_server_session.nx nx_tls13_auth.nx nx_tls13_mtls_recv_cert.nx nx_tls13_server_session_run_mtls.n

imports: nx_syscalls.nxnx_tls13.nxnx_tls13_record.nxnx_tls13_transcript.nxnx_tls13_server_session.nxnx_tls13_auth.nx

imported by: nx_tls13_server_session_run_mtls.nx

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main mrc_w sys_write sys_mmap mrc_u24 mrc_seal sys_mmap ↻ nx_tls13_record_encrypt_v2 sys_mmap ↻ tls13_record_write_header tls13_record_build_nonce tls13_record_aead_seal nx_chacha20_poly1305_encry sys_mmap ↻ aead_derive_otk sys_mmap ↻ chacha20_block chacha20_encrypt sys_mmap ↻ _chacha20_set_consts_key load_u32_le chacha20_perm_core aead_build_mac_data aead_put_u64_le poly1305_mac sys_mmap ↻ poly1305_clamp p_load_u32_le p_store_u32_le nx_aes128_gcm_seal sys_mmap ↻ aes128_expand_key _aes_sbox _aes_rcon aes128_encrypt_block nx_ghash_reflect16 gh_byterev_bits nx_ghash_mul_rev gh_clmul_core nx_ghash_upd_rev

structs

none

consts

16const NX_MRC_REC_HEADER: i64 = 5
17const NX_MRC_REC_TAG: i64 = 16

functions

21func nx_tls13_mtls_recv_client_cert(
57func mrc_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 2: mrc_rowmain calls 1: sys_write
58func mrc_row(name: *u8, ok: i64) -> i64 { if ok == 1 { mrc_w(" PASS " as *u8) } else { mrc_w(" FAIL " as *u8) } mrc_w(name); mrc_w("\n" as *u8); return ok }
called by 1: main calls 1: mrc_w
59func mrc_u24(b: *u8, o: i64, v: i64) -> i64 { b[o] = ((v >> 16) & 0xff) as u8; b[o+1] = ((v >> 8) & 0xff) as u8; b[o+2] = (v & 0xff) as u8; return o + 3 }
called by 1: main
61func mrc_seal(msg: *u8, msg_len: i64, key: *u8, iv: *u8, rec: *u8) -> i64
71func mrc_mksession(key: *u8, iv: *u8) -> *Tls13ServerSession
78func main() -> i64