Skip to content

fix(crypto): real Noise ee+es+se key agreement (forward secrecy) — part 1 of N3 - #64

Closed
gHashTag wants to merge 1 commit into
mainfrom
feat/crypto-handshake-es-se
Closed

fix(crypto): real Noise ee+es+se key agreement (forward secrecy) — part 1 of N3#64
gHashTag wants to merge 1 commit into
mainfrom
feat/crypto-handshake-es-se

Conversation

@gHashTag

Copy link
Copy Markdown
Owner

First, verifiable, low-risk slice of the crypto fix (RFC #63). The handshake did ee+ss with ss passed as both es and se — no forward secrecy. Now computes real ee/es/se (ephemeral changed to a reusable StaticSecret for the two DH ops). Verified: honest parties still derive the same key (handshake_and_roundtrip green), full suite 103 passed. NOT the whole fix: identity auth (allow-list gating, the actual MITM defense), N4, N5 still open per #63 and need owner decisions. Draft, needs crypto review. phi^2 + phi^-2 = 3

…rt 1 of N3

The handshake computed only ee + ss and passed `ss` in BOTH the es and se slots
of combine_dh_shares (crypto.rs), so it had no forward secrecy and did not bind
the ephemeral keys into the session — the "SIMPLIFIED Noise-XX" note admitted it.

Fix: NoiseXX.ephemeral becomes a reusable StaticSecret (an EphemeralSecret is
consumed by its first diffie_hellman, but we need it for both ee and es), and
complete_initiator/responder now compute the real three shares:
  initiator: ee=e_i.e_r, es=e_i.s_r, se=s_i.e_r
  responder: ee=e_r.e_i, es=s_r.e_i (== e_i.s_r), se=e_r.s_i (== s_i.e_r)
so both sides derive the same (ee, es, se). Verified: handshake_and_roundtrip and
independent_handshakes_do_not_share_a_key pass (honest parties still agree on the
key; a wrong role-order would fail these), full suite 103 passed.

SCOPE: this is the forward-secrecy half of N3. It does NOT add identity
authentication — the `noise_xx_resistant_to_mitm` scenario (a party handshaking
directly against an attacker's static key) still needs allow-list gating
(complete_* -> Result, reject a peer_static not matching the expected identity),
which is an API change awaiting owner sign-off in the RFC (#63). N4 (HELLO MAC)
and N5 (keystore) are also still open. Draft — needs crypto review.

Refs #58, #63.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

phi^2 + phi^-2 = 3
@gHashTag gHashTag closed this Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants