Skip to content
Closed
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
8 changes: 8 additions & 0 deletions .github/workflows/sha2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,14 @@ jobs:
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
targets: riscv64gc-unknown-linux-gnu
- name: Check global RISC-V backend precedence
run: |
cargo rustc --package sha2 --lib --all-features --target riscv64gc-unknown-linux-gnu -- --emit=asm="$RUNNER_TEMP/sha2-backend.s"
grep -Eq '^[[:space:]]+sha256sum0[[:space:]]' "$RUNNER_TEMP/sha2-backend.s"
grep -Eq '^[[:space:]]+sha512sum0[[:space:]]' "$RUNNER_TEMP/sha2-backend.s"
env:
RUSTFLAGS: -Dwarnings --cfg sha2_backend="riscv-zknh" --cfg sha2_256_backend="soft" --cfg sha2_512_backend="soft" -C target-feature=+zknh,+zbkb
- run: cross test --package sha2 --all-features --target riscv64gc-unknown-linux-gnu
env:
RUSTFLAGS: -Dwarnings --cfg sha2_backend="soft"
Expand Down
1 change: 1 addition & 0 deletions sha2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## 0.11.2 (UNRELEASED)
### Fixed
- SHA-512 `riscv-zknh` backend selection ([#935])
- Global `sha2_backend` priority over per-algorithm `soft` overrides

### Changed
- Improved performance of the SHA-512 `x86-avx2` backend ([#940], [#943])
Expand Down
5 changes: 4 additions & 1 deletion sha2/src/sha256.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
cfg_if::cfg_if! {
if #[cfg(any(sha2_backend = "soft", sha2_256_backend = "soft"))] {
if #[cfg(any(
sha2_backend = "soft",
all(not(sha2_backend = "riscv-zknh"), sha2_256_backend = "soft"),
))] {
mod soft;
use soft::compress;
} else if #[cfg(any(sha2_backend = "riscv-zknh", sha2_256_backend = "riscv-zknh"))] {
Expand Down
5 changes: 4 additions & 1 deletion sha2/src/sha512.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
cfg_if::cfg_if! {
if #[cfg(any(sha2_backend = "soft", sha2_512_backend = "soft"))] {
if #[cfg(any(
sha2_backend = "soft",
all(not(sha2_backend = "riscv-zknh"), sha2_512_backend = "soft"),
))] {
mod soft;
use soft::compress;
} else if #[cfg(any(sha2_backend = "riscv-zknh", sha2_512_backend = "riscv-zknh"))] {
Expand Down
Loading