Files
mcde/lib/libDtChat
lotherk efca77d22d dtchat: add the media packet, key agreement and replay window (T6.3)
media_packet.c: X25519 key pairs, HKDF-SHA256 over the shared secret with the sorted public keys as salt gives two 32-byte direction keys (the responder mirrors send/recv); ChaCha20-Poly1305 seals the payload with a 12-byte header (version, type, flags, reserved, 32-bit sequence, 32-bit timestamp) as additional data, the nonce is the 64-bit sequence after four zero bytes (fresh keys per session), 16-byte tag, payload at most 1200 bytes. dc_media_replay_ok is the 64-packet RFC 3711 window and is only advanced after the tag verified, so a forged packet cannot move it. test_media_packet: key agreement mirrors, roundtrip with payload and empty payload, changed header/payload/tag/truncation/wrong key refused, out-of-order delivery inside the window accepted once, replays and packets 64 behind refused, window slide, size/type limits and 1000 random payloads round-tripping; standalone and ASan/UBSan clean. In-tree build pending: a foreign release chain holds the lock (pid 141722).
2026-11-17 07:25:33 +00:00
..