code wiki / (root) / nx_p384_ecdh.nx

nx_p384_ecdh.nx

buildroot/runtime/nx_p384_ecdh.nx

5111 B120 linesdepth 10pulls 15 transitivereach 1 importersview sourcekind tooltopic p384
docsdependenciesstructsconstsfunctions

about

nx_p384_ecdh.nx -- ECDH key exchange on P-384 (secp384r1) for the TLS 1.3 key_share path. Mirrors nx_p256_ecdh.nx 1:1 on the 12-limb / 384-bit stack. The P-384 field/point/scalar_mul shipped for ECDSA-P384 cert VERIFICATION (real chains use P-384 intermediate/root keys); this module composes the SAME primitives into the ECDHE role so the ClientHello can carry a secp384r1 KeyShareEntry next to x25519 + secp256r1. FIPS-strict gov servers (api.bls.gov / api.fiscaldata.treasury.gov / waterservices.usgs.gov) that require P-384 ECDHE + AES-256-GCM-SHA384 then complete WITHOUT a HelloRetryRequest -- they pick our P-384 share. No new curve math: only the ECDH wrapper. Public API (mirrors p256_ecdh): p384_ecdh_derive_priv(seed32, out_priv48) domain-separated ephemeral scalar (SHA-384), reduced mod n. p384_ecdh_pub(priv48, out_pub97) out = 0x04 || X(48) || Y(48) (RFC 8446 secp384r1 wire form). p384_ecdh_shared(priv48, peer_pub97, len, out_shared48) validates peer point, writes x(priv*peer) (RFC 8446 7.4.2). Variable-time scalar_mul: the scalar is an EPHEMERAL per-session secret (one-handshake lifetime), the same accepted tradeoff as p256_ecdh; constant-time ladder is the named follow-up. license_tier: INDEPENDENT_REDERIVE genealogy_id: international-research-sources/ietf/rfc_5903 + ietf/rfc_8446 + nist/fips_186_5

dependencies 8 imports · 1 importers

nx_syscalls.nx nx_sha512.nx nx_u384.nx nx_p384_field.nx nx_p384_point.nx nx_p384_point_add.nx nx_p384_scalar_mul.nx nx_p384_modn.nx nx_p384_ecdh.nx nx_p384_ecdh_gate.nx

imports: nx_syscalls.nxnx_sha512.nxnx_u384.nxnx_p384_field.nxnx_p384_point.nxnx_p384_point_add.nxnx_p384_scalar_mul.nxnx_p384_modn.nx

imported by: nx_p384_ecdh_gate.nx

structs

none

consts

28const NX_P384_ECDH_OK: i64 = 1
29const NX_P384_ECDH_BAD_PRIV: i64 = 2 // scalar zero or >= n
30const NX_P384_ECDH_BAD_POINT: i64 = 3 // format/on-curve/infinity reject
31const NX_P384_ECDH_VERDICT_N: i64 = 4

functions

33func nx_p384_ecdh_verdict_is_valid(v: i64) -> i64
40func _p384_ecdh_load_scalar(priv48: *u8, out_k: *i64) -> i64
51func p384_ecdh_derive_priv(seed32: *u8, out_priv48: *u8) -> i64
72func p384_ecdh_pub(priv48: *u8, out_pub97: *u8) -> i64
92func p384_ecdh_shared(priv48: *u8, peer_pub97: *u8, peer_len: i64, out_shared48: *u8) -> i64
120func main() -> i64 { return 0 }