Skip to content

Commit

Permalink
Disable AES-Neon in big-endian ARM due to rust-lang/stdarch#1484
Browse files Browse the repository at this point in the history
  • Loading branch information
sayantn committed Dec 21, 2024
1 parent 4f8b123 commit 1e8f1e3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ implementations, among which it automatically decides the best (most performant)
- AES-NI (with Vector AES for 2-blocks) => requires a Nightly Compiler, the `nightly` feature to be enabled, and
compiling for x86(64) with the `vaes` target_feature flag set.
- AES-NI => requires compiling for x86(64) with the `sse4.1` and `aes` target_feature flags set.
- AES-Neon => requires compiling for AArch64 or ARM64EC or ARM-v8 with the `aes` target_feature flag set (ARM-v8
requires a Nightly compiler and the `nightly` feature to be enabled) .
- AES-Neon => requires compiling for little-endian AArch64 or ARM64EC or ARM-v8 with the `aes` target_feature flag set (
ARM-v8 requires a Nightly compiler and the `nightly` feature to be enabled).
- AES-RV => Requires a Nightly compiler, the `nightly` feature to be enabled and compiling for RISC-V RV64 or RV32 with
the `zkne` and `zknd` target-features enabled (performance considerably improves with the `unaligned-scalar-mem`
target-feature enabled)
- Software AES => fallback implementation based on Rijmen and Daemen's `optimized` implementation (available
on [their website](https://web.archive.org/web/20050828204927/http://www.iaik.tu-graz.ac.at/research/krypto/AES/old/%7Erijmen/rijndael/))
- Constant-time Software AES => Much slower than Software AES, but is constant-time, which can be important in some scenarios.
Enabled by the `constant-time` feature. It is worth noting that all the accelerated AES implementations are constant-time, so this
only comes into play when no accelerated version is found.
on [their website](https://web.archive.org/web/20050828204927/http://www.iaik.tu-graz.ac.at/research/krypto/AES/old/%7Erijmen/rijndael/)).
- Constant-time Software AES => Much slower than Software AES, but is constant-time, which can be important in some
scenarios. Enabled by the `constant-time` feature. It is worth noting that all the accelerated AES implementations are
constant-time, so this only comes into play when no accelerated version is found.

If you are unsure about the target_feature flags to set, use `target_cpu=native` (if not cross-compiling) in
the `RUSTFLAGS` environment variable, and use the `nightly` feature only if you are using a nightly compiler.
Expand Down
6 changes: 4 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
feature = "nightly",
target_arch = "arm",
target_feature = "v8",
target_feature = "aes"
target_feature = "aes",
target_endian = "little" // https://github.com/rust-lang/stdarch/issues/1484
),
feature(stdarch_arm_neon_intrinsics)
)]
Expand Down Expand Up @@ -55,7 +56,8 @@ cfg_if! {
target_arch = "arm64ec",
all(feature = "nightly", target_arch = "arm", target_feature = "v8")
),
target_feature = "aes"
target_feature = "aes",
target_endian = "little" // https://github.com/rust-lang/stdarch/issues/1484
))] {
mod aes_arm;
pub use aes_arm::AesBlock;
Expand Down

0 comments on commit 1e8f1e3

Please sign in to comment.