Skip to content

Chunking, compression and padding (E1, E2, E3) - #3

Open
thearpankumar wants to merge 15 commits into
masterfrom
feat/e1-e3-chunk-compress-pad
Open

thearpankumar wants to merge 15 commits into
masterfrom
feat/e1-e3-chunk-compress-pad

Conversation

@thearpankumar

Copy link
Copy Markdown
Owner

Implements the backlog item Chunking, compression and padding (E1, E2, E3) in crates/engine/core (format spec 10.1–10.4).

What landed

  • Chunking (FS-52):
    • Ordinary objects use keyed FastCDC 2020 at level 2 (64 / 256 / 1024 KiB). The gear table is derived from K_gear and kept in a SecretBuf.
    • The chunker is our own implementation, tested against fastcdc 5.0.0.
    • Secret-class objects are cut into fixed 1 MiB chunks, with no gear lookups.
  • Compression (FS-53):
    • zstd level 3 through zstd-safe 8.2.0 (libzstd 1.5.7, pinned and checked at run time).
    • A chunk is stored raw if 16·frame > 15·plain.
    • Secret-class chunks are never compressed.
    • The reader checks the frame strictly: one frame, no checksum, no dictionary ID, unused bit clear, shortest content-size field equal to plain_len, window ≤ 2^20.
  • Padding (FS-54): Padmé-padded inner plaintext, checked in a fixed order.
  • Blobs (FS-55–57):
    • ObjectSealer / ObjectOpener bind the keys, the object and its class.
    • Blob IDs are keyed only for ordinary objects with two or more chunks. The chunker decides that from the object's shape.
    • The open order is fixed: cap, AEAD, inner plaintext, secret+zstd, frame, binding.
    • Meta blobs use a MetaKey bound to its context.
  • Tests:
    • TV-07: 140 vectors from an independent generator, with forced chunking edge cases.
    • Four fuzz targets, proptests, benches.
    • Miri covers the raw open path.
    • cargo-mutants: no missed mutants on the new files; 6 equivalent mutants are excluded.
  • Supply chain: cargo-deny wrappers and feature bans for zstd and fastcdc. xtask rejects system-zstd overrides.
  • Docs: format spec v0.8 and threat model v0.7. These cover the T-84 residual (ePrint 2025/558), mixed-trust ordinary objects under T-40 (Fábrega et al.), and R-26 (zstd memory on the C heap). The backlog item is ticked.

Review

Three independent reviewers (tests, code quality, security) went over the change. Their findings were fixed in six batches.

🤖 Generated with Claude Code

…re bans, and reject system zstd overrides in xtask
…read, a sealer bound to its chunker, and a test-only API surface
…, RUSTFLAGS and patch override guards, per-target fuzz lengths
…and check the libzstd link on every platform
…dedup injection residual and OQ-19, record chunk reuse for the pipeline
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.

1 participant