4d26ac5c85
Renegotiation (no reconnect on resize): the handshake bi-stream stays open; the client
sends Reconfigure{mode} (typed post-handshake message), the host validates + acks
Reconfigured and rebuilds capture/encoder/virtual output at the new mode while the data
plane (keys, ports, FEC) runs untouched — the first new-mode AU is an IDR with in-band
parameter sets. NativeClient::request_mode / punktfunk_connection_request_mode; mode()
reflects the active mode. Validated live on KWin: one continuous stream, 225 frames
@1280x720 then 395 @1920x1080, ~90 ms pipeline rebuild (ffprobe shows both resolutions).
PIN pairing (mutual trust, kills TOFU MITM): clients get persistent self-signed
identities presented via QUIC client auth (generate_identity / client auth offered but
optional server-side — legacy clients still connect). Ceremony on the control stream:
PairRequest{name} → host shows a 4-digit PIN (log) + PairChallenge{salt} → client proves
with HMAC-SHA256(PIN‖salt, client_fp‖host_fp) — binding both certs means a MITM can't
forward a proof, single attempt per PIN, constant-time compare → PairResult; host
persists the fingerprint (~/.config/punktfunk/punktfunk1-paired.json), client pins the
host's. m3-host --require-pairing gates sessions on the paired set.
NativeClient::pair + punktfunk_pair/punktfunk_generate_identity in the ABI; reference
client: --pair PIN --name LABEL + auto-generated persistent identity, --remode for live
renegotiation testing. Swift wrapper: ClientIdentity/generateIdentity()/pair(),
requestMode()/currentMode(); README handoff updated.
Tested: reconfigure/pairing wire roundtrips, C-ABI mode switch ack, full in-process
ceremony (wrong PIN → Crypto, anonymous-vs-gate rejection, success → pinned session);
live wrong-PIN ceremony against the serving host (PIN logged, proof rejected).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
52 lines
2.2 KiB
TOML
52 lines
2.2 KiB
TOML
[package]
|
|
name = "punktfunk-core"
|
|
description = "punktfunk shared protocol/transport/FEC core, exposed over a stable C ABI"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
rust-version.workspace = true
|
|
license.workspace = true
|
|
authors.workspace = true
|
|
repository.workspace = true
|
|
|
|
[lib]
|
|
name = "punktfunk_core"
|
|
# `lib` — so punktfunk-host / punktfunk-client-rs / tools link it as a normal Rust crate.
|
|
# `staticlib` — `libpunktfunk_core.a` for the C test harness and static embedding.
|
|
# `cdylib` — `libpunktfunk_core.{so,dylib}` for Swift/Kotlin clients via the C ABI.
|
|
crate-type = ["lib", "cdylib", "staticlib"]
|
|
|
|
[features]
|
|
default = []
|
|
# Control-plane QUIC (pairing, config, reverse audio). tokio is permitted ONLY here,
|
|
# never on the per-frame hot path. Off by default so the core stays runtime-free.
|
|
quic = ["dep:quinn", "dep:tokio", "dep:rustls", "dep:rcgen", "dep:rustls-pki-types", "dep:sha2", "dep:hmac"]
|
|
|
|
[dependencies]
|
|
reed-solomon-simd = "3.1" # GF(2^16) Leopard-RS, SIMD, O(n log n) — the wall-breaker (P2)
|
|
# Vendored fork of fec-rs: GF(2^8) classic RS with the *Cauchy* generator matrix
|
|
# (M[j][i] = inv[(m+i)^j]) — byte-identical to the `nanors` library Moonlight uses, so our
|
|
# parity is decodable by a stock Moonlight client. (reed-solomon-erasure is Vandermonde and is
|
|
# NOT interoperable.) See vendor/fec-rs/LICENSE (BSD-2-Clause).
|
|
fec-rs = { path = "vendor/fec-rs" }
|
|
aes-gcm = "0.10" # AES-128-GCM session crypto, matches GameStream
|
|
zerocopy = { version = "0.8", features = ["derive"] }
|
|
bytes = "1"
|
|
thiserror = "2"
|
|
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
|
rand = "0.9"
|
|
zeroize = "1"
|
|
|
|
quinn = { version = "0.11", optional = true }
|
|
rustls = { version = "0.23", optional = true, default-features = false, features = ["ring", "std"] }
|
|
rcgen = { version = "0.13", optional = true, default-features = false, features = ["aws_lc_rs", "pem"] }
|
|
rustls-pki-types = { version = "1", optional = true }
|
|
sha2 = { version = "0.10", optional = true }
|
|
hmac = { version = "0.12", optional = true }
|
|
tokio = { version = "1", optional = true, features = ["rt-multi-thread", "net", "sync", "macros"] }
|
|
|
|
[dev-dependencies]
|
|
proptest = "1"
|
|
|
|
[build-dependencies]
|
|
cbindgen = "0.29"
|