Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .github/workflows/keccak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
- ${{needs.set-msrv.outputs.msrv}}
- stable
target:
- aarch64-unknown-none-softfloat
- thumbv7em-none-eabi
- wasm32-unknown-unknown
steps:
Expand Down
7 changes: 6 additions & 1 deletion keccak/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
2 changes: 1 addition & 1 deletion keccak/src/backends.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 7 additions & 3 deletions keccak/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,17 @@ 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,
}

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(),
}
}
Expand Down Expand Up @@ -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!");

Expand All @@ -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) {
Expand Down
Loading