nx_tls13_server_recv_client_cv.nx
buildroot/runtime/nx_tls13_server_recv_client_cv.nx
about
nx_tls13_server_recv_client_cv.nx -- R7 rung 7c: receive + verify the client's CertificateVerify.
After recv_client_cert (7b) folded the client Certificate into the transcript, this rung: snapshots the
transcript (= Transcript-Hash through the client Certificate, per RFC 8446 ยง4.4.3), AEAD-decrypts the
client CertificateVerify record, parses out the SignatureScheme + signature, rebuilds the 130-byte signed
content (64*0x20 || "TLS 1.3, client CertificateVerify" || 0x00 || transcript-hash), and VERIFIES it
against the client cert's public key -- dispatching Ed25519 (0x0807) -> ed25519_verify_full and
ECDSA-P256 (0x0403) -> nx_x509_verify_ecdsa_p256. This is the same crypto proven in R3 (6/6) + R5c (5/5),
re-composed here over the verify PRIMITIVES (not the R3/R5c files) so this rung shares only the
TLS-record + x509-verify closures (no cert-MINTER imports -> no build-closure clash).
NEVER-LOCKOUT: returns a distinct verdict for "no/!valid client auth" so the run loop can fall back to the
header path rather than failing the handshake. license_tier: ORIGINAL expect_exit: 0
dependencies 10 imports · 1 importers
imports: nx_syscalls.nxnx_tls13.nxnx_tls13_record.nxnx_tls13_transcript.nxnx_tls13_server_session.nxnx_tls13_auth.nxnx_ed25519_signature.nxnx_x509.nxnx_x509_verify_ecdsa.nxnx_u256.nx
imported by: nx_tls13_server_session_run_mtls.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 25 | const NX_RCV_OK: i64 = 0 |
| 26 | const NX_RCV_BAD_STATE: i64 = 1 |
| 27 | const NX_RCV_DECRYPT_FAIL: i64 = 2 // AEAD/record error |
| 28 | const NX_RCV_PARSE_FAIL: i64 = 3 // not a well-formed CertificateVerify |
| 29 | const NX_RCV_BAD_CERT: i64 = 4 // client cert unparseable / wrong key shape |
| 30 | const NX_RCV_VERIFY_FAIL: i64 = 5 // signature did not verify (reject -- no access) |
| 31 | const NX_RCV_UNSUPPORTED: i64 = 6 // scheme not Ed25519 / ECDSA-P256 |
| 32 | const NX_RCV_CV_CONTENT_LEN: i64 = 130 |
| 33 | const NX_RCV_SS_ED25519: i64 = 0x0807 |
| 34 | const NX_RCV_SS_ECDSA: i64 = 0x0403 |
| 35 | const NX_RCV_REC_HEADER: i64 = 5 |
| 36 | const NX_RCV_REC_TAG: i64 = 16 |
functions
| 38 | func rcv_cv_content(th32: *u8, out130: *u8) -> i64 called by 1: nx_tls13_server_recv_client_cv |
| 52 | func nx_tls13_server_recv_client_cv( |
| 121 | func rcv_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 122 | func rcv_row(name: *u8, ok: i64) -> i64 { if ok == 1 { rcv_w(" PASS " as *u8) } else { rcv_w(" FAIL " as *u8) } rcv_w(name); rcv_w("\n" as *u8); return ok } |
| 123 | func rcv_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: rcv_build_cv |
| 126 | func rcv_build_cv(scheme: i64, sig: *u8, sig_len: i64, msg: *u8) -> i64 |
| 138 | func rcv_seal(msg: *u8, msg_len: i64, key: *u8, iv: *u8, rec: *u8) -> i64 |
| 149 | func rcv_mksession(key: *u8, iv: *u8) -> *Tls13ServerSession |
| 160 | func main() -> i64 |