diff --git a/.github/workflows/keccak.yml b/.github/workflows/keccak.yml index 73f6068..266fa13 100644 --- a/.github/workflows/keccak.yml +++ b/.github/workflows/keccak.yml @@ -32,6 +32,7 @@ jobs: - ${{needs.set-msrv.outputs.msrv}} - stable target: + - aarch64-unknown-none-softfloat - thumbv7em-none-eabi - wasm32-unknown-unknown steps: diff --git a/keccak/CHANGELOG.md b/keccak/CHANGELOG.md index 2839b51..5ed7fb7 100644 --- a/keccak/CHANGELOG.md +++ b/keccak/CHANGELOG.md @@ -5,8 +5,13 @@ 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.2.0 (2026-03-16) +## 0.2.1 (UNRELEASED) +### Fixed +- Warning on softfloat AArch64 targets by not enabling `aarch64_sha3` backend on them ([#126]) +[#126]: https://github.com/RustCrypto/sponges/pull/126 + +## 0.2.0 (2026-03-16) ### Added - `keccak_backend` configuration parameter with `aarch64_sha3`, `simd128`, `simd256`, `simd512`, and `soft` values ([#105], [#106], [#113]) diff --git a/keccak/src/backends.rs b/keccak/src/backends.rs index 02e050b..c148ab8 100644 --- a/keccak/src/backends.rs +++ b/keccak/src/backends.rs @@ -4,7 +4,7 @@ use crate::types::*; #[cfg(feature = "parallel")] use hybrid_array::ArraySize; -#[cfg(target_arch = "aarch64")] +#[cfg(all(target_arch = "aarch64", not(target_abi = "softfloat")))] pub(crate) mod aarch64_sha3; #[cfg(any( keccak_backend = "simd128", diff --git a/keccak/src/lib.rs b/keccak/src/lib.rs index 349979e..e4a9715 100644 --- a/keccak/src/lib.rs +++ b/keccak/src/lib.rs @@ -28,7 +28,9 @@ pub use types::*; /// Struct which handles switching between available backends. #[derive(Debug, Copy, Clone)] pub struct Keccak { - #[cfg(target_arch = "aarch64")] + // TODO: remove `not(target_abi = "softfloat")` after the compiler is improved, see: + // https://github.com/rust-lang/rust/issues/160301 + #[cfg(all(target_arch = "aarch64", not(target_abi = "softfloat")))] armv8_sha3: armv8_sha3_intrinsics::InitToken, } @@ -36,7 +38,7 @@ impl Default for Keccak { #[inline] fn default() -> Self { Self { - #[cfg(target_arch = "aarch64")] + #[cfg(all(target_arch = "aarch64", not(target_abi = "softfloat")))] armv8_sha3: armv8_sha3_intrinsics::init(), } } @@ -65,6 +67,8 @@ impl Keccak { } else if #[cfg(keccak_backend = "aarch64_sha3")] { #[cfg(not(target_arch = "aarch64"))] compile_error!("aarch64_sha3 backend can be used only on AArch64 targets!"); + #[cfg(target_abi = "softfloat")] + compile_error!("aarch64_sha3 backend can not be used with softfloat ABI!"); #[cfg(not(target_feature = "sha3"))] compile_error!("aarch64_sha3 backend requires sha3 target feature to be enabled!"); @@ -74,7 +78,7 @@ impl Keccak { } ); - #[cfg(target_arch = "aarch64")] + #[cfg(all(target_arch = "aarch64", not(target_abi = "softfloat")))] if self.armv8_sha3.get() { #[target_feature(enable = "sha3")] unsafe fn aarch64_sha3_inner(f: impl BackendClosure) {