Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
1cee9bb
feat(core): keyed FastCDC chunking, per-chunk zstd, Padmé inner plain…
thearpankumar Nov 10, 2026
1772b46
build: pin zstd-safe and fastcdc behind cargo-deny wrappers and featu…
thearpankumar Nov 10, 2026
a5990ec
test(core): TV-07 vectors from an independent generator for chunking,…
thearpankumar Nov 10, 2026
d69d09f
test(fuzz): add inner_plaintext, decompress, data_blob_open and chunk…
thearpankumar Nov 10, 2026
f586e42
ci: build, lint, fuzz and Miri-test crypthix-core on every platform job
thearpankumar Nov 10, 2026
6827a81
docs: format spec v0.8 and threat model v0.7 for chunking, compressio…
thearpankumar Nov 10, 2026
63ef2cf
test(core): bound every chunk drain so a non-ending chunker mutant fa…
thearpankumar Nov 10, 2026
7366e0c
test(core): fail a test reader on a second read so a retried hard err…
thearpankumar Nov 10, 2026
cd9e53c
ci: give the changed-lines mutants job 90 minutes for PRs that add a …
thearpankumar Nov 10, 2026
7a212ca
fix(core): single-segment frames, block-size and store-raw checks on …
thearpankumar Nov 10, 2026
610a769
test(core): TV-07 pins the data-blob cap, block sizes, store-raw, tru…
thearpankumar Nov 10, 2026
c523936
test(fuzz): per-target seed minimums, a spec-literal chunker oracle a…
thearpankumar Nov 10, 2026
14834d8
build: exact zstd feature allow-list, a static-link check for libzstd…
thearpankumar Nov 10, 2026
7a102fd
ci: test core on Windows per PR and on Intel macOS and i686 nightly, …
thearpankumar Nov 10, 2026
470c105
docs: correct the zstd version, limit and Padmé leak claims, add the …
thearpankumar Nov 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions .cargo/mutants.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,36 @@
# cargo-mutants settings (https://mutants.rs/filter_mutants.html).

# `^` on flags with no bit in common is `|`, so these mutants cannot change behaviour.
#
# Each exclusion is keyed on a function name, so it would also skip a matching mutant added to
# that function later. Each comment names every expression it is meant to cover; after changing
# one of these functions, compare `cargo mutants --workspace --all-features --list` with the
# same command plus `--no-config`: the difference must be exactly these 14 mutants.
exclude_re = [
'replace \| with \^ in (map_secret|anonymous|map_marker)$',
# `^` on flags with no bit in common is `|`, so these mutants cannot change behaviour. In
# crypthix-crypto: the `|` of `ProtFlags::READ | ProtFlags::WRITE` in `map_secret`,
# `anonymous` and `map_marker` (one each). In crypthix-core's `frame_check`: the four `|`
# of `SINGLE_SEGMENT | UNUSED | RESERVED | CHECKSUM | DICT_ID`.
'replace \| with \^ in (map_secret|anonymous|map_marker|frame_check)$',
# `padme`: only the `<` of `len < 2`. padme(2) is 2 by the general formula too (e = 1,
# s = 1, no low bits to clear).
'replace < with <= in padme$',
# crypthix-core's `Decompressor::stream`: only the `==` of `hint == 0` and of
# `(input.pos(), output.pos()) == before`, the two `==` in it (not the `!=` of
# `input.pos() != frame.len()`). frame_check and an output buffer of exactly the declared
# content size let zstd finish the frame in its first call, so whether the loop breaks on
# hint 0 or on no progress never shows; after the frame a further call reads nothing and
# returns a non-zero hint. Both checks stay as defence in depth.
'replace == with != in stream$',
# `cut_with`: only `remaining > params.max` (to `>=`) and `remaining < center` (to `==` or
# `<=`), the one `>` and the one `<` in it (not the `<=` of `remaining <= params.min`).
# Capping a remainder of exactly the maximum at the maximum changes nothing, and neither
# does lowering the centre to a remainder shorter than the average or equal to it: a split
# past the end of the pairs falls back to taking them all as strict pairs, as a split at
# the end does.
'replace > with >= in cut_with$',
'replace < with (==|<=) in cut_with$',
# `StreamChunker::refill`: only the `||` of `self.start > self.end || self.end >
# window.len()`, the one `||` in it. `start <= end <= window.len()` always holds, so the
# defensive check that fails instead of panicking never fires, whichever operator joins
# its halves.
'replace \|\| with && in StreamChunker<.*>::refill$',
]
36 changes: 32 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,18 @@ jobs:
- "tests/**"
- "crates/foundation/types/**"
- "crates/foundation/crypto/**"
- "crates/engine/core/**"
- "xtask/**"
- "Cargo.lock"
- "rust-toolchain.toml"
- ".github/workflows/ci.yml"
crypto:
- "crates/foundation/types/**"
- "crates/foundation/crypto/**"
- "crates/engine/core/**"
- "Cargo.lock"
- "rust-toolchain.toml"
- "xtask/src/zstd_link.rs"
- ".github/workflows/ci.yml"
kernel:
- "crates/foundation/types/**"
Expand All @@ -80,6 +83,7 @@ jobs:
- "tests/Cargo.lock"
- "crates/foundation/types/src/**"
- "crates/foundation/crypto/src/**"
- "crates/engine/core/src/**"
- "xtask/src/side.rs"
- ".github/workflows/ci.yml"
mutants:
Expand Down Expand Up @@ -307,7 +311,8 @@ jobs:

