From 90cde2065593dafa8850287bc7032f672391c74c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Fri, 10 Jul 2026 16:24:17 +0300 Subject: [PATCH 1/4] Update and fix CI --- .github/workflows/blake2.yml | 16 +--- .github/workflows/fsb.yml | 2 +- .github/workflows/gost94.yml | 2 +- .github/workflows/groestl.yml | 2 +- .github/workflows/jh.yml | 2 +- .github/workflows/k12.yml | 2 +- .github/workflows/md2.yml | 2 +- .github/workflows/md4.yml | 2 +- .github/workflows/md5.yml | 4 +- .github/workflows/publish.yml | 61 +++++++++++++ .github/workflows/ripemd.yml | 2 +- .github/workflows/sha1.yml | 8 +- .github/workflows/sha2.yml | 10 +-- .github/workflows/sha3.yml | 4 +- .github/workflows/shabal.yml | 2 +- .github/workflows/skein.yml | 2 +- .github/workflows/sm3.yml | 2 +- .github/workflows/streebog.yml | 2 +- .github/workflows/tiger.yml | 2 +- .github/workflows/whirlpool.yml | 2 +- .github/workflows/workspace.yml | 2 +- Cargo.lock | 81 +++++++++-------- blake2/src/lib.rs | 2 - blake2/src/simd.rs | 28 ------ blake2/src/simd/simd_opt.rs | 25 ------ blake2/src/simd/simd_opt/u32x4.rs | 69 -------------- blake2/src/simd/simd_opt/u64x4.rs | 143 ------------------------------ blake2/src/simd/simdint.rs | 22 ----- blake2/src/simd/simdop.rs | 30 ------- blake2/src/simd/simdty.rs | 12 --- groestl/src/compress1024.rs | 2 +- groestl/src/compress512.rs | 2 +- sha2/src/lib.rs | 1 + sha2/src/sha512/x86.rs | 2 +- 34 files changed, 134 insertions(+), 418 deletions(-) create mode 100644 .github/workflows/publish.yml delete mode 100644 blake2/src/simd/simd_opt/u32x4.rs delete mode 100644 blake2/src/simd/simd_opt/u64x4.rs delete mode 100644 blake2/src/simd/simdint.rs diff --git a/.github/workflows/blake2.yml b/.github/workflows/blake2.yml index 3f10e2f5a..8f06bc944 100644 --- a/.github/workflows/blake2.yml +++ b/.github/workflows/blake2.yml @@ -21,7 +21,7 @@ jobs: set-msrv: uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master with: - msrv: 1.56.0 + msrv: 1.85.0 build: needs: set-msrv @@ -68,24 +68,12 @@ jobs: working-directory: ${{ github.workflow }} stable-cmd: cargo hack test --release --feature-powerset --exclude-features simd,simd_opt,simd_asm - simd: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: RustCrypto/actions/cargo-cache@master - - uses: dtolnay/rust-toolchain@master - with: - toolchain: nightly-2021-05-01 - - run: cargo test --features simd - - run: cargo test --features simd_opt - - run: cargo test --features simd_asm - # Cross-compiled tests cross: strategy: matrix: rust: - - 1.56 + - 1.85 - stable target: - aarch64-unknown-linux-gnu diff --git a/.github/workflows/fsb.yml b/.github/workflows/fsb.yml index a696b875e..61d3f3642 100644 --- a/.github/workflows/fsb.yml +++ b/.github/workflows/fsb.yml @@ -21,7 +21,7 @@ jobs: set-msrv: uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master with: - msrv: 1.56.0 + msrv: 1.85.0 build: needs: set-msrv diff --git a/.github/workflows/gost94.yml b/.github/workflows/gost94.yml index be9f8a2e8..305152183 100644 --- a/.github/workflows/gost94.yml +++ b/.github/workflows/gost94.yml @@ -21,7 +21,7 @@ jobs: set-msrv: uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master with: - msrv: 1.57.0 + msrv: 1.85.0 build: needs: set-msrv diff --git a/.github/workflows/groestl.yml b/.github/workflows/groestl.yml index 04532c06b..43cd74c8b 100644 --- a/.github/workflows/groestl.yml +++ b/.github/workflows/groestl.yml @@ -21,7 +21,7 @@ jobs: set-msrv: uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master with: - msrv: 1.56.0 + msrv: 1.85.0 build: needs: set-msrv diff --git a/.github/workflows/jh.yml b/.github/workflows/jh.yml index 21a3d5919..0608a6016 100644 --- a/.github/workflows/jh.yml +++ b/.github/workflows/jh.yml @@ -20,7 +20,7 @@ jobs: set-msrv: uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master with: - msrv: 1.61.0 + msrv: 1.85.0 build: needs: set-msrv diff --git a/.github/workflows/k12.yml b/.github/workflows/k12.yml index 569567ed2..7b9a206e0 100644 --- a/.github/workflows/k12.yml +++ b/.github/workflows/k12.yml @@ -21,7 +21,7 @@ jobs: set-msrv: uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master with: - msrv: 1.56.0 + msrv: 1.85.0 build: needs: set-msrv diff --git a/.github/workflows/md2.yml b/.github/workflows/md2.yml index 11736239d..0decc4a01 100644 --- a/.github/workflows/md2.yml +++ b/.github/workflows/md2.yml @@ -21,7 +21,7 @@ jobs: set-msrv: uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master with: - msrv: 1.57.0 + msrv: 1.85.0 build: needs: set-msrv diff --git a/.github/workflows/md4.yml b/.github/workflows/md4.yml index 7e02affd8..1315b67bb 100644 --- a/.github/workflows/md4.yml +++ b/.github/workflows/md4.yml @@ -21,7 +21,7 @@ jobs: set-msrv: uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master with: - msrv: 1.57.0 + msrv: 1.85.0 build: needs: set-msrv diff --git a/.github/workflows/md5.yml b/.github/workflows/md5.yml index 9470e6e4b..75375cc23 100644 --- a/.github/workflows/md5.yml +++ b/.github/workflows/md5.yml @@ -24,7 +24,7 @@ jobs: set-msrv: uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master with: - msrv: 1.57.0 + msrv: 1.85.0 build: needs: set-msrv @@ -72,7 +72,7 @@ jobs: - uses: RustCrypto/actions/cargo-cache@master - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.72 + toolchain: 1.85 targets: loongarch64-unknown-linux-gnu - run: cargo build --target loongarch64-unknown-linux-gnu --features loongarch64_asm diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 000000000..eeb7d3574 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,61 @@ +name: Publish to crates.io +on: + push: + tags: [ + 'ascon-hash256-v*', + 'bash-hash-v*', + 'belt-hash-v*', + 'blake2-v*', + 'fsb-v*', + 'gost94-v*', + 'groestl-v*', + 'jh-v*', + 'kupyna-v*', + 'md2-v*', + 'md4-v*', + 'md5-v*', + 'ripemd-v*', + 'sha1-checked-v*', + 'sha1-v*', + 'sha2-v*', + 'sha3-v*', + 'shabal-v*', + 'skein-v*', + 'sm3-v*', + 'streebog-v*', + 'tiger-v*', + 'whirlpool-v*', + ] + +jobs: + publish: + runs-on: ubuntu-latest + environment: publish + permissions: + id-token: write + steps: + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + - uses: rust-lang/crates-io-auth-action@c6f97d42243bad5fab37ca0427f495c86d5b1a18 # v1.0.5 + id: auth + + - name: Extract Crate Name and Version + run: | + TAG_NAME="${{ github.ref_name }}" + CRATE_NAME=${TAG_NAME%-v*} + CRATE_VERSION=${TAG_NAME##*-v} + echo $CRATE_NAME $CRATE_VERSION + echo "CRATE_NAME=${CRATE_NAME}" >> $GITHUB_ENV + echo "CRATE_VERSION=${CRATE_VERSION}" >> $GITHUB_ENV + + - name: Check crate version + working-directory: ${{ env.CRATE_NAME }} + run: | + CRATE_TOML_VERSION=$(grep "^version =" Cargo.toml | cut -d'"' -f2) + echo $CRATE_TOML_VERSION + [[ $CRATE_TOML_VERSION == $CRATE_VERSION ]] + + - name: Publish + working-directory: ${{ env.CRATE_NAME }} + env: + CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }} + run: cargo publish diff --git a/.github/workflows/ripemd.yml b/.github/workflows/ripemd.yml index cd22c0203..f67ec085a 100644 --- a/.github/workflows/ripemd.yml +++ b/.github/workflows/ripemd.yml @@ -21,7 +21,7 @@ jobs: set-msrv: uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master with: - msrv: 1.57.0 + msrv: 1.85.0 build: needs: set-msrv diff --git a/.github/workflows/sha1.yml b/.github/workflows/sha1.yml index 2834bdb92..f7a353fee 100644 --- a/.github/workflows/sha1.yml +++ b/.github/workflows/sha1.yml @@ -21,9 +21,7 @@ jobs: set-msrv: uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master with: - # Crate supports MSRV 1.41 without `oid` feature. We test true MSRV - # in the `test-msrv` job. - msrv: 1.57.0 + msrv: 1.85.0 # Builds for no_std platforms build: @@ -140,7 +138,7 @@ jobs: - uses: RustCrypto/actions/cargo-cache@master - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.72 + toolchain: 1.85 targets: loongarch64-unknown-linux-gnu - run: cargo build --target loongarch64-unknown-linux-gnu --features loongarch64_asm @@ -149,7 +147,7 @@ jobs: strategy: matrix: rust: - - 1.56.0 + - 1.85.0 - stable target: - aarch64-unknown-linux-gnu diff --git a/.github/workflows/sha2.yml b/.github/workflows/sha2.yml index 4ea2e391c..894fcbde9 100644 --- a/.github/workflows/sha2.yml +++ b/.github/workflows/sha2.yml @@ -21,9 +21,7 @@ jobs: set-msrv: uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master with: - # Crate supports MSRV 1.41 without `oid` feature. We test true MSRV - # in the `test-msrv` job. - msrv: 1.59.0 + msrv: 1.85.0 # Builds for no_std platforms build: @@ -32,7 +30,7 @@ jobs: strategy: matrix: rust: - - 1.59 + - 1.85 - stable target: - thumbv7em-none-eabi @@ -84,7 +82,7 @@ jobs: strategy: matrix: rust: - - 1.79 + - 1.85 - stable runs-on: macos-latest steps: @@ -129,7 +127,7 @@ jobs: - uses: RustCrypto/actions/cargo-cache@master - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.72 + toolchain: 1.85 targets: loongarch64-unknown-linux-gnu - run: cargo build --target loongarch64-unknown-linux-gnu --features loongarch64_asm diff --git a/.github/workflows/sha3.yml b/.github/workflows/sha3.yml index d92862854..5dbe6b145 100644 --- a/.github/workflows/sha3.yml +++ b/.github/workflows/sha3.yml @@ -21,9 +21,7 @@ jobs: set-msrv: uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master with: - # Crate supports MSRV 1.41 without `oid` feature. We test true MSRV - # in the `test-msrv` job. - msrv: 1.57.0 + msrv: 1.85.0 build: needs: set-msrv diff --git a/.github/workflows/shabal.yml b/.github/workflows/shabal.yml index ef1a224ee..90bcb5274 100644 --- a/.github/workflows/shabal.yml +++ b/.github/workflows/shabal.yml @@ -21,7 +21,7 @@ jobs: set-msrv: uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master with: - msrv: 1.56.0 + msrv: 1.85.0 build: needs: set-msrv diff --git a/.github/workflows/skein.yml b/.github/workflows/skein.yml index e66d8de18..8d8ac984a 100644 --- a/.github/workflows/skein.yml +++ b/.github/workflows/skein.yml @@ -21,7 +21,7 @@ jobs: set-msrv: uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master with: - msrv: 1.57.0 + msrv: 1.85.0 build: needs: set-msrv diff --git a/.github/workflows/sm3.yml b/.github/workflows/sm3.yml index 9a1ed9207..b258fc506 100644 --- a/.github/workflows/sm3.yml +++ b/.github/workflows/sm3.yml @@ -21,7 +21,7 @@ jobs: set-msrv: uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master with: - msrv: 1.56.0 + msrv: 1.85.0 build: needs: set-msrv diff --git a/.github/workflows/streebog.yml b/.github/workflows/streebog.yml index bc6c19b22..015e14501 100644 --- a/.github/workflows/streebog.yml +++ b/.github/workflows/streebog.yml @@ -21,7 +21,7 @@ jobs: set-msrv: uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master with: - msrv: 1.57.0 + msrv: 1.85.0 build: needs: set-msrv diff --git a/.github/workflows/tiger.yml b/.github/workflows/tiger.yml index 38371a4da..0b653ec91 100644 --- a/.github/workflows/tiger.yml +++ b/.github/workflows/tiger.yml @@ -24,7 +24,7 @@ jobs: set-msrv: uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master with: - msrv: 1.56.0 + msrv: 1.85.0 build: needs: set-msrv diff --git a/.github/workflows/whirlpool.yml b/.github/workflows/whirlpool.yml index 79ca5aea5..3e56ccfff 100644 --- a/.github/workflows/whirlpool.yml +++ b/.github/workflows/whirlpool.yml @@ -21,7 +21,7 @@ jobs: set-msrv: uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master with: - msrv: 1.56.0 + msrv: 1.85.0 build: needs: set-msrv diff --git a/.github/workflows/workspace.yml b/.github/workflows/workspace.yml index 426085dd6..6b2d7f873 100644 --- a/.github/workflows/workspace.yml +++ b/.github/workflows/workspace.yml @@ -17,7 +17,7 @@ jobs: - uses: RustCrypto/actions/cargo-cache@master - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.71.0 + toolchain: 1.85.0 components: clippy - run: cargo clippy --all -- -D warnings diff --git a/Cargo.lock b/Cargo.lock index 792337134..dc7ff0f7b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "blake2" @@ -27,24 +27,25 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.83" +version = "1.2.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "f5d6cac793997bd970000024b2934968efe83b382de4fdcf4fcb46b6ee4ad996" dependencies = [ - "libc", + "find-msvc-tools", + "shlex", ] [[package]] name = "cfg-if" -version = "1.0.0" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "const-oid" -version = "0.9.5" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "cpufeatures" @@ -57,9 +58,9 @@ dependencies = [ [[package]] name = "crypto-common" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" dependencies = [ "generic-array", "typenum", @@ -78,6 +79,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + [[package]] name = "fsb" version = "0.1.3" @@ -134,18 +141,18 @@ dependencies = [ [[package]] name = "keccak" -version = "0.1.4" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +checksum = "cb26cec98cce3a3d96cbb7bced3c4b16e3d13f27ec56dbd62cbc8f39cfb9d653" dependencies = [ "cpufeatures", ] [[package]] name = "libc" -version = "0.2.155" +version = "0.2.186" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" [[package]] name = "md-5" @@ -175,9 +182,9 @@ dependencies = [ [[package]] name = "md5-asm" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61d33bc4cdfe5c60340e282bbbee0a6e2bc57f0b9279bb3489c5004d12492e5c" +checksum = "d19b8ee7fc7d812058d3b708c7f719efd0713d53854648e4223c6fcae709e2df" dependencies = [ "cc", ] @@ -198,22 +205,12 @@ dependencies = [ [[package]] name = "sha1" -version = "0.10.6" +version = "0.10.7" dependencies = [ "cfg-if", "cpufeatures", "digest", "hex-literal", - "sha1-asm", -] - -[[package]] -name = "sha1-asm" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ba6947745e7f86be3b8af00b7355857085dbdf8901393c89514510eb61f4e21" -dependencies = [ - "cc", ] [[package]] @@ -229,9 +226,9 @@ dependencies = [ [[package]] name = "sha2-asm" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f27ba7066011e3fb30d808b51affff34f0a66d3a03a58edd787c6e420e40e44e" +checksum = "b845214d6175804686b2bd482bcffe96651bb2d1200742b712003504a2dac1ab" dependencies = [ "cc", ] @@ -254,6 +251,12 @@ dependencies = [ "hex-literal", ] +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + [[package]] name = "sm3" version = "0.4.2" @@ -272,9 +275,9 @@ dependencies = [ [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "tiger" @@ -286,15 +289,15 @@ dependencies = [ [[package]] name = "typenum" -version = "1.17.0" +version = "1.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "whirlpool" @@ -307,15 +310,15 @@ dependencies = [ [[package]] name = "whirlpool-asm" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62fbc33555bb368a2758340583b26fc67822da6b1b829fd9a48cca1bad2e29fe" +checksum = "6d47472442bfb3724cca74cbc2bde93cd7351ef81ff1f8784e6eb82755282b18" dependencies = [ "cc", ] [[package]] name = "zeroize" -version = "1.6.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" +checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e" diff --git a/blake2/src/lib.rs b/blake2/src/lib.rs index 85a6b1c28..bbc6a75c7 100644 --- a/blake2/src/lib.rs +++ b/blake2/src/lib.rs @@ -74,8 +74,6 @@ html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg" )] #![warn(missing_docs, rust_2018_idioms)] -#![cfg_attr(feature = "simd", feature(platform_intrinsics, repr_simd))] -#![cfg_attr(feature = "simd", allow(incomplete_features))] #[cfg(feature = "std")] extern crate std; diff --git a/blake2/src/simd.rs b/blake2/src/simd.rs index bf923f56a..fb3e8436a 100644 --- a/blake2/src/simd.rs +++ b/blake2/src/simd.rs @@ -6,7 +6,6 @@ // copied, modified, or distributed except according to those terms. mod simd_opt; -mod simdint; mod simdop; mod simdty; @@ -93,43 +92,16 @@ macro_rules! impl_vector4 { simd_opt::$vec::rotate_right_const(self, n) } - #[cfg(feature = "simd")] - #[inline(always)] - fn shuffle_left_1(self) -> Self { - use crate::simd::simdint::simd_shuffle4; - const IDX: [u32; 4] = [1, 2, 3, 0]; - unsafe { simd_shuffle4(self, self, IDX) } - } - - #[cfg(not(feature = "simd"))] #[inline(always)] fn shuffle_left_1(self) -> Self { $vec::new(self.1, self.2, self.3, self.0) } - #[cfg(feature = "simd")] - #[inline(always)] - fn shuffle_left_2(self) -> Self { - use crate::simd::simdint::simd_shuffle4; - const IDX: [u32; 4] = [2, 3, 0, 1]; - unsafe { simd_shuffle4(self, self, IDX) } - } - - #[cfg(not(feature = "simd"))] #[inline(always)] fn shuffle_left_2(self) -> Self { $vec::new(self.2, self.3, self.0, self.1) } - #[cfg(feature = "simd")] - #[inline(always)] - fn shuffle_left_3(self) -> Self { - use crate::simd::simdint::simd_shuffle4; - const IDX: [u32; 4] = [3, 0, 1, 2]; - unsafe { simd_shuffle4(self, self, IDX) } - } - - #[cfg(not(feature = "simd"))] #[inline(always)] fn shuffle_left_3(self) -> Self { $vec::new(self.3, self.0, self.1, self.2) diff --git a/blake2/src/simd/simd_opt.rs b/blake2/src/simd/simd_opt.rs index 103837957..cd95d3c64 100644 --- a/blake2/src/simd/simd_opt.rs +++ b/blake2/src/simd/simd_opt.rs @@ -5,29 +5,6 @@ // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except according to those terms. -#[allow(unused_macros)] -#[cfg(feature = "simd")] -macro_rules! transmute_shuffle { - ($tmp:ident, $shuffle:ident, $vec:expr, $idx_n:expr, $idx:expr) => { - unsafe { - use crate::simd::simdint::$shuffle; - use crate::simd::simdty::$tmp; - use core::mem::transmute; - - const IDX: [u32; $idx_n] = $idx; - let tmp_i: $tmp = transmute($vec); - let tmp_o: $tmp = $shuffle(tmp_i, tmp_i, IDX); - transmute(tmp_o) - } - }; -} - -#[cfg(feature = "simd")] -pub mod u32x4; -#[cfg(feature = "simd")] -pub mod u64x4; - -#[cfg(not(feature = "simd"))] macro_rules! simd_opt { ($vec:ident) => { pub mod $vec { @@ -46,7 +23,5 @@ macro_rules! simd_opt { }; } -#[cfg(not(feature = "simd"))] simd_opt!(u32x4); -#[cfg(not(feature = "simd"))] simd_opt!(u64x4); diff --git a/blake2/src/simd/simd_opt/u32x4.rs b/blake2/src/simd/simd_opt/u32x4.rs deleted file mode 100644 index 7190d96f7..000000000 --- a/blake2/src/simd/simd_opt/u32x4.rs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2015 blake2-rfc Developers -// -// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be -// copied, modified, or distributed except according to those terms. - -use crate::simd::simdty::u32x4; - -#[cfg(feature = "simd_opt")] -#[inline(always)] -pub fn rotate_right_const(vec: u32x4, n: u32) -> u32x4 { - match n { - 16 => rotate_right_16(vec), - 8 => rotate_right_8(vec), - _ => rotate_right_any(vec, n), - } -} - -#[cfg(not(feature = "simd_opt"))] -#[inline(always)] -pub fn rotate_right_const(vec: u32x4, n: u32) -> u32x4 { - rotate_right_any(vec, n) -} - -#[inline(always)] -fn rotate_right_any(vec: u32x4, n: u32) -> u32x4 { - let r = n; - let l = 32 - r; - - (vec >> u32x4::new(r, r, r, r)) ^ (vec << u32x4::new(l, l, l, l)) -} - -#[cfg(feature = "simd_opt")] -#[inline(always)] -fn rotate_right_16(vec: u32x4) -> u32x4 { - if cfg!(target_feature = "ssse3") { - // pshufb (SSSE3) / vpshufb (AVX2) - transmute_shuffle!( - u8x16, - simd_shuffle16, - vec, - 16, - [2, 3, 0, 1, 6, 7, 4, 5, 10, 11, 8, 9, 14, 15, 12, 13] - ) - } else if cfg!(any(target_feature = "sse2", target_feature = "neon")) { - // pshuflw+pshufhw (SSE2) / vrev (NEON) - transmute_shuffle!(u16x8, simd_shuffle8, vec, 8, [1, 0, 3, 2, 5, 4, 7, 6]) - } else { - rotate_right_any(vec, 16) - } -} - -#[cfg(feature = "simd_opt")] -#[inline(always)] -fn rotate_right_8(vec: u32x4) -> u32x4 { - if cfg!(target_feature = "ssse3") { - // pshufb (SSSE3) / vpshufb (AVX2) - transmute_shuffle!( - u8x16, - simd_shuffle16, - vec, - 16, - [1, 2, 3, 0, 5, 6, 7, 4, 9, 10, 11, 8, 13, 14, 15, 12] - ) - } else { - rotate_right_any(vec, 8) - } -} diff --git a/blake2/src/simd/simd_opt/u64x4.rs b/blake2/src/simd/simd_opt/u64x4.rs deleted file mode 100644 index 350f94587..000000000 --- a/blake2/src/simd/simd_opt/u64x4.rs +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright 2015 blake2-rfc Developers -// -// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be -// copied, modified, or distributed except according to those terms. - -use crate::simd::simdty::u64x4; - -#[cfg(feature = "simd_opt")] -#[inline(always)] -pub fn rotate_right_const(vec: u64x4, n: u32) -> u64x4 { - match n { - 32 => rotate_right_32(vec), - 24 => rotate_right_24(vec), - 16 => rotate_right_16(vec), - _ => rotate_right_any(vec, n), - } -} - -#[cfg(not(feature = "simd_opt"))] -#[inline(always)] -pub fn rotate_right_const(vec: u64x4, n: u32) -> u64x4 { - rotate_right_any(vec, n) -} - -#[inline(always)] -fn rotate_right_any(vec: u64x4, n: u32) -> u64x4 { - let r = n as u64; - let l = 64 - r; - - (vec >> u64x4::new(r, r, r, r)) ^ (vec << u64x4::new(l, l, l, l)) -} - -#[cfg(feature = "simd_opt")] -#[inline(always)] -fn rotate_right_32(vec: u64x4) -> u64x4 { - if cfg!(any(target_feature = "sse2", target_feature = "neon")) { - // 2 x pshufd (SSE2) / vpshufd (AVX2) / 2 x vrev (NEON) - transmute_shuffle!(u32x8, simd_shuffle8, vec, 8, [1, 0, 3, 2, 5, 4, 7, 6]) - } else { - rotate_right_any(vec, 32) - } -} - -#[cfg(feature = "simd_opt")] -#[inline(always)] -fn rotate_right_24(vec: u64x4) -> u64x4 { - if cfg!(all( - feature = "simd_asm", - target_feature = "neon", - target_arch = "arm" - )) { - // 4 x vext (NEON) - rotate_right_vext(vec, 3) - } else if cfg!(target_feature = "ssse3") { - // 2 x pshufb (SSSE3) / vpshufb (AVX2) - transmute_shuffle!( - u8x32, - simd_shuffle32, - vec, - 32, - [ - 3, 4, 5, 6, 7, 0, 1, 2, 11, 12, 13, 14, 15, 8, 9, 10, 19, 20, 21, 22, 23, 16, 17, - 18, 27, 28, 29, 30, 31, 24, 25, 26 - ] - ) - } else { - rotate_right_any(vec, 24) - } -} - -#[cfg(feature = "simd_opt")] -#[inline(always)] -fn rotate_right_16(vec: u64x4) -> u64x4 { - if cfg!(all( - feature = "simd_asm", - target_feature = "neon", - target_arch = "arm" - )) { - // 4 x vext (NEON) - rotate_right_vext(vec, 2) - } else if cfg!(target_feature = "ssse3") { - // 2 x pshufb (SSSE3) / vpshufb (AVX2) - transmute_shuffle!( - u8x32, - simd_shuffle32, - vec, - 32, - [ - 2, 3, 4, 5, 6, 7, 0, 1, 10, 11, 12, 13, 14, 15, 8, 9, 18, 19, 20, 21, 22, 23, 16, - 17, 26, 27, 28, 29, 30, 31, 24, 25 - ] - ) - } else if cfg!(target_feature = "sse2") { - // 2 x pshuflw+pshufhw (SSE2) - transmute_shuffle!( - u16x16, - simd_shuffle16, - vec, - 16, - [1, 2, 3, 0, 5, 6, 7, 4, 9, 10, 11, 8, 13, 14, 15, 12] - ) - } else { - rotate_right_any(vec, 16) - } -} - -#[cfg(all(feature = "simd_asm", target_feature = "neon", target_arch = "arm"))] -mod simd_asm_neon_arm { - use crate::simd::simdty::{u64x2, u64x4}; - - #[inline(always)] - fn vext_u64(vec: u64x2, b: u8) -> u64x2 { - unsafe { - let result: u64x2; - asm!("vext.8 ${0:e}, ${1:e}, ${1:e}, $2\nvext.8 ${0:f}, ${1:f}, ${1:f}, $2" - : "=w" (result) - : "w" (vec), "n" (b)); - result - } - } - - #[inline(always)] - pub fn rotate_right_vext(vec: u64x4, b: u8) -> u64x4 { - use crate::simd::simdint::{simd_shuffle2, simd_shuffle4}; - - unsafe { - let tmp0 = vext_u64(simd_shuffle2(vec, vec, [0, 1]), b); - let tmp1 = vext_u64(simd_shuffle2(vec, vec, [2, 3]), b); - simd_shuffle4(tmp0, tmp1, [0, 1, 2, 3]) - } - } -} - -#[cfg(all(feature = "simd_asm", target_feature = "neon", target_arch = "arm"))] -use self::simd_asm_neon_arm::rotate_right_vext; - -#[cfg(feature = "simd_opt")] -#[cfg(not(all(feature = "simd_asm", target_feature = "neon", target_arch = "arm")))] -fn rotate_right_vext(_vec: u64x4, _n: u8) -> u64x4 { - unreachable!() -} diff --git a/blake2/src/simd/simdint.rs b/blake2/src/simd/simdint.rs deleted file mode 100644 index d876d5538..000000000 --- a/blake2/src/simd/simdint.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2015 blake2-rfc Developers -// -// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be -// copied, modified, or distributed except according to those terms. - -#![allow(dead_code)] - -#[cfg(feature = "simd")] -extern "platform-intrinsic" { - pub fn simd_add(x: T, y: T) -> T; - pub fn simd_shl(x: T, y: T) -> T; - pub fn simd_shr(x: T, y: T) -> T; - pub fn simd_xor(x: T, y: T) -> T; - - pub fn simd_shuffle2(v: T, w: T, idx: [u32; 2]) -> U; - pub fn simd_shuffle4(v: T, w: T, idx: [u32; 4]) -> U; - pub fn simd_shuffle8(v: T, w: T, idx: [u32; 8]) -> U; - pub fn simd_shuffle16(v: T, w: T, idx: [u32; 16]) -> U; - pub fn simd_shuffle32(v: T, w: T, idx: [u32; 32]) -> U; -} diff --git a/blake2/src/simd/simdop.rs b/blake2/src/simd/simdop.rs index 891456d9c..af8706a3d 100644 --- a/blake2/src/simd/simdop.rs +++ b/blake2/src/simd/simdop.rs @@ -5,8 +5,6 @@ // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except according to those terms. -#[cfg(feature = "simd")] -use crate::simd::simdint; use crate::simd::simdty::{u32x4, u64x4}; use core::ops::{Add, BitXor, Shl, Shr}; @@ -16,13 +14,6 @@ macro_rules! impl_ops { impl Add for $vec { type Output = Self; - #[cfg(feature = "simd")] - #[inline(always)] - fn add(self, rhs: Self) -> Self::Output { - unsafe { simdint::simd_add(self, rhs) } - } - - #[cfg(not(feature = "simd"))] #[inline(always)] fn add(self, rhs: Self) -> Self::Output { $vec::new( @@ -37,13 +28,6 @@ macro_rules! impl_ops { impl BitXor for $vec { type Output = Self; - #[cfg(feature = "simd")] - #[inline(always)] - fn bitxor(self, rhs: Self) -> Self::Output { - unsafe { simdint::simd_xor(self, rhs) } - } - - #[cfg(not(feature = "simd"))] #[inline(always)] fn bitxor(self, rhs: Self) -> Self::Output { $vec::new( @@ -58,13 +42,6 @@ macro_rules! impl_ops { impl Shl<$vec> for $vec { type Output = Self; - #[cfg(feature = "simd")] - #[inline(always)] - fn shl(self, rhs: Self) -> Self::Output { - unsafe { simdint::simd_shl(self, rhs) } - } - - #[cfg(not(feature = "simd"))] #[inline(always)] fn shl(self, rhs: Self) -> Self::Output { $vec::new( @@ -79,13 +56,6 @@ macro_rules! impl_ops { impl Shr<$vec> for $vec { type Output = Self; - #[cfg(feature = "simd")] - #[inline(always)] - fn shr(self, rhs: Self) -> Self::Output { - unsafe { simdint::simd_shr(self, rhs) } - } - - #[cfg(not(feature = "simd"))] #[inline(always)] fn shr(self, rhs: Self) -> Self::Output { $vec::new( diff --git a/blake2/src/simd/simdty.rs b/blake2/src/simd/simdty.rs index 008b8b48c..def42d7b4 100644 --- a/blake2/src/simd/simdty.rs +++ b/blake2/src/simd/simdty.rs @@ -9,18 +9,6 @@ use crate::as_bytes::Safe; -#[cfg(feature = "simd")] -macro_rules! decl_simd { - ($($decl:item)*) => { - $( - #[derive(Clone, Copy, Debug)] - #[repr(simd)] - $decl - )* - } -} - -#[cfg(not(feature = "simd"))] macro_rules! decl_simd { ($($decl:item)*) => { $( diff --git a/groestl/src/compress1024.rs b/groestl/src/compress1024.rs index fa142c396..3dba39ed1 100644 --- a/groestl/src/compress1024.rs +++ b/groestl/src/compress1024.rs @@ -1,6 +1,6 @@ #![allow(clippy::needless_range_loop)] use crate::table::TABLE; -use core::{convert::TryInto, u64}; +use core::convert::TryInto; pub(crate) const COLS: usize = 16; const ROUNDS: u64 = 14; diff --git a/groestl/src/compress512.rs b/groestl/src/compress512.rs index 121e1a395..af107bed5 100644 --- a/groestl/src/compress512.rs +++ b/groestl/src/compress512.rs @@ -1,6 +1,6 @@ #![allow(clippy::needless_range_loop)] use crate::table::TABLE; -use core::{convert::TryInto, u64}; +use core::convert::TryInto; pub(crate) const COLS: usize = 8; const ROUNDS: u64 = 10; diff --git a/sha2/src/lib.rs b/sha2/src/lib.rs index c178d4eb4..2d3d191f2 100644 --- a/sha2/src/lib.rs +++ b/sha2/src/lib.rs @@ -65,6 +65,7 @@ html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg" )] #![warn(missing_docs, rust_2018_idioms)] +#![allow(clippy::manual_rotate)] pub use digest::{self, Digest}; diff --git a/sha2/src/sha512/x86.rs b/sha2/src/sha512/x86.rs index bb7904088..af95b6a83 100644 --- a/sha2/src/sha512/x86.rs +++ b/sha2/src/sha512/x86.rs @@ -154,7 +154,7 @@ unsafe fn rounds_0_63_avx2( for i in 1..5 { for j in 0..8 { - let t = _mm_loadu_si128(K64.as_ptr().add(k64x4_idx) as *const u64 as *const _); + let t = _mm_loadu_si128(K64.as_ptr().add(k64x4_idx) as *const u64); let y = sha512_update_x_avx2(x, _mm256_set_m128i(t, t)); { From d7044ede195a043f980fef43a041d819c982a8e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Fri, 10 Jul 2026 16:25:31 +0300 Subject: [PATCH 2/4] fix sha2 --- sha2/src/sha512/x86.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sha2/src/sha512/x86.rs b/sha2/src/sha512/x86.rs index af95b6a83..4e5cb1489 100644 --- a/sha2/src/sha512/x86.rs +++ b/sha2/src/sha512/x86.rs @@ -154,7 +154,7 @@ unsafe fn rounds_0_63_avx2( for i in 1..5 { for j in 0..8 { - let t = _mm_loadu_si128(K64.as_ptr().add(k64x4_idx) as *const u64); + let t = _mm_loadu_si128(K64.as_ptr().add(k64x4_idx) as *const __m128i); let y = sha512_update_x_avx2(x, _mm256_set_m128i(t, t)); { From f720c45e167448ca4ad8e522eba176e7ebcb92e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Fri, 10 Jul 2026 16:42:58 +0300 Subject: [PATCH 3/4] sha1: ignore `asm` feature --- sha1/CHANGELOG.md | 6 ++++++ sha1/Cargo.toml | 5 ++--- sha1/src/compress.rs | 9 --------- sha1/src/compress/aarch64.rs | 18 ------------------ 4 files changed, 8 insertions(+), 30 deletions(-) delete mode 100644 sha1/src/compress/aarch64.rs diff --git a/sha1/CHANGELOG.md b/sha1/CHANGELOG.md index 429e67727..6ab871ba2 100644 --- a/sha1/CHANGELOG.md +++ b/sha1/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.10.7 (2026-07-08) +### Changed +- Ignore `asm` crate feature ([#897]) + +[#897]: https://github.com/RustCrypto/hashes/pull/897 + ## 0.10.6 (2023-09-21) ### Added - `asm!`-based backend for LoongArch64 targets gated behind `loongarch64_asm` feature [#504] diff --git a/sha1/Cargo.toml b/sha1/Cargo.toml index 3f4b8d3ff..37fed5fcb 100644 --- a/sha1/Cargo.toml +++ b/sha1/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sha1" -version = "0.10.6" +version = "0.10.7" description = "SHA-1 hash function" authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" @@ -17,7 +17,6 @@ cfg-if = "1.0" [target.'cfg(any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64"))'.dependencies] cpufeatures = "0.2" -sha1-asm = { version = "0.5", optional = true } [dev-dependencies] digest = { version = "0.10.7", features = ["dev"] } @@ -27,7 +26,7 @@ hex-literal = "0.2.2" default = ["std"] std = ["digest/std"] oid = ["digest/oid"] # Enable OID support. WARNING: Bumps MSRV to 1.57 -asm = ["sha1-asm"] # WARNING: this feature SHOULD NOT be enabled by library crates +asm = [] # WARNING: this feature SHOULD NOT be enabled by library crates # Use assembly backend for LoongArch64 targets # WARNING: Bumps MSRV to 1.72. This feature SHOULD NOT be enabled by library crates loongarch64_asm = [] diff --git a/sha1/src/compress.rs b/sha1/src/compress.rs index 6f7e40c41..417f9672a 100644 --- a/sha1/src/compress.rs +++ b/sha1/src/compress.rs @@ -5,20 +5,11 @@ cfg_if::cfg_if! { if #[cfg(feature = "force-soft")] { mod soft; use soft::compress as compress_inner; - } else if #[cfg(all(feature = "asm", target_arch = "aarch64"))] { - mod soft; - mod aarch64; - use aarch64::compress as compress_inner; } else if #[cfg(all(feature = "loongarch64_asm", target_arch = "loongarch64"))] { mod loongarch64_asm; use loongarch64_asm::compress as compress_inner; } else if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] { - #[cfg(not(feature = "asm"))] mod soft; - #[cfg(feature = "asm")] - mod soft { - pub use sha1_asm::compress; - } mod x86; use x86::compress as compress_inner; } else { diff --git a/sha1/src/compress/aarch64.rs b/sha1/src/compress/aarch64.rs deleted file mode 100644 index 5952d1f62..000000000 --- a/sha1/src/compress/aarch64.rs +++ /dev/null @@ -1,18 +0,0 @@ -//! SHA-1 `aarch64` backend. - -// Per rustc target feature docs for `aarch64-unknown-linux-gnu` and -// `aarch64-apple-darwin` platforms, the `sha2` target feature enables -// SHA-1 as well: -// -// > Enable SHA1 and SHA256 support. -cpufeatures::new!(sha1_hwcap, "sha2"); - -pub fn compress(state: &mut [u32; 5], blocks: &[[u8; 64]]) { - // TODO: Replace with https://github.com/rust-lang/rfcs/pull/2725 - // after stabilization - if sha1_hwcap::get() { - sha1_asm::compress(state, blocks); - } else { - super::soft::compress(state, blocks); - } -} From c269f79fee1b749c77be1fa3c38f54b3992fac53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Fri, 10 Jul 2026 16:51:10 +0300 Subject: [PATCH 4/4] tweak Ci workflows --- .github/workflows/ascon-hash.yml | 8 +------- .github/workflows/belt-hash.yml | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ascon-hash.yml b/.github/workflows/ascon-hash.yml index ef41d84b0..a231f37b8 100644 --- a/.github/workflows/ascon-hash.yml +++ b/.github/workflows/ascon-hash.yml @@ -21,7 +21,7 @@ jobs: set-msrv: uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master with: - msrv: 1.56.0 + msrv: 1.85.0 build: needs: set-msrv @@ -42,9 +42,6 @@ jobs: toolchain: ${{ matrix.rust }} targets: ${{ matrix.target }} - uses: RustCrypto/actions/cargo-hack-install@master - # TODO: remove after bump to MSRV 1.60+ - - run: cargo update - - run: cargo update -p zeroize --precise 1.6.0 - run: cargo hack build --target ${{ matrix.target }} --each-feature --exclude-features default,std minimal-versions: @@ -67,7 +64,4 @@ jobs: with: toolchain: ${{ matrix.rust }} - uses: RustCrypto/actions/cargo-hack-install@master - # TODO: remove after bump to MSRV 1.60+ - - run: cargo update - - run: cargo update -p zeroize --precise 1.6.0 - run: cargo hack test --feature-powerset diff --git a/.github/workflows/belt-hash.yml b/.github/workflows/belt-hash.yml index 86fcd7fae..9b2129618 100644 --- a/.github/workflows/belt-hash.yml +++ b/.github/workflows/belt-hash.yml @@ -21,7 +21,7 @@ jobs: set-msrv: uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master with: - msrv: 1.57.0 + msrv: 1.85.0 build: needs: set-msrv