code wiki / (root) / nx_tls13_server_session_emit_cv.nx

nx_tls13_server_session_emit_cv.nx

buildroot/runtime/nx_tls13_server_session_emit_cv.nx

12781 B347 linesdepth 11pulls 43 transitivereach 28 importersview sourcekind librarytopic tls13
docsdependenciesstructsconstsfunctions

about

nx_tls13_server_session_emit_cv.nx -- stone 7.5 of TLS server arc. Emits the server CertificateVerify handshake message: ECDSA-P256 signature over a transcript-bound context, wrapped as an AEAD-encrypted record. Per RFC 8446 §4.4.3, the signed content is: [0x20 × 64] (octet 0x20 = space, 64 bytes) "TLS 1.3, server CertificateVerify" (33 bytes, the string) 0x00 (separator) transcript_hash (32 bytes, SHA-256) ----- 130 bytes total ----- Signature: ECDSA-P256-SHA256. The signing primitive nx_ecdsa_p256_sign hashes input itself. Wire encoding: HT_CERTIFICATE_VERIFY (0x0f) (1 byte) u24 body_len (3 bytes) u16 signature_scheme = 0x0403 (ecdsa_secp256r1_sha256) u16 sig_len (DER signature length) DER-encoded ECDSA(r, s) (~70-72 bytes) State machine: requires CERT_SENT (i.e. EE has been emitted; the Certificate stone 6.5 is logically before this but is queued, so in v1 the substrate skips cert -- THIS IS HONESTLY ANONYMOUS-CERT STILL). Advances to CV_SENT. emit_sf (patched this commit) now accepts both CERT_SENT and CV_SENT. Honest scope statement: a real client interop'ing with a real public CA chain would expect Certificate to precede this message. This commit ships the SIGNATURE pipeline (key schedule + transcript + ECDSA + DER + AEAD record), composable with stone 6.5 when it ships. The signing primitive is KAT'd against RFC 6979 vectors. license_tier: ORIGINAL

dependencies 9 imports · 7 importers

nx_syscalls.nx nx_u256.nx nx_sha256.nx nx_ecdsa_p256_sign.nx nx_tls13.nx nx_tls13_record.nx nx_tls13_transcript.nx nx_tls13_server_session.nx nx_ed25519_signature.nx nx_tls13_server_session_emit_c nx_edge_daemon.nx nx_pages_https_daemon.nx nx_tls13_server_full_handshake_tes nx_tls13_server_session_emit_certi nx_tls13_server_session_emit_cv_te nx_tls13_server_session_run.nx nx_tls13_server_session_run_h2.nx

imports: nx_syscalls.nxnx_u256.nxnx_sha256.nxnx_ecdsa_p256_sign.nxnx_tls13.nxnx_tls13_record.nxnx_tls13_transcript.nxnx_tls13_server_session.nxnx_ed25519_signature.nx

imported by: nx_edge_daemon.nxnx_pages_https_daemon.nxnx_tls13_server_full_handshake_test.nxnx_tls13_server_session_emit_certificate_test.nxnx_tls13_server_session_emit_cv_test.nxnx_tls13_server_session_run.nxnx_tls13_server_session_run_h2.nx

structs

none

consts

49const NX_TLS13_SIG_SCHEME_ECDSA_P256_SHA256: i64 = 0x0403
50const NX_TLS13_CV_TRANSCRIPT_LEN: i64 = 32 // SHA-256 hash output
51const NX_TLS13_CV_CONTEXT_LEN: i64 = 130 // 64 + 33 + 1 + 32
259const NX_TLS13_SIG_SCHEME_ED25519: i64 = 0x0807

functions

55func encode_ecdsa_p256_sig_der(r_bytes: *u8, s_bytes: *u8,
106func build_cv_context(transcript_hash: *u8, out: *u8) -> i64
135func nx_tls13_server_session_emit_cv(
261func nx_tls13_server_session_emit_cv_ed25519(