nx_opaque_3dh.nx
buildroot/runtime/hub/nx_opaque_3dh.nx
about
nx_opaque_3dh.nx -- V-MODAUTH-2b: RFC 9807 §6.4 OPAQUE-3DH key schedule.
3DH = triple Diffie-Hellman: three P-256 shared points (eph-eph, eph-static,
static-eph) concatenated into ikm, bound to the full transcript (preamble) via
HKDF. Gives forward secrecy + KCI resistance; KE2/KE3 MACs give mutual explicit
authentication. The password only enters through the envelope-recovered client
static key, so a wrong password fails loudly at envelope auth, never here.
Wire layout (flat buffers; offsets sealed, they ARE the RFC wire format):
KE1 (98) = blinded_message(33) || client_nonce(32) || client_public_keyshare(33)
KE2 (259) = evaluated_message(33) || masking_nonce(32) || masked_response(97)
|| server_nonce(32) || server_public_keyshare(33) || server_mac(32)
KE3 (32) = client_mac
COMPOSES: hub/nx_opaque_core (DH, Expand-Label, ct_eq), nx_hkdf, nx_hmac, sha256
COMPOSED BY: hub/nx_opaque_pake (GenerateKE1/KE2/KE3, ServerFinish)
SPEC: RFC 9807 §6.4.2 (Preamble, DeriveKeys), §6.1 (message structs)
license_tier: ORIGINAL
dependencies 5 imports · 1 importers
imports: nx_syscalls.nxsha256.nxnx_hmac.nxnx_hkdf.nxnx_opaque_core.nx
imported by: nx_opaque_pake.nx
structs
| none |
consts
| 27 | const NX_OPQ_KE1_BYTES: i64 = 98 |
| 28 | const NX_OPQ_KE1_OFF_BLINDED: i64 = 0 |
| 29 | const NX_OPQ_KE1_OFF_CNONCE: i64 = 33 |
| 30 | const NX_OPQ_KE1_OFF_CKEYSHARE: i64 = 65 |
| 32 | const NX_OPQ_KE2_BYTES: i64 = 259 |
| 33 | const NX_OPQ_KE2_OFF_EVAL: i64 = 0 |
| 34 | const NX_OPQ_KE2_OFF_MASKNONCE: i64 = 33 |
| 35 | const NX_OPQ_KE2_OFF_MASKED: i64 = 65 |
| 36 | const NX_OPQ_KE2_OFF_SNONCE: i64 = 162 |
| 37 | const NX_OPQ_KE2_OFF_SKEYSHARE: i64 = 194 |
| 38 | const NX_OPQ_KE2_OFF_SMAC: i64 = 227 |
| 39 | const NX_OPQ_CRED_RESP_BYTES: i64 = 162 // evaluated || masking_nonce || masked_response |
| 40 | const NX_OPQ_MASKED_BYTES: i64 = 97 // Npk + Nn + Nm |
| 42 | const NX_OPQ_KE3_BYTES: i64 = 32 |
| 44 | const NX_OPQ_PREAMBLE_CAP: i64 = 1024 |
| 45 | const NX_OPQ_IKM_BYTES: i64 = 99 // 3 * 33 compressed DH outputs |
functions
| 59 | func nx_opq_preamble( |
| 121 | func nx_opq_derive_keys( called by 2: nx_opaque_generate_ke2_detnx_opaque_generate_ke3 calls 3: sys_mmaphkdf_extractnx_opq_derive_secret |
| 161 | func nx_opq_client_mac( |