From 3234fa1c28f5250022b5e97a5149555e1bcf66cd Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Tue, 18 Feb 2025 23:52:39 +0100 Subject: [PATCH] Remove `dudect` (#769) It's using `rand_core` v0.8 and therefore no longer compatible. Also, it hasn't been that much of a help, nor does it provide much coverage. Going forward we should investigate static analysis tools for solving the same problem, like BINSEC / cargo-checkct. --- .github/workflows/dudect.yml | 24 ---- dudect/Cargo.lock | 240 ----------------------------------- dudect/Cargo.toml | 11 -- dudect/src/main.rs | 43 ------- 4 files changed, 318 deletions(-) delete mode 100644 .github/workflows/dudect.yml delete mode 100644 dudect/Cargo.lock delete mode 100644 dudect/Cargo.toml delete mode 100644 dudect/src/main.rs diff --git a/.github/workflows/dudect.yml b/.github/workflows/dudect.yml deleted file mode 100644 index a54d6a44..00000000 --- a/.github/workflows/dudect.yml +++ /dev/null @@ -1,24 +0,0 @@ -# dudect benchmarks: check for constant-time operation -name: dudect - -on: - push: - branches: - - master - paths-ignore: - - README.md - -jobs: - dudect: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@master - with: - toolchain: stable - - run: cargo build --release - working-directory: dudect - - run: cargo run --release - | tee /dev/stderr - | perl -n -e '/max t = [+-](\d*\.?\d*)/; if ($1 >= 100) { exit 1 }' - working-directory: dudect diff --git a/dudect/Cargo.lock b/dudect/Cargo.lock deleted file mode 100644 index bf0d986f..00000000 --- a/dudect/Cargo.lock +++ /dev/null @@ -1,240 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "clap" -version = "2.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" -dependencies = [ - "ansi_term", - "atty", - "bitflags", - "strsim", - "textwrap", - "unicode-width", - "vec_map", -] - -[[package]] -name = "crypto-bigint" -version = "0.6.0-pre.7" -dependencies = [ - "num-traits", - "rand_core", - "subtle", -] - -[[package]] -name = "crypto-bigint-dudect" -version = "0.0.0" -dependencies = [ - "clap", - "crypto-bigint", - "dudect-bencher", -] - -[[package]] -name = "ctrlc" -version = "3.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d91974fbbe88ec1df0c24a4f00f99583667a7e2e6272b2b92d294d81e462173" -dependencies = [ - "nix", - "winapi", -] - -[[package]] -name = "dudect-bencher" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f9bbb7ec1fac1f034689b5d500278fda2f84d244afab64703227216f3f9763" -dependencies = [ - "clap", - "ctrlc", - "rand", - "rand_chacha", -] - -[[package]] -name = "getrandom" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "libc" -version = "0.2.132" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" - -[[package]] -name = "nix" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e322c04a9e3440c327fca7b6c8a63e6890a32fa2ad689db972425f07e0d22abb" -dependencies = [ - "autocfg", - "bitflags", - "cfg-if", - "libc", -] - -[[package]] -name = "num-traits" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" -dependencies = [ - "autocfg", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - -[[package]] -name = "subtle" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" - -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] - -[[package]] -name = "unicode-width" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" - -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/dudect/Cargo.toml b/dudect/Cargo.toml deleted file mode 100644 index c7df7b44..00000000 --- a/dudect/Cargo.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "crypto-bigint-dudect" -version = "0.0.0" -authors = ["RustCrypto Developers"] -publish = false -edition = "2021" - -[dependencies] -clap = "2.33" -crypto-bigint = { path = ".." } -dudect-bencher = "0.5" diff --git a/dudect/src/main.rs b/dudect/src/main.rs deleted file mode 100644 index 96a8e409..00000000 --- a/dudect/src/main.rs +++ /dev/null @@ -1,43 +0,0 @@ -//! Fuzz tests for `crypto-bigint`. -//! -//! These use the `dudect_bencher` crate to check certain operations for -//! constant-time behavior. - -use crypto_bigint::{NonZero, Random, U128, U256}; -use dudect_bencher::{ctbench_main, BenchRng, Class, CtRunner}; - -/// Check `UInt::rem` for constant-time operation. -fn rem(runner: &mut CtRunner, mut rng: &mut BenchRng) { - const ITERATIONS_OUTER: usize = 10_000; - const ITERATIONS_INNER: usize = 10_000; - - // 128-bit random example - let a = U128::ZERO.concat(&U128::random(&mut rng)); - - // 256-bit random example - let b = U256::random(&mut rng); - - // Random modulus (256-bit) - let modulus = NonZero::new(U256::random(&mut rng)).unwrap_or(NonZero::::ONE); - - // Precomputing the inputs appears to eliminate some noise - let mut inputs = vec![]; - - for _ in 0..ITERATIONS_OUTER { - inputs.push((Class::Left, a)); - } - - for _ in 0..ITERATIONS_OUTER { - inputs.push((Class::Right, b)); - } - - for (class, input) in inputs { - runner.run_one(class, || { - for _ in 0..ITERATIONS_INNER { - input.rem(&modulus); - } - }) - } -} - -ctbench_main!(rem);