nx_tls13_client_session_derive_app.nx
buildroot/runtime/nx_tls13_client_session_derive_app.nx
about
nx_tls13_client_session_derive_app.nx -- step 3c.5 of the
nx_https_client wiring arc.
Runs the SECOND HALF of the RFC 8446 ยง7.1 key schedule cascade
to derive the application-traffic keys, advancing the session
from WAIT_APP_KEYS to CONNECTED. After this primitive returns
OK, the session is fully usable for application-data send/recv.
Cascade (continuing from where 3c.2 left off):
handshake_secret (from 3c.2)
|
v
Derive-Secret(., "derived", H_empty) = derived_2
|
v IKM = 0^HashLen
HKDF-Extract(salt=derived_2, IKM=0) = master_secret
|
v salt = master_secret; context = H2 = hash(CH..CF)
+--> Derive-Secret(., "c ap traffic", H2) = c_app_traffic_secret_0
+--> Derive-Secret(., "s ap traffic", H2) = s_app_traffic_secret_0
then per-secret expand:
key = HKDF-Expand-Label(secret, "key", "", 32)
iv = HKDF-Expand-Label(secret, "iv", "", 12)
The transcript at this point covers CH..client_Finished
(CF was appended in 3c.4's emit). H2 = transcript snapshot.
Once derived, app_seq counters are reset to 0 (per-direction
AEAD nonce sequence starts fresh for application data). State
advances to CONNECTED -- application send/recv is now safe.
Public API:
nx_tls13_client_session_derive_app(session) -> verdict
nx_tls13_derive_app_verdict_is_valid(v) -> 0|1
Sealed verdict:
NX_TLS13_DERIVE_APP_OK keys derived, state CONNECTED
NX_TLS13_DERIVE_APP_BAD_STATE session not at WAIT_APP_KEYS
dependencies 5 imports · 3 importers
imports: nx_syscalls.nxnx_sha256.nxnx_tls13_transcript.nxnx_tls13_schedule.nxnx_tls13_client_session.nx
imported by: nx_tls13_client_h2run.nxnx_tls13_client_session_derive_app_test.nxnx_tls13_client_session_run.nx
structs
| none |
consts
| 63 | const NX_TLS13_DERIVE_APP_OK: i64 = 1 |
| 64 | const NX_TLS13_DERIVE_APP_BAD_STATE: i64 = 2 |
| 65 | const NX_TLS13_DERIVE_APP_VERDICT_N: i64 = 3 |
functions
| 67 | func nx_tls13_derive_app_verdict_is_valid(v: i64) -> i64 called by 1: main |
| 74 | func nx_tls13_client_session_derive_app(s: *Tls13ClientSession) -> i64 |
| 131 | func main() -> i64 |