nx_tls13_server_session_emit_ee_alpn.nx
buildroot/runtime/nx_tls13_server_session_emit_ee_alpn.nx
about
nx_tls13_server_session_emit_ee_alpn.nx -- TUTOR-BOOTSTRAP SCAFFOLD (Claude,
authored under the B1 rung(3) ALPN-h2 SERVER workflow of the R4-H2
HTTP/2-transport ladder), NOT credited as team self-authoring.
The ALPN-h2 SIBLING of the base 6th TLS server stone
nx_tls13_server_session_emit_ee (runtime/nx_tls13_server_session_emit_ee.nx).
The base stone emits an EMPTY EncryptedExtensions inner '08 00 00 02 00 00'
(no extensions -> no ALPN negotiated). THIS variant emits the byte-exact
ALPN-h2 EE inner so a sovereign h2 client (which advertises "h2" via
tls13_ext_emit_alpn_h2_only) sees its protocol SELECTED:
08 00 00 0b 00 09 00 10 00 05 00 03 02 68 32 (15 bytes)
HT_ENCRYPTED_EXTENSIONS = 0x08
body_len u24 = 0x00000b = 11
ext_list_len = 0x0009 = 9 (one ALPN EE ext, 9 wire bytes)
ALPN EE ext = 00 10 00 05 00 03 02 68 32
ext_type 0x0010, ext_data_len 0x0005, protocol_name_list_len 0x0003,
name_len 0x02, "h2" = 0x68 0x32
The trailing 9 ALPN bytes are NOT reinvented here: they are emitted BYTE-FOR-
BYTE by the GREEN client emitter tls13_ext_emit_alpn_h2_only
(runtime/nx_tls13_ext.nx:236, KAT '00 10 00 05 00 03 02 68 32' at :235),
which we call into inner+6. The CLIENT'S tls13_ext_parse_alpn_selected
recovers "h2" from exactly the trailing ext_data (00 03 02 68 32).
NO-STRIP (rule 25): the base emit_ee + emit_ee_test are left BYTE-INTACT.
This is a NEW path used only by the run_h2 server variant; the base server
run keeps emitting the empty no-ext EE.
Everything else is copied VERBATIM from the base stone: encrypt under
server_hs_traffic_key/iv/server_seq via nx_tls13_record_encrypt_v2
(CT_HANDSHAKE), feed the 15 PLAINTEXT inner bytes (not the AEAD record) to
nx_tls13_transcript_update, ++server_seq, advance EE_SENT -> CERT_SENT.
BACK-FILL: the team RE-AUTHORS this from the DATA spec via the
emitter-of-emitters (X-AUT-006c/e/f); this hand scaffold is the sanctioned
one-time bootstrap only (meter-integrity, mirror
nx_tls13_server_session_emit_ee.nx:1-22).
Precondition: state == EE_SENT. Postcondition: state == CERT_SENT.
dependencies 6 imports · 1 importers
imports: nx_syscalls.nxnx_tls13.nxnx_tls13_record.nxnx_tls13_transcript.nxnx_tls13_server_session.nxnx_tls13_ext.nx
imported by: nx_tls13_server_session_run_h2.nx
structs
| none |
consts
| 53 | const NX_TLS13_EE_ALPN_INNER_LEN: i64 = 15 // HT + u24 + ext_list_len(2) + ALPN ext(9) |
| 54 | const NX_TLS13_EE_ALPN_REC_HEADER: i64 = 5 |
| 55 | const NX_TLS13_EE_ALPN_REC_TAG: i64 = 16 |
functions
| 57 | func nx_tls13_server_session_emit_ee_alpn( |