From effd1940783dcd7003ab6f012fd2b79bde5a2905 Mon Sep 17 00:00:00 2001 From: clippytool Date: Wed, 21 Oct 2026 22:17:36 +0800 Subject: [PATCH] sha2: fix SHA-512 backend selection Signed-off-by: clippytool --- sha2/CHANGELOG.md | 6 ++++++ sha2/src/lib.rs | 2 +- sha2/src/sha512.rs | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/sha2/CHANGELOG.md b/sha2/CHANGELOG.md index 7dd38c2b2..d780f1fb2 100644 --- a/sha2/CHANGELOG.md +++ b/sha2/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.11.2 (UNRELEASED) +### Fixed +- SHA-512 `riscv-zknh` backend selection ([#935]) + +[#935]: https://github.com/RustCrypto/hashes/pull/935 + ## 0.11.1 (2026-10-12) ### Changed - Removed workaround for unaligned loads in `riscv-zknh` backend ([#879]) diff --git a/sha2/src/lib.rs b/sha2/src/lib.rs index b4e21996b..f9c5693bc 100644 --- a/sha2/src/lib.rs +++ b/sha2/src/lib.rs @@ -10,7 +10,7 @@ any( sha2_backend = "riscv-zknh", sha2_256_backend = "riscv-zknh", - sha2_256_backend = "riscv-zknh", + sha2_512_backend = "riscv-zknh", ), feature(riscv_ext_intrinsics) )] diff --git a/sha2/src/sha512.rs b/sha2/src/sha512.rs index 1822243de..75de49177 100644 --- a/sha2/src/sha512.rs +++ b/sha2/src/sha512.rs @@ -1,8 +1,8 @@ cfg_if::cfg_if! { - if #[cfg(any(sha2_backend = "soft", sha2_256_backend = "soft"))] { + if #[cfg(any(sha2_backend = "soft", sha2_512_backend = "soft"))] { mod soft; use soft::compress; - } else if #[cfg(any(sha2_backend = "riscv-zknh", sha2_256_backend = "riscv-zknh"))] { + } else if #[cfg(any(sha2_backend = "riscv-zknh", sha2_512_backend = "riscv-zknh"))] { mod riscv_zknh; #[cfg(not(target_feature = "zknh"))]