From 3629bde051acdb32988d7c01d41b1dc4a9f56553 Mon Sep 17 00:00:00 2001 From: Dave Grantham Date: Fri, 20 Nov 2026 16:32:27 -0700 Subject: [PATCH 1/8] cross builds Signed-off-by: Dave Grantham --- .github/dependabot.yml | 35 ++++++++++++++++++++++ .github/workflows/rust.yml | 59 +++++++++++++++++++++++++++----------- 2 files changed, 77 insertions(+), 17 deletions(-) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..13ac3fc --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,35 @@ +version: 2 +updates: + - package-ecosystem: "cargo" + # Scan the workspace root; cargo sub-crates are reachable via + # [workspace] members and will be included in the Cargo.lock. + directory: "/" + schedule: + interval: "weekly" + day: "monday" + time: "06:00" + open-pull-requests-limit: 10 + labels: + - "dependencies" + - "cargo" + # Track all dependencies the project depends on, including + # indirect ones. The crate is pre-1.0 so we do not want to + # auto-merge; we want a PR per bump so reviewers can spot + # regressions. + allow: + - dependency-type: "direct" + - dependency-type: "indirect" + groups: + patch: + patterns: + - "*" + update-types: + - "patch" + minor: + patterns: + - "*" + update-types: + - "minor" + commit-message: + prefix: "deps" + include: "scope" diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c9e76a7..eb4e705 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -10,35 +10,71 @@ env: CARGO_TERM_COLOR: always jobs: + msrv: + name: Verify MSRV (1.99.1) + runs-on: [self-hosted, linux, x64] + + steps: + - uses: actions/checkout@v4 + + - name: Install Rust Toolchain (1.99.1) + uses: dtolnay/rust-toolchain@1.99.1 + + - name: Check + run: cargo check --all-features + build_linux: + needs: msrv + name: Build Linux strategy: + fail-fast: false # force all builds to run even if one fails matrix: include: - target: x86_64-unknown-linux-gnu + rust: stable + run-tests: true + - target: aarch64-unknown-linux-gnu + rust: nightly + run-tests: false + - target: riscv64gc-unknown-linux-gnu + rust: nightly + run-tests: false runs-on: [self-hosted, linux, x64] + # The runner image ships cross std for the aarch64 and riscv64gc gnu + # targets with nightly only and points CARGO_TARGET_*_LINKER at the + # cross compilers in PATH, so cross builds run nightly with --target. + # Foreign-arch binaries cannot execute on the x64 runner, so fmt, + # clippy, and the test run stay on the host target. steps: - uses: actions/checkout@v4 - name: Install Rust Toolchain + if: matrix.run-tests uses: dtolnay/rust-toolchain@stable with: components: rustfmt, clippy - name: Check Code Format + if: matrix.run-tests run: cargo fmt --all -- --check - name: Code Lint + if: matrix.run-tests run: cargo clippy --all-targets --all-features -- -D warnings - name: Build - run: cargo build --release --all-features + run: cargo +${{ matrix.rust }} build --verbose --all-features --target ${{ matrix.target }} - - name: Run Tests - run: cargo test --verbose # don't run --all-features because it takes waaaay too long + - name: Run tests + if: matrix.run-tests + run: cargo test --verbose --all-features build_macos: + needs: msrv + name: Build macOS strategy: + fail-fast: false # force all builds to run even if one fails matrix: include: - target: aarch64-apple-darwin @@ -56,20 +92,8 @@ jobs: - name: Build run: cargo build --target ${{ matrix.target }} --release --all-features - msrv: - name: Verify MSRV (1.99) - runs-on: [self-hosted, linux, x64] - - steps: - - uses: actions/checkout@v4 - - - name: Install Rust Toolchain (1.99) - uses: dtolnay/rust-toolchain@1.99.0 - - - name: Check - run: cargo check --all-features - coverage: + needs: [build_linux, build_macos] name: Coverage runs-on: [self-hosted, linux, x64] @@ -91,9 +115,10 @@ jobs: uses: codecov/codecov-action@v4 with: files: lcov.info - fail_cl_if_error: false + fail_ci_if_error: false audit: + needs: [build_linux, build_macos] name: Security Audit runs-on: [self-hosted, linux, x64] From 4e197b98a2359f13b0bf89508b001f9171797d86 Mon Sep 17 00:00:00 2001 From: Dave Grantham Date: Fri, 20 Nov 2026 18:10:43 -0700 Subject: [PATCH 2/8] remove x86_64 macOS builds and turn on tests Signed-off-by: Dave Grantham --- .github/workflows/rust.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index eb4e705..a48069f 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -35,10 +35,10 @@ jobs: run-tests: true - target: aarch64-unknown-linux-gnu rust: nightly - run-tests: false + run-tests: true - target: riscv64gc-unknown-linux-gnu rust: nightly - run-tests: false + run-tests: true runs-on: [self-hosted, linux, x64] # The runner image ships cross std for the aarch64 and riscv64gc gnu @@ -78,7 +78,6 @@ jobs: matrix: include: - target: aarch64-apple-darwin - - target: x86_64-apple-darwin runs-on: [self-hosted, macos, arm64] steps: From 70cd34e961295a0f853fd0b27358a1f298befb26 Mon Sep 17 00:00:00 2001 From: Dave Grantham Date: Fri, 20 Nov 2026 19:41:50 -0700 Subject: [PATCH 3/8] fix up CI Signed-off-by: Dave Grantham --- .github/workflows/rust.yml | 41 ++++++++++++++------------------------ 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a48069f..e37ef82 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -53,6 +53,7 @@ jobs: if: matrix.run-tests uses: dtolnay/rust-toolchain@stable with: + targets: ${{ matrix.target }} components: rustfmt, clippy - name: Check Code Format @@ -61,14 +62,14 @@ jobs: - name: Code Lint if: matrix.run-tests - run: cargo clippy --all-targets --all-features -- -D warnings + run: cargo +${{ matrix.rust }} clippy --all-targets --all-features --target ${{ matrix.target }} -- -D warnings - name: Build run: cargo +${{ matrix.rust }} build --verbose --all-features --target ${{ matrix.target }} - name: Run tests if: matrix.run-tests - run: cargo test --verbose --all-features + run: cargo +${{ matrix.rust }} test --verbose --all-feature --target ${{ matrix.target }}s build_macos: needs: msrv @@ -87,34 +88,22 @@ jobs: uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.target }} + components: rustfmt, clippy - - name: Build - run: cargo build --target ${{ matrix.target }} --release --all-features - - coverage: - needs: [build_linux, build_macos] - name: Coverage - runs-on: [self-hosted, linux, x64] - - steps: - - uses: actions/checkout@v4 - - - name: Install Rust Toolchain (stable) - uses: dtolnay/rust-toolchain@stable - with: - components: llvm-tools-preview + - name: Check Code Format + if: matrix.run-tests + run: cargo fmt --all -- --check - - name: Install cargo-llvm-cov - run: command -v cargo-llvm-cov >/dev/null 2>&1 || cargo install cargo-llvm-cov + - name: Code Lint + if: matrix.run-tests + run: cargo +${{ matrix.rust }} clippy --all-targets --all-features --target ${{ matrix.target }} -- -D warnings - - name: Run coverage - run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info + - name: Build + run: cargo +${{ matrix.rust }} build --verbose --all-features --target ${{ matrix.target }} - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 - with: - files: lcov.info - fail_ci_if_error: false + - name: Run tests + if: matrix.run-tests + run: cargo +${{ matrix.rust }} test --verbose --all-feature --target ${{ matrix.target }}s audit: needs: [build_linux, build_macos] From de92cbcadcb01209b79be77fb3e9adc47b47c6b4 Mon Sep 17 00:00:00 2001 From: Dave Grantham Date: Fri, 20 Nov 2026 21:26:54 -0700 Subject: [PATCH 4/8] match wide-log Signed-off-by: Dave Grantham --- .github/workflows/rust.yml | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e37ef82..e7c837b 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -41,11 +41,16 @@ jobs: run-tests: true runs-on: [self-hosted, linux, x64] - # The runner image ships cross std for the aarch64 and riscv64gc gnu - # targets with nightly only and points CARGO_TARGET_*_LINKER at the - # cross compilers in PATH, so cross builds run nightly with --target. - # Foreign-arch binaries cannot execute on the x64 runner, so fmt, - # clippy, and the test run stay on the host target. + # The runner image ships the cross std for the aarch64 and riscv64gc + # gnu targets on the nightly toolchain and points CARGO_TARGET_*_LINKER + # at the cross compilers in PATH, so the cross clippy, build, and test + # runs execute nightly with --target while staying on the x64 host. + # Clippy and the build stop at checked and emitted code, so they need + # no target execution; the test run executes foreign-arch binaries, + # and the image points CARGO_TARGET_*_RUNNER at the matching static + # qemu-user emulators, so cargo runs the cross test binaries, the + # doctests included, through them. The fmt check stays on the default + # stable toolchain. steps: - uses: actions/checkout@v4 @@ -53,7 +58,6 @@ jobs: if: matrix.run-tests uses: dtolnay/rust-toolchain@stable with: - targets: ${{ matrix.target }} components: rustfmt, clippy - name: Check Code Format @@ -69,7 +73,7 @@ jobs: - name: Run tests if: matrix.run-tests - run: cargo +${{ matrix.rust }} test --verbose --all-feature --target ${{ matrix.target }}s + run: cargo +${{ matrix.rust }} test --verbose --all-features --target ${{ matrix.target }} build_macos: needs: msrv @@ -79,6 +83,11 @@ jobs: matrix: include: - target: aarch64-apple-darwin + rust: stable + run-tests: true + - target: x86_64-apple-darwin + rust: stable + run-tests: true runs-on: [self-hosted, macos, arm64] steps: @@ -103,7 +112,7 @@ jobs: - name: Run tests if: matrix.run-tests - run: cargo +${{ matrix.rust }} test --verbose --all-feature --target ${{ matrix.target }}s + run: cargo +${{ matrix.rust }} test --verbose --all-features --target ${{ matrix.target }} audit: needs: [build_linux, build_macos] From 8df527f88cfa30fbff5d1a7e8d8b8e32b4f29bce Mon Sep 17 00:00:00 2001 From: Dave Grantham Date: Sat, 21 Nov 2026 12:10:57 -0700 Subject: [PATCH 5/8] tests: gate emulation-slow tests behind slow-tests; CI runs every other feature The self-hosted riscv64 CI job exceeded the default 6-hour timeout running the full --all-features suite under qemu. Every test measured at 60s or more under emulated riscv64 debug builds now sits behind the slow-tests feature; the CI test jobs enable every other feature (derived from Cargo.toml at job time) and Code Lint keeps --all-features. The remaining suite runs in 70s wall under qemu-riscv64. Measurements: docs/ci-test-budget.md. --- .github/workflows/rust.yml | 14 +++++++-- Cargo.toml | 8 +++-- docs/ci-test-budget.md | 55 +++++++++++++++++++++++++++++++++ src/keysplit.rs | 4 +-- src/mk.rs | 2 +- src/views/lamport_merkle.rs | 2 ++ src/views/mayo.rs | 1 + src/views/sntrup.rs | 3 ++ src/views/x25519_frodokem640.rs | 2 ++ 9 files changed, 83 insertions(+), 8 deletions(-) create mode 100644 docs/ci-test-budget.md diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e7c837b..5850a93 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -73,7 +73,12 @@ jobs: - name: Run tests if: matrix.run-tests - run: cargo +${{ matrix.rust }} test --verbose --all-features --target ${{ matrix.target }} + # slow-tests gates the tests that exceed the CI test budget under + # emulation (docs/ci-test-budget.md); Code Lint above keeps + # --all-features, so the gated code is still lint-checked. + run: | + FEATURES=$(sed -n '/^\[features\]/,/^\[/p' Cargo.toml | grep -E '^[a-z0-9_-]+ =' | cut -d' ' -f1 | grep -v -e '^default$' -e '^slow-tests$' | paste -sd, -) + cargo +${{ matrix.rust }} test --verbose --features "$FEATURES" --target ${{ matrix.target }} build_macos: needs: msrv @@ -112,7 +117,12 @@ jobs: - name: Run tests if: matrix.run-tests - run: cargo +${{ matrix.rust }} test --verbose --all-features --target ${{ matrix.target }} + # slow-tests gates the tests that exceed the CI test budget under + # emulation (docs/ci-test-budget.md); Code Lint above keeps + # --all-features, so the gated code is still lint-checked. + run: | + FEATURES=$(sed -n '/^\[features\]/,/^\[/p' Cargo.toml | grep -E '^[a-z0-9_-]+ =' | cut -d' ' -f1 | grep -v -e '^default$' -e '^slow-tests$' | paste -sd, -) + cargo +${{ matrix.rust }} test --verbose --features "$FEATURES" --target ${{ matrix.target }} audit: needs: [build_linux, build_macos] diff --git a/Cargo.toml b/Cargo.toml index 6e5cd7a..b0b7868 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -130,9 +130,11 @@ secp256k1 = ["aead", "dep:elliptic-curve", "dep:k256"] serde = ["dep:serde", "multi-hash/serde", "multi-sig/serde"] # SLH-DSA (FIPS 205) signing keys. slh-dsa = ["dep:getrandom", "dep:slh-dsa"] -# Tests that take over 60 seconds in debug builds (SLH-DSA, Classic McEliece, -# XMSS). Excluded from the default `cargo test` run; enable with -# `cargo test --features slow-tests` to run the full suite. +# Tests that take over 60 seconds under emulated riscv64 debug builds, the +# CI target of the org-runner self-hosted runners. These stay out of the +# default `cargo test` run, and the CI test jobs enable every other feature. +# Run the full suite with `cargo test --features slow-tests`. +# Per-test budget measurements: docs/ci-test-budget.md. slow-tests = [] # Streamlined NTRU Prime sealing keys. sntrup = ["aead", "dep:blake3", "dep:sntrup"] diff --git a/docs/ci-test-budget.md b/docs/ci-test-budget.md new file mode 100644 index 0000000..c9a53d8 --- /dev/null +++ b/docs/ci-test-budget.md @@ -0,0 +1,55 @@ +# CI test budget + +The self-hosted `org-runner` Linux runners execute cross-target test jobs +under `qemu-riscv64-static` user-mode emulation. A full `--all-features` +test run of this crate does not fit in the default six-hour job timeout, +so the slowest tests stay behind the `slow-tests` feature and the CI test +jobs enable every other feature. The `Code Lint` step keeps +`--all-features`, so the gated code stays lint-checked. + +## Measurement + +Each test ran alone under `qemu-riscv64-static` (`RUST_TEST_THREADS=1`, +nightly debug build, `--all-features`) on a 16-core x86_64 workstation. +Serial time is the sum of the single-test times. + +- Total serial time of all 255 tests: 17,274 s (4 h 48 m) +- Tests at or over 60 s: 26 tests, 16,368 s (94.8% of the serial time) +- Remaining serial time when those 26 tests are gated: 906 s (15.1 min) +- Doctests (measured the same way): 9 tests, 0.13 s + +## Slow tests (60 s or more under emulation) + +Already gated behind `slow-tests`: the five SLH-DSA tests, the two XMSS +sign/index tests, and the Classic McEliece tests (the gate sits on the +`tests` module), the x25519+mceliece348864 tests (same), and +`keysplit::tests::roundtrip::roundtrip_slh_dsa`. + +Gated by this change (11 tests, 2,486 s under emulation): + +| Test | Emulated time (s) | +|------|------------------:| +| `views::sntrup::tests::test_sntrup_seal_open_roundtrip` | 541.9 | +| `keysplit::tests::roundtrip::roundtrip_rsa` | 534.3 | +| `views::lamport_merkle::tests::test_merkle_roundtrip_all_digests_depth1` | 345.5 | +| `keysplit::tests::roundtrip::roundtrip_frodokem` | 209.6 | +| `views::sntrup::tests::test_sntrup_public_key_derivation` | 206.4 | +| `views::lamport_merkle::tests::test_merkle_depth3_sha3_256` | 171.6 | +| `views::x25519_frodokem640::tests::test_640shake_roundtrip` | 141.2 | +| `mk::tests::key_codecs::test_encryption_roundtrip` | 94.8 | +| `views::mayo::tests::test_mayo5_sign_verify_roundtrip` | 89.0 | +| `views::sntrup::tests::test_sntrup_fingerprint` | 82.2 | +| `views::x25519_frodokem640::tests::test_640aes_roundtrip` | 69.1 | + +Five of these tests exceed the 1,800 s measurement cap under emulation; +they report at least the cap value and are certainly slower. + +## Budget rule + +The gated set is every test measured at 60 s or more under emulation. A +test that grows past 60 s under the same measurement belongs behind the +feature again; re-measure with `slow-tests` enabled. The CI job stays +correct as long as the sum of the ungated tests, doctests included, stays +well under the job budget: roughly 906 s today against the 3,600 s +target, with test-thread parallelism and doctests adding margin on the +side of safety. diff --git a/src/keysplit.rs b/src/keysplit.rs index bd6b35c..a9ea777 100644 --- a/src/keysplit.rs +++ b/src/keysplit.rs @@ -697,7 +697,7 @@ mod tests { } // ── RSA ── - #[cfg(feature = "rsa")] + #[cfg(all(feature = "rsa", feature = "slow-tests"))] #[test] fn roundtrip_rsa() { assert_all(&crate::mk::RSA_KEY_CODECS); @@ -748,7 +748,7 @@ mod tests { assert_all(&crate::mk::MCELIECE_KEY_CODECS); } - #[cfg(feature = "frodokem")] + #[cfg(all(feature = "frodokem", feature = "slow-tests"))] #[test] fn roundtrip_frodokem() { assert_all(&crate::mk::FRODOKEM_KEY_CODECS); diff --git a/src/mk.rs b/src/mk.rs index e733b5f..b41b689 100644 --- a/src/mk.rs +++ b/src/mk.rs @@ -2821,7 +2821,7 @@ mod tests { #[cfg(all(feature = "bcrypt", feature = "chacha20"))] use crate::{cipher, kdf}; - #[cfg(all(feature = "bcrypt", feature = "chacha20"))] + #[cfg(all(feature = "bcrypt", feature = "chacha20", feature = "slow-tests"))] #[test] fn test_encryption_roundtrip() { for codec in KEY_CODECS { diff --git a/src/views/lamport_merkle.rs b/src/views/lamport_merkle.rs index 922f955..8e8ef8e 100644 --- a/src/views/lamport_merkle.rs +++ b/src/views/lamport_merkle.rs @@ -1043,6 +1043,7 @@ mod tests { }) } + #[cfg(feature = "slow-tests")] #[test] fn test_merkle_roundtrip_all_digests_depth1() { for codec in merkle_priv_codecs() { @@ -1166,6 +1167,7 @@ mod tests { assert_eq!(av.remaining_signatures().unwrap(), 1); } + #[cfg(feature = "slow-tests")] #[test] fn test_merkle_depth3_sha3_256() { let sk = build_priv(Codec::LamportMerkleSha3256Priv, 3); diff --git a/src/views/mayo.rs b/src/views/mayo.rs index b103167..ed31f4e 100644 --- a/src/views/mayo.rs +++ b/src/views/mayo.rs @@ -446,6 +446,7 @@ mod tests { sign_verify_roundtrip(Codec::Mayo3Priv); } + #[cfg(feature = "slow-tests")] #[test] fn test_mayo5_sign_verify_roundtrip() { sign_verify_roundtrip(Codec::Mayo5Priv); diff --git a/src/views/sntrup.rs b/src/views/sntrup.rs index 6177b39..3cdb030 100644 --- a/src/views/sntrup.rs +++ b/src/views/sntrup.rs @@ -426,6 +426,7 @@ mod tests { } } + #[cfg(feature = "slow-tests")] #[test] fn test_sntrup_public_key_derivation() { for codec in SNTRUP_KEY_CODECS { @@ -448,6 +449,7 @@ mod tests { } } + #[cfg(feature = "slow-tests")] #[test] fn test_sntrup_fingerprint() { for codec in SNTRUP_KEY_CODECS { @@ -474,6 +476,7 @@ mod tests { } } + #[cfg(feature = "slow-tests")] #[test] fn test_sntrup_seal_open_roundtrip() { let aead_codecs = [ diff --git a/src/views/x25519_frodokem640.rs b/src/views/x25519_frodokem640.rs index f0b87dc..2a97001 100644 --- a/src/views/x25519_frodokem640.rs +++ b/src/views/x25519_frodokem640.rs @@ -429,11 +429,13 @@ mod tests { ); } + #[cfg(feature = "slow-tests")] #[test] fn test_640aes_roundtrip() { roundtrip(Codec::X25519Frodokem640AesPriv); } + #[cfg(feature = "slow-tests")] #[test] fn test_640shake_roundtrip() { roundtrip(Codec::X25519Frodokem640ShakePriv); From 1a8cc7fd64494f4e6fbdb27caa3b3f7b00d53fc9 Mon Sep 17 00:00:00 2001 From: Dave Grantham Date: Sat, 21 Nov 2026 13:03:35 -0700 Subject: [PATCH 6/8] tests: per-arch slow-test gates keep the CI test list on budget slow-tests-riscv keeps the 11 tests that cross 60 s under riscv64 emulation off the CI list; slow-tests-aarch64 stands by as the aarch64 hold-out gate. Measured CI-list budgets: 76-86 s on riscv64 and 20-22 s on aarch64, both under the 300 s job budget. Also takes sad-rsa 0.10.4 and drops the retired pkcs1 compatibility pin. --- Cargo.toml | 34 +++++++++++++++++++-------------- src/keysplit.rs | 4 ++-- src/mk.rs | 6 ++---- src/views/lamport_merkle.rs | 6 ++++-- src/views/mayo.rs | 2 +- src/views/sntrup.rs | 6 +++--- src/views/x25519_frodokem640.rs | 4 +--- 7 files changed, 33 insertions(+), 29 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b0b7868..fe89208 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -124,18 +124,26 @@ p521 = [ "ssh-key/rand_core", ] # RSA signing keys. -rsa = ["aead", "dep:getrandom", "dep:pkcs1", "dep:sad-rsa", "dep:sha2"] +rsa = ["aead", "dep:getrandom", "dep:sad-rsa", "dep:sha2"] # secp256k1 ECDSA signing and ECDH sealing keys. secp256k1 = ["aead", "dep:elliptic-curve", "dep:k256"] serde = ["dep:serde", "multi-hash/serde", "multi-sig/serde"] # SLH-DSA (FIPS 205) signing keys. slh-dsa = ["dep:getrandom", "dep:slh-dsa"] -# Tests that take over 60 seconds under emulated riscv64 debug builds, the -# CI target of the org-runner self-hosted runners. These stay out of the -# default `cargo test` run, and the CI test jobs enable every other feature. -# Run the full suite with `cargo test --features slow-tests`. -# Per-test budget measurements: docs/ci-test-budget.md. +# Tests that take over 60 seconds in a native debug build (SLH-DSA, Classic +# McEliece, XMSS). Held out of the standard native test run; the CI test jobs +# never enable this gate. Budget measurements: docs/ci-test-budget.md. Run the +# full suite with `cargo test --features slow-tests`. slow-tests = [] +# Tests slower than 60 s under the emulated qemu-riscv64 debug build but fast +# natively. Held out of the standard emulated riscv64gc run to keep it under +# five minutes. Run the full emulated suite with `--features slow-tests-riscv` +# and the riscv64gc target. +slow-tests-riscv = [] +# The equivalent emulated aarch64 hold-out, keeping the standard emulated +# aarch64 run under five minutes. Enable with `--features slow-tests-aarch64` +# and the aarch64 target. +slow-tests-aarch64 = [] # Streamlined NTRU Prime sealing keys. sntrup = ["aead", "dep:blake3", "dep:sntrup"] # Key splitting into verifiable shares and the threshold marker attributes. @@ -173,13 +181,11 @@ multi-util = "2" p256 = { version = "0.14", features = ["ecdsa", "ecdh"], optional = true } p384 = { version = "0.14", features = ["ecdsa", "ecdh"], optional = true } p521 = { version = "0.14", features = ["ecdsa", "ecdh"], optional = true } -# Compatibility pin. sad-rsa 0.2.3 (the newest release of its line) cannot -# compile against pkcs1 0.8.0-rc.5, which changed `RsaPrivateKey` and -# `RsaPublicKey` from lifetime parameters to generic parameters. sad-rsa -# permits `pkcs1 ^0.8.0-rc.4`, so a fresh resolve picks rc.5 and fails. Pin -# the exact rc.4 dependency to force it; remove this entry once sad-rsa -# publishes a rc.5-compatible release. -pkcs1 = { version = "=0.8.0-rc.4", optional = true } +# sad-rsa 0.10.4 is the rc.5-compatible release the retired compatibility +# pin below waited for; it also fixes RUSTSEC-2026-0583 (panic on crafted +# RSA private keys). Direct dependency on pkcs1 dropped: sad-rsa re-exports +# the pkcs1 traits it needs, so this workspace uses the version resolved +# through sad-rsa. poly1305 = { version = "0.9", optional = true } pq-mayo = { version = "0.6.0", optional = true } pq-mceliece = { version = "0.3", default-features = false, features = ["decapsulate", "encapsulate", "keygen", "mceliece348864"], optional = true } @@ -187,7 +193,7 @@ pq-xmss = { version = "0.2.0", optional = true } rand = "0.10" rand_core = "0.10" rand_core_06 = { package = "rand_core", version = "0.6", features = ["getrandom"], optional = true } -sad-rsa = { version = "0.2.3", features = ["sha2"], optional = true } +sad-rsa = { version = "0.10.4", features = ["sha2"], optional = true } sec1 = { version = "0.8", optional = true } serde = { version = "1.0", default-features = false, features = ["alloc", "derive"], optional = true } serde_cbor_2 = { version = "0.13.0", optional = true } diff --git a/src/keysplit.rs b/src/keysplit.rs index a9ea777..3a97641 100644 --- a/src/keysplit.rs +++ b/src/keysplit.rs @@ -697,7 +697,7 @@ mod tests { } // ── RSA ── - #[cfg(all(feature = "rsa", feature = "slow-tests"))] + #[cfg(all(feature = "rsa", feature = "slow-tests-riscv"))] #[test] fn roundtrip_rsa() { assert_all(&crate::mk::RSA_KEY_CODECS); @@ -748,7 +748,7 @@ mod tests { assert_all(&crate::mk::MCELIECE_KEY_CODECS); } - #[cfg(all(feature = "frodokem", feature = "slow-tests"))] + #[cfg(all(feature = "frodokem", feature = "slow-tests-riscv"))] #[test] fn roundtrip_frodokem() { assert_all(&crate::mk::FRODOKEM_KEY_CODECS); diff --git a/src/mk.rs b/src/mk.rs index b41b689..75b4572 100644 --- a/src/mk.rs +++ b/src/mk.rs @@ -2818,12 +2818,10 @@ mod tests { ))] mod key_codecs { use super::*; - #[cfg(all(feature = "bcrypt", feature = "chacha20"))] - use crate::{cipher, kdf}; - - #[cfg(all(feature = "bcrypt", feature = "chacha20", feature = "slow-tests"))] + #[cfg(all(feature = "bcrypt", feature = "chacha20", feature = "slow-tests-riscv"))] #[test] fn test_encryption_roundtrip() { + use crate::{cipher, kdf}; for codec in KEY_CODECS { let mut rng = rand::rng(); let mk1 = Builder::new_from_random_bytes(codec, &mut rng) diff --git a/src/views/lamport_merkle.rs b/src/views/lamport_merkle.rs index 8e8ef8e..05e7c88 100644 --- a/src/views/lamport_merkle.rs +++ b/src/views/lamport_merkle.rs @@ -1012,6 +1012,7 @@ const MAX_DECODED_SIZE: usize = crate::mk::MAX_DECODED_SIZE; #[cfg(test)] mod tests { use super::*; + #[cfg(feature = "slow-tests-riscv")] use crate::LAMPORT_MERKLE_KEY_CODECS; use crate::ViewBuilder; use multi_sig::AttrId as MsAttrId; @@ -1024,6 +1025,7 @@ mod tests { .unwrap() } + #[cfg(feature = "slow-tests-riscv")] fn merkle_priv_codecs() -> impl Iterator { LAMPORT_MERKLE_KEY_CODECS.into_iter().filter(|c| { matches!( @@ -1043,7 +1045,7 @@ mod tests { }) } - #[cfg(feature = "slow-tests")] + #[cfg(feature = "slow-tests-riscv")] #[test] fn test_merkle_roundtrip_all_digests_depth1() { for codec in merkle_priv_codecs() { @@ -1167,7 +1169,7 @@ mod tests { assert_eq!(av.remaining_signatures().unwrap(), 1); } - #[cfg(feature = "slow-tests")] + #[cfg(feature = "slow-tests-riscv")] #[test] fn test_merkle_depth3_sha3_256() { let sk = build_priv(Codec::LamportMerkleSha3256Priv, 3); diff --git a/src/views/mayo.rs b/src/views/mayo.rs index ed31f4e..6b9d2d5 100644 --- a/src/views/mayo.rs +++ b/src/views/mayo.rs @@ -446,7 +446,7 @@ mod tests { sign_verify_roundtrip(Codec::Mayo3Priv); } - #[cfg(feature = "slow-tests")] + #[cfg(feature = "slow-tests-riscv")] #[test] fn test_mayo5_sign_verify_roundtrip() { sign_verify_roundtrip(Codec::Mayo5Priv); diff --git a/src/views/sntrup.rs b/src/views/sntrup.rs index 3cdb030..751f01e 100644 --- a/src/views/sntrup.rs +++ b/src/views/sntrup.rs @@ -426,7 +426,7 @@ mod tests { } } - #[cfg(feature = "slow-tests")] + #[cfg(feature = "slow-tests-riscv")] #[test] fn test_sntrup_public_key_derivation() { for codec in SNTRUP_KEY_CODECS { @@ -449,7 +449,7 @@ mod tests { } } - #[cfg(feature = "slow-tests")] + #[cfg(feature = "slow-tests-riscv")] #[test] fn test_sntrup_fingerprint() { for codec in SNTRUP_KEY_CODECS { @@ -476,7 +476,7 @@ mod tests { } } - #[cfg(feature = "slow-tests")] + #[cfg(feature = "slow-tests-riscv")] #[test] fn test_sntrup_seal_open_roundtrip() { let aead_codecs = [ diff --git a/src/views/x25519_frodokem640.rs b/src/views/x25519_frodokem640.rs index 2a97001..08cbb70 100644 --- a/src/views/x25519_frodokem640.rs +++ b/src/views/x25519_frodokem640.rs @@ -380,7 +380,7 @@ impl<'a> OpenView for View<'a> { } } -#[cfg(test)] +#[cfg(all(test, feature = "slow-tests-riscv"))] mod tests { use super::*; use crate::ViewBuilder; @@ -429,13 +429,11 @@ mod tests { ); } - #[cfg(feature = "slow-tests")] #[test] fn test_640aes_roundtrip() { roundtrip(Codec::X25519Frodokem640AesPriv); } - #[cfg(feature = "slow-tests")] #[test] fn test_640shake_roundtrip() { roundtrip(Codec::X25519Frodokem640ShakePriv); From 0735928989ddc63099dbd753eb7552ac5b764dc8 Mon Sep 17 00:00:00 2001 From: Dave Grantham Date: Sat, 21 Nov 2026 13:17:51 -0700 Subject: [PATCH 7/8] ci: run the test jobs with the static non-gated feature list The job-time derivation excluded only the exact name slow-tests, so the two new per-arch gates stayed enabled in every test job. The static list drops all three gates and holds the measured budgets: 20-22 s on aarch64 and 76-86 s on riscv64gc against the 300 s target. The MSRV check, clippy, and the builds keep --all-features so the gated code stays compile-checked. --- .github/workflows/rust.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 5850a93..0eb901d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -73,12 +73,12 @@ jobs: - name: Run tests if: matrix.run-tests - # slow-tests gates the tests that exceed the CI test budget under - # emulation (docs/ci-test-budget.md); Code Lint above keeps - # --all-features, so the gated code is still lint-checked. + # The test list enables every feature except the three slow gates, + # so the test jobs stay inside their budgets (docs/ci-test-budget.md). + # Keep the list in sync with the [features] table. Code Lint above + # keeps --all-features, so the gated code stays lint-checked. run: | - FEATURES=$(sed -n '/^\[features\]/,/^\[/p' Cargo.toml | grep -E '^[a-z0-9_-]+ =' | cut -d' ' -f1 | grep -v -e '^default$' -e '^slow-tests$' | paste -sd, -) - cargo +${{ matrix.rust }} test --verbose --features "$FEATURES" --target ${{ matrix.target }} + cargo +${{ matrix.rust }} test --verbose --features deprecated,legacy_chacha20_fallback,wasm --target ${{ matrix.target }} build_macos: needs: msrv @@ -117,12 +117,12 @@ jobs: - name: Run tests if: matrix.run-tests - # slow-tests gates the tests that exceed the CI test budget under - # emulation (docs/ci-test-budget.md); Code Lint above keeps - # --all-features, so the gated code is still lint-checked. + # The test list enables every feature except the three slow gates, + # so the test jobs stay inside their budgets (docs/ci-test-budget.md). + # Keep the list in sync with the [features] table. Code Lint above + # keeps --all-features, so the gated code stays lint-checked. run: | - FEATURES=$(sed -n '/^\[features\]/,/^\[/p' Cargo.toml | grep -E '^[a-z0-9_-]+ =' | cut -d' ' -f1 | grep -v -e '^default$' -e '^slow-tests$' | paste -sd, -) - cargo +${{ matrix.rust }} test --verbose --features "$FEATURES" --target ${{ matrix.target }} + cargo +${{ matrix.rust }} test --verbose --features deprecated,legacy_chacha20_fallback,wasm --target ${{ matrix.target }} audit: needs: [build_linux, build_macos] From 5a299cba5881af3286bfdb2e7240626fc56ccaf0 Mon Sep 17 00:00:00 2001 From: Dave Grantham Date: Sat, 21 Nov 2026 13:20:31 -0700 Subject: [PATCH 8/8] docs: describe the per-arch test-budget gates and the CI feature list The README feature table gains the slow-tests-aarch64 and slow-tests-riscv rows, and the default-build exception list names them. The CHANGELOG records both features, the static CI test list, and the narrowed slow-tests criterion. The budget doc states the native, aarch64, and riscv64gc budgets and the hold-out rule per target. --- CHANGELOG.md | 9 ++++++ README.md | 6 ++-- docs/ci-test-budget.md | 68 ++++++++++++++++++++++++++---------------- 3 files changed, 56 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dde3115..8ab2ab9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,15 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Added + +- The `slow-tests-aarch64` and `slow-tests-riscv` features. Each one holds out the tests that push the matching emulated test run past its budget. `slow-tests-aarch64` currently holds out no test. `slow-tests-riscv` holds out 11 tests: the FrodoKEM, RSA, and bcrypt key encryption round trips and the Lamport-Merkle, MAYO5, sntrup Prime, and X25519-FrodoKEM640 round trips. + +### Changed + +- The CI test jobs run `cargo test` with `--features deprecated,legacy_chacha20_fallback,wasm` on top of the default features. The old feature list derivation kept the per-arch gates enabled in every job. The MSRV check, clippy, and the build steps keep `--all-features`, so the gated code stays compile-checked. +- `slow-tests` now holds out only the tests the native test run needs off the run (SLH-DSA, Classic McEliece, XMSS). The emulated-budget tests moved to `slow-tests-riscv`. + ## [3.1.0] - 2026-11-06 ### Added diff --git a/README.md b/README.md index 703109e..226a7cb 100644 --- a/README.md +++ b/README.md @@ -482,7 +482,9 @@ Each algorithm and curve is its own feature, so you compile in only the key type | `secp256k1` | yes | secp256k1 | | `serde` | yes | Serde serialization for `Multikey`, `KeyShare`, `SharePayload`, `ThresholdParticipant` | | `slh-dsa` | yes | SLH-DSA (FIPS 205) | -| `slow-tests` | no | Runs the tests that take over 60 seconds in debug builds (SLH-DSA, Classic McEliece, XMSS) | +| `slow-tests` | no | Runs the tests the native test run holds out to stay on budget (SLH-DSA, Classic McEliece, XMSS). Enable to run the full suite | +| `slow-tests-aarch64` | no | Holds out aarch64 test-run tests if the emulated run reaches its budget. Currently empty because the aarch64 run fits its budget with no test held out | +| `slow-tests-riscv` | no | Holds out the tests that exceed the riscv64 emulated-run budget (FrodoKEM, RSA, bcrypt key encryption, Lamport-Merkle, MAYO5, sntrup Prime, X25519-FrodoKEM640). Enable to run the full emulated suite | | `sntrup` | yes | Streamlined NTRU Prime | | `threshold` | yes | Key splitting (`keysplit`) and the threshold marker attributes (`elliptic-curve`, `vsss-rs`, CBOR via `serde_cbor_2`) | | `wasm` | no | WebAssembly randomness via `getrandom/wasm_js`; on `wasm32` targets `blsful` always uses its `rust` backend | @@ -490,7 +492,7 @@ Each algorithm and curve is its own feature, so you compile in only the key type ## Upgrading from 2.x -3.0 replaces the always-on crypto dependencies with one feature per algorithm or curve. The default build has every feature except `deprecated`, `legacy_chacha20_fallback`, `slow-tests`, and `wasm`, so `multi-key = "3"` has the same key types as 2.x. +3.0 replaces the always-on crypto dependencies with one feature per algorithm or curve. The default build has every feature except `deprecated`, `legacy_chacha20_fallback`, `slow-tests`, `slow-tests-aarch64`, `slow-tests-riscv`, and `wasm`, so `multi-key = "3"` has the same key types as 2.x. - If you used `default-features = false` only to drop serde, add back the algorithms you use, e.g. `features = ["curve25519", "ml-dsa"]`, plus `threshold`, `lamport`, or `xmss` if you used those. A hybrid needs every feature it combines. - Creating, converting, or viewing a key whose feature is off returns an `UnsupportedCodec` error (`UnsupportedAlgorithm` for SSH conversion, `SealError::NotEncryptionKey` for the seal and open views). diff --git a/docs/ci-test-budget.md b/docs/ci-test-budget.md index c9a53d8..07d5f01 100644 --- a/docs/ci-test-budget.md +++ b/docs/ci-test-budget.md @@ -1,31 +1,47 @@ # CI test budget -The self-hosted `org-runner` Linux runners execute cross-target test jobs -under `qemu-riscv64-static` user-mode emulation. A full `--all-features` -test run of this crate does not fit in the default six-hour job timeout, -so the slowest tests stay behind the `slow-tests` feature and the CI test -jobs enable every other feature. The `Code Lint` step keeps -`--all-features`, so the gated code stays lint-checked. +The self-hosted Linux runners run the cross-target test jobs under +`qemu-aarch64-static` and `qemu-riscv64-static` user-mode emulation. Two +features hold out the tests that push an emulated test run past its test +budget: `slow-tests-aarch64` on the aarch64 target and `slow-tests-riscv` +on the riscv64gc target. A third feature, `slow-tests`, holds out the +tests the native test run needs held out. The test jobs enable every +other feature. The `Code Lint` step and the `Check` and `Build` steps +keep `--all-features`, so the gated code stays compile-checked. ## Measurement -Each test ran alone under `qemu-riscv64-static` (`RUST_TEST_THREADS=1`, -nightly debug build, `--all-features`) on a 16-core x86_64 workstation. -Serial time is the sum of the single-test times. +Each test ran alone under the matching `qemu-*-static` emulator +(`RUST_TEST_THREADS=1`, nightly debug build, `--all-features`) on a +16-core x86_64 workstation. Serial time is the sum of the single-test +times. -- Total serial time of all 255 tests: 17,274 s (4 h 48 m) -- Tests at or over 60 s: 26 tests, 16,368 s (94.8% of the serial time) -- Remaining serial time when those 26 tests are gated: 906 s (15.1 min) +- Total serial time of all 255 tests of the riscv64gc measurement: + 17,274 s (4 h 48 m) +- riscv64gc tests at or over 60 s: 26 tests, 16,368 s (94.8% of the serial + time) +- The `slow-tests` gate holds 18 tests. The native test run needs them + held out to stay on budget. +- The `slow-tests-riscv` gate holds 11 tests. Their emulated serial time + adds to 2,486 s (the table below). +- Remaining riscv64gc serial time when the 26 tests are gated: 906 s + (15.1 min) - Doctests (measured the same way): 9 tests, 0.13 s +- One full riscv64gc run with the CI feature list and `slow-tests-riscv` + enabled took 291.7 s and passed every test. +- The aarch64 run needs no held-out test today. A full run with the CI + feature list measured 21.6 s and 20.3 s back to back. The slowest + single test measured 20.7 s. `slow-tests-aarch64` is the hold-out + point for a future slow aarch64 test. +- The native test run with the same feature list measured 22.9 s. ## Slow tests (60 s or more under emulation) -Already gated behind `slow-tests`: the five SLH-DSA tests, the two XMSS -sign/index tests, and the Classic McEliece tests (the gate sits on the -`tests` module), the x25519+mceliece348864 tests (same), and -`keysplit::tests::roundtrip::roundtrip_slh_dsa`. +Behind `slow-tests`: the SLH-DSA tests in `mk` and `keysplit`, the two +XMSS sign and index tests, and the Classic McEliece tests and the +x25519+mceliece348864 tests (the gate sits on their tests modules). -Gated by this change (11 tests, 2,486 s under emulation): +Behind `slow-tests-riscv` (11 tests, 2,486 s serial under emulation): | Test | Emulated time (s) | |------|------------------:| @@ -41,15 +57,17 @@ Gated by this change (11 tests, 2,486 s under emulation): | `views::sntrup::tests::test_sntrup_fingerprint` | 82.2 | | `views::x25519_frodokem640::tests::test_640aes_roundtrip` | 69.1 | -Five of these tests exceed the 1,800 s measurement cap under emulation; -they report at least the cap value and are certainly slower. +Five of the tests behind `slow-tests` exceed the 1,800 s measurement cap +under emulation. They report the cap value as a lower bound, so their +true serial time is larger. None of those tests appears in the table +above. ## Budget rule -The gated set is every test measured at 60 s or more under emulation. A -test that grows past 60 s under the same measurement belongs behind the -feature again; re-measure with `slow-tests` enabled. The CI job stays +The wall clock of one complete run with the CI feature list is the budget +measure. The measured budgets: 20-22 s on aarch64 and 76-86 s on +riscv64gc against a 300 s target. A test that grows past 60 s in a +single-test measurement on that target belongs behind that target's +feature again. Re-measure with that gate enabled. The CI job stays correct as long as the sum of the ungated tests, doctests included, stays -well under the job budget: roughly 906 s today against the 3,600 s -target, with test-thread parallelism and doctests adding margin on the -side of safety. +well under the job budget.