File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,13 +8,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88## 0.11.2 (UNRELEASED)
99### Fixed
1010- SHA-512 ` riscv-zknh ` backend selection ([ #935 ] )
11+ - Respect precedence of the ` sha2_backend ` configuration flag over ` sha2_256/512_backend ` ([ #948 ] )
1112
1213### Changed
1314- Improved performance of the SHA-512 ` x86-avx2 ` backend ([ #940 ] , [ #943 ] )
1415
1516[ #935 ] : https://github.com/RustCrypto/hashes/pull/935
1617[ #940 ] : https://github.com/RustCrypto/hashes/pull/940
1718[ #943 ] : https://github.com/RustCrypto/hashes/pull/943
19+ [ #948 ] : https://github.com/RustCrypto/hashes/pull/948
1820
1921## 0.11.1 (2026-10-12)
2022### Changed
Original file line number Diff line number Diff line change 11cfg_if:: cfg_if! {
2- if #[ cfg( any ( sha2_backend = "soft" , sha2_256_backend = "soft" ) ) ] {
2+ if #[ cfg( sha2_backend = "soft" ) ] {
33 mod soft;
44 use soft:: compress;
5- } else if #[ cfg( any( sha2_backend = "riscv-zknh" , sha2_256_backend = "riscv-zknh" ) ) ] {
5+ } else if #[ cfg( sha2_backend = "riscv-zknh" ) ] {
6+ mod riscv_zknh;
7+
8+ #[ cfg( not( target_feature = "zknh" ) ) ]
9+ compile_error!( "riscv-zknh backend requires `zknh` target feature" ) ;
10+
11+ fn compress( state: & mut [ u32 ; 8 ] , blocks: & [ [ u8 ; 64 ] ] ) {
12+ // SAFETY: we checked above that the required target features are enabled
13+ unsafe { riscv_zknh:: compress( state, blocks) }
14+ }
15+ } else if #[ cfg( sha2_256_backend = "soft" ) ] {
16+ mod soft;
17+ use soft:: compress;
18+ } else if #[ cfg( sha2_256_backend = "riscv-zknh" ) ] {
619 mod riscv_zknh;
720
821 #[ cfg( not( target_feature = "zknh" ) ) ]
Original file line number Diff line number Diff line change 11cfg_if:: cfg_if! {
2- if #[ cfg( any ( sha2_backend = "soft" , sha2_512_backend = "soft" ) ) ] {
2+ if #[ cfg( sha2_backend = "soft" ) ] {
33 mod soft;
44 use soft:: compress;
5- } else if #[ cfg( any( sha2_backend = "riscv-zknh" , sha2_512_backend = "riscv-zknh" ) ) ] {
5+ } else if #[ cfg( sha2_backend = "riscv-zknh" ) ] {
6+ mod riscv_zknh;
7+
8+ #[ cfg( not( target_feature = "zknh" ) ) ]
9+ compile_error!( "riscv-zknh backend requires `zknh` target features" ) ;
10+
11+ fn compress( state: & mut [ u64 ; 8 ] , blocks: & [ [ u8 ; 128 ] ] ) {
12+ // SAFETY: we checked above that the required target features are enabled
13+ unsafe { riscv_zknh:: compress( state, blocks) }
14+ }
15+ } else if #[ cfg( sha2_512_backend = "soft" ) ] {
16+ mod soft;
17+ use soft:: compress;
18+ } else if #[ cfg( sha2_512_backend = "riscv-zknh" ) ] {
619 mod riscv_zknh;
720
821 #[ cfg( not( target_feature = "zknh" ) ) ]
You can’t perform that action at this time.
0 commit comments