# secure_mem compiles different code on every OS, and the nightly platform runs come too late
# for a pull request, so one other OS's branches are linted here: Windows, cross-compiled on
# Linux, which needs only MinGW's C compiler for the C parts of blake3 and alloca.
# Linux, which needs only MinGW's C compiler for the C parts of blake3, alloca and the libzstd
# that crypthix-core builds from source (zstd-sys).
windows-clippy:
name: Clippy for Windows
needs: changes
Expand All @@ -330,9 +335,30 @@ jobs:
sudo apt-get update
sudo apt-get install -y --no-install-recommends gcc-mingw-w64-x86-64
- run: >-
cargo clippy -p crypthix-crypto --all-features --all-targets --locked
cargo clippy -p crypthix-crypto -p crypthix-core --all-features --all-targets --locked
--target x86_64-pc-windows-gnu -- -D warnings

# crypthix-core's tests on Windows with MSVC, which builds libzstd with cl.exe, so a TV-07
# mismatch or a link problem there shows up on the pull request, not the next night.
windows-test:
name: Test crypthix-core on Windows
needs: changes
# `changes` is skipped on push, so this job must not require it to succeed.
if: ${{ !cancelled() && (github.event_name == 'push' || needs.changes.outputs.crypto == 'true') }}
runs-on: windows-2025
timeout-minutes: 30
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ./.github/actions/setup
with:
cache-key: windows-test
- run: cargo test -p crypthix-core --all-features --locked
- run: cargo xtask check-zstd-link

# Protected key memory on a kernel with the CVE-2026-93243 fix and one without it, booted in
# QEMU with virtme-ng (about 5 minutes per kernel, side by side).
kernel-test:
Expand Down Expand Up @@ -380,7 +406,8 @@ jobs:
needs: changes
if: github.event_name == 'pull_request' && needs.changes.outputs.mutants == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 40
# A PR that adds a whole module brings a few hundred mutants, tested one at a time.
timeout-minutes: 90
permissions:
contents: read
steps:
Expand Down Expand Up @@ -421,6 +448,7 @@ jobs:
- deny
- side
- windows-clippy
- windows-test
- kernel-test
- fuzz-smoke
- mutants
Expand All @@ -431,5 +459,5 @@ jobs:
- uses: re-actors/alls-green@b5b5b37504aa4183270bd3d855c52a67f212be35 # v1.3.0
with:
jobs: ${{ toJSON(needs) }}
allowed-skips: changes, pr, links, side, windows-clippy, kernel-test, fuzz-smoke, mutants
allowed-skips: changes, pr, links, side, windows-clippy, windows-test, kernel-test, fuzz-smoke, mutants
allowed-failures: mutants
61 changes: 54 additions & 7 deletions .github/workflows/scheduled.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Nightly jobs skip the weekly cron ("47 3 * * 1") so Mondays do not run them twice.
#
# Long and broad checks kept off the PR path: deep fuzzing and property tests, Miri, nightly
# doctests, fresh advisories, other platforms, other kernels and coverage every night; full
# mutation testing, links, the full secret history and a runner capability probe every week.
# doctests, fresh advisories, other platforms and i686, other kernels and coverage every night;
# full mutation testing, links, the full secret history and a runner capability probe every week.
#
# A PR that edits this file runs it too, with short time limits, so changes are tested before
# they reach the schedule.
Expand Down Expand Up @@ -52,6 +52,10 @@ jobs:
- id_text
- cx_open
- verifying_key
- inner_plaintext
- decompress
- data_blob_open
- chunker
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand Down Expand Up @@ -114,7 +118,7 @@ jobs:
run: cargo bench --workspace --no-run --locked

