code wiki / hub / nx_opaque_3dh.nx

nx_opaque_3dh.nx

buildroot/runtime/hub/nx_opaque_3dh.nx

7869 B180 linesdepth 12pulls 29 transitivereach 87 importersview sourcekind librarytopic opaque
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx sha256.nx nx_hmac.nx nx_hkdf.nx nx_opaque_core.nx nx_opaque_3dh.nx nx_opaque_pake.nx

imports: nx_syscalls.nxsha256.nxnx_hmac.nxnx_hkdf.nxnx_opaque_core.nx

imported by: nx_opaque_pake.nx

structs

none

consts

27const NX_OPQ_KE1_BYTES: i64 = 98
28const NX_OPQ_KE1_OFF_BLINDED: i64 = 0
29const NX_OPQ_KE1_OFF_CNONCE: i64 = 33
30const NX_OPQ_KE1_OFF_CKEYSHARE: i64 = 65
32const NX_OPQ_KE2_BYTES: i64 = 259
33const NX_OPQ_KE2_OFF_EVAL: i64 = 0
34const NX_OPQ_KE2_OFF_MASKNONCE: i64 = 33
35const NX_OPQ_KE2_OFF_MASKED: i64 = 65
36const NX_OPQ_KE2_OFF_SNONCE: i64 = 162
37const NX_OPQ_KE2_OFF_SKEYSHARE: i64 = 194
38const NX_OPQ_KE2_OFF_SMAC: i64 = 227
39const NX_OPQ_CRED_RESP_BYTES: i64 = 162 // evaluated || masking_nonce || masked_response
40const NX_OPQ_MASKED_BYTES: i64 = 97 // Npk + Nn + Nm
42const NX_OPQ_KE3_BYTES: i64 = 32
44const NX_OPQ_PREAMBLE_CAP: i64 = 1024
45const NX_OPQ_IKM_BYTES: i64 = 99 // 3 * 33 compressed DH outputs

functions

59func nx_opq_preamble(
121func nx_opq_derive_keys(
161func nx_opq_client_mac(