nx_p384_ecdh.nx
buildroot/runtime/nx_p384_ecdh.nx
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
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
| 28 | const NX_P384_ECDH_OK: i64 = 1 |
| 29 | const NX_P384_ECDH_BAD_PRIV: i64 = 2 // scalar zero or >= n |
| 30 | const NX_P384_ECDH_BAD_POINT: i64 = 3 // format/on-curve/infinity reject |
| 31 | const NX_P384_ECDH_VERDICT_N: i64 = 4 |
functions
| 33 | func nx_p384_ecdh_verdict_is_valid(v: i64) -> i64 |
| 40 | func _p384_ecdh_load_scalar(priv48: *u8, out_k: *i64) -> i64 called by 2: p384_ecdh_pubp384_ecdh_shared calls 5: u384_load_beu384_is_zerou384_allocp384_modn_load_nu384_cmp |
| 51 | func p384_ecdh_derive_priv(seed32: *u8, out_priv48: *u8) -> i64 |
| 72 | func p384_ecdh_pub(priv48: *u8, out_pub97: *u8) -> i64 |
| 92 | func p384_ecdh_shared(priv48: *u8, peer_pub97: *u8, peer_len: i64, out_shared48: *u8) -> i64 called by 1: main calls 10: u384_allocu384_load_bep384_point_allocp384_point_set_affinep384_point_on_curvep384_point_is_infinity+4 |
| 120 | func main() -> i64 { return 0 } |