miri:
name: Miri (crypthix-types, crypthix-crypto) and nightly doctests
name: Miri (crypthix-types, crypthix-crypto, crypthix-core) and nightly doctests
if: github.event.schedule != '47 3 * * 1'
runs-on: ubuntu-24.04
timeout-minutes: 40
Expand All @@ -135,14 +139,25 @@ jobs:
# Under Miri secure_mem uses its Heap backing, so Miri checks the slot and arena pointer
# logic, SecretVec slices, the open paths and the wipes; the mmap, mprotect, mlock and
# memfd_secret code is compiled out and is covered by the native Linux tests instead
# (tests/secure_mem_linux.rs and the Linux unit tests).
# (tests/secure_mem_linux.rs and the Linux unit tests). For crypthix-core too only the unit
# tests run: Padmé, the inner plaintext, the frame header checks, the cut loop on short input,
# the gear table, key derivation, the meta blobs, and data blobs with raw payloads opened end
# to end (the plain_len cap, Decrypt on each AAD field, Padding, Limit, a payload of the
# wrong length and Binding), since the decompressor makes its zstd context only at the
# first frame. zstd is C, which Miri cannot run, so the tests that call it are ignored
# there, as are megabyte inputs and a 2 MiB window. The property tests that call no zstd
# run here at their scaled-down sizes (the cut loop, Chunks, StreamChunker against memory,
# Padmé and the inner plaintext under mutation); under Miri their byte inputs come from
# one drawn seed at half the length (test_data::bytes), since proptest's tree of one value
# per byte cost more than the tests. The crypthix-core tests take about 4.5 minutes.
- name: cargo miri test
env:
MIRIFLAGS: -Zmiri-disable-isolation
PROPTEST_CASES: "8"
run: |
rustup run nightly-2026-10-15 cargo miri test -p crypthix-types --locked
rustup run nightly-2026-10-15 cargo miri test -p crypthix-crypto --lib --locked
rustup run nightly-2026-10-15 cargo miri test -p crypthix-core --lib --locked
# Only nightly rustdoc checks the error code pinned on a `compile_fail` doctest (such as
# `compile_fail,E0277`); stable runs the doctests on every PR but accepts any error.
- name: Doctest error codes
Expand Down Expand Up @@ -176,7 +191,9 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-15, windows-2025, ubuntu-24.04-arm]
# macos-15-intel builds zstd's x86_64 assembly (the Huffman decoder) with Apple clang,
# which neither the Arm macOS runner nor Linux does.
os: [macos-15, macos-15-intel, windows-2025, ubuntu-24.04-arm]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand All @@ -186,8 +203,38 @@ jobs:
cache-key: platform
# xtask is deliberately cross-platform: the pre-commit hook runs it on every OS.
- run: cargo test --workspace --all-features --locked
# secure_mem's cfg branches differ per OS, so lint the crate where they are compiled.
- run: cargo clippy -p crypthix-crypto --all-features --all-targets --locked -- -D warnings
# secure_mem's cfg branches differ per OS, so lint the crate where they are compiled, and
# crypthix-core with it, whose zstd-sys builds libzstd with each platform's C compiler.
- run: >-
cargo clippy -p crypthix-crypto -p crypthix-core --all-features --all-targets --locked
-- -D warnings
# The libzstd the tests ran against is the one zstd-sys built, linked statically, with
# this platform's C compiler and archiver.
- run: cargo xtask check-zstd-link

# 32-bit x86: usize is 4 bytes, and zstd's encoder takes 32-bit code paths whose output must
# still be the bytes TV-07 pins. Runs on x86_64 Linux with the multilib C toolchain.
i686:
name: Test crypthix-core on i686 Linux
if: github.event.schedule != '47 3 * * 1'
runs-on: ubuntu-24.04
timeout-minutes: 30
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ./.github/actions/setup
with:
cache-key: i686
- name: Install the i686 target and gcc-multilib
run: |
rustup target add i686-unknown-linux-gnu
sudo apt-get update
sudo apt-get install -y --no-install-recommends gcc-multilib
- run: cargo test -p crypthix-core --all-features --locked --target i686-unknown-linux-gnu
- run: cargo xtask check-zstd-link --target i686-unknown-linux-gnu

# The crypto tests in kernels with and without the CVE-2026-93243 fix (kernel-test.yml), so
# the nightly run also notices a change on the runner image or in the tools that breaks them.
Expand Down
1 change: 1 addition & 0 deletions .gitleaks.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ description = "Generated format vectors: keys drawn from the public seed in each
paths = [
'''^tests/test-vectors/crypthix/v0/tv-04-domain-separation\.json$''',
'''^tests/test-vectors/crypthix/v0/tv-05-cx-aead\.json$''',
'''^tests/test-vectors/crypthix/v0/tv-07-chunk-blob\.json$''',
]
54 changes: 54 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ publish = false
# Internal crates other crates depend on. Add an entry when a crate gains its first dependent:
# cargo warns about unused ones (see docs/backlog.md#architecture-rules for the layers).
crypthix-types = { path = "crates/foundation/types" }
crypthix-crypto = { path = "crates/foundation/crypto" }
crypthix-testkit = { path = "crates/foundation/testkit" }

# External crates.
Expand Down
2 changes: 1 addition & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
doc-valid-idents = ["CryptHix", "RabbitMQ", "WinFsp", "FSKit", "BPF-LSM", ".."]
doc-valid-idents = ["CryptHix", "RabbitMQ", "WinFsp", "FSKit", "BPF-LSM", "FastCDC", ".."]
allow-unwrap-in-tests = true
allow-expect-in-tests = true
Loading
Loading