code wiki / (root) / nx_tls13_server_session_emit_certreq.nx

nx_tls13_server_session_emit_certreq.nx

buildroot/runtime/nx_tls13_server_session_emit_certreq.nx

7229 B147 linesdepth 11pulls 33 transitivereach 3 importersview sourcekind tooltopic tls13
docsdependenciesstructsconstsfunctions

about

nx_tls13_server_session_emit_certreq.nx -- R7 rung 7a: emit CertificateRequest as a real encrypted server handshake step. The on-wire half of mTLS rung R2 (the live terminator sends it; request-NOT-require). Sits between EncryptedExtensions and the server Certificate (RFC 8446 ยง4.3.2 ordering): EE, CertReq, Cert, CertVerify, Finished. Mirrors nx_tls13_server_session_emit_ee exactly: build the CertReq inner bytes (via the R2 builder, advertising Ed25519 0x0807 + ECDSA-P256 0x0403), AEAD-encrypt as a CT_HANDSHAKE record under server_hs_traffic_key, write it, feed the PLAINTEXT into the transcript. State stays CERT_SENT (like emit_certificate), so the existing emit_certificate -> emit_cv -> emit_sf chain is unchanged. REQUEST-NOT-REQUIRE / never-lockout: emitting this only ASKS the client for a cert; a client that presents none still completes the handshake (the run loop's mTLS variant decides whether to require it for ACCESS). 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_emit_certificate_request. nx_tls13_server_session_emit_c nx_tls13_server_session_run_mtls.n

imports: nx_syscalls.nxnx_tls13.nxnx_tls13_record.nxnx_tls13_transcript.nxnx_tls13_server_session.nxnx_tls13_emit_certificate_request.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 crq_w sys_write sys_mmap nx_tls13_transcript_new sys_mmap ↻ sha256_init sys_mmap ↻ sha256_k sha384_init nx_tls13_server_session_em sys_mmap ↻ tls13_build_certificate_re tls_write_u24_be tls_write_u16_be 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

structs

none

consts

20const NX_CRQ_REC_HEADER: i64 = 5
21const NX_CRQ_REC_TAG: i64 = 16

functions

23func nx_tls13_server_session_emit_certreq(
74func crq_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: crq_rowmain calls 1: sys_write
75func crq_row(name: *u8, ok: i64) -> i64 { if ok == 1 { crq_w(" PASS " as *u8) } else { crq_w(" FAIL " as *u8) } crq_w(name); crq_w("\n" as *u8); return ok }
called by 1: main calls 1: crq_w
77func main() -> i64