Repository: RustCrypto/hashes (language: rust)

Issue:
sha2: aarch64 acceleration broken on master
#542 removed the sha2-asm and asm feature, which incidentally also made the aarch64 code dead, because it is behind a `#[cfg(all(feature = "asm", target_arch = "aarch64"))]` (https://github.com/RustCrypto/hashes/blob/c38787b7abd8dd10412972941d077df54c95a4bb/sha2/src/sha256.rs#L9) — since that feature is no longer declared in Cargo.toml, it cannot be enabled.

I suspect this isn't intentional, because the looongarch implementation also uses inline assembly but isn't disabled.


Discussion / hints:

Fix patch:
diff --git a/sha2/src/sha256.rs b/sha2/src/sha256.rs
index ed869a16b..417a51b6a 100644
--- a/sha2/src/sha256.rs
+++ b/sha2/src/sha256.rs
@@ -6,7 +6,7 @@ cfg_if::cfg_if! {
         mod soft;
         mod x86;
         use x86::compress;
-    } else if #[cfg(all(feature = "asm", target_arch = "aarch64"))] {
+    } else if #[cfg(target_arch = "aarch64")] {
         mod soft;
         mod aarch64;
         use aarch64::compress;
diff --git a/sha2/src/sha512.rs b/sha2/src/sha512.rs
index 04f5079b5..7d9382775 100644
--- a/sha2/src/sha512.rs
+++ b/sha2/src/sha512.rs
@@ -6,7 +6,7 @@ cfg_if::cfg_if! {
         mod soft;
         mod x86;
         use x86::compress;
-    } else if #[cfg(all(feature = "asm", target_arch = "aarch64"))] {
+    } else if #[cfg(target_arch = "aarch64")] {
         mod soft;
         mod aarch64;
         use aarch64::compress;


Test patch: