Skip to content

Commit f6a0efd

Browse files
authored
Use the SHA extension backend with enabled asm feature (#224)
1 parent a76d561 commit f6a0efd

4 files changed

Lines changed: 20 additions & 11 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sha2/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## 0.9.3 (2021-01-30)
9+
### Changed
10+
- Use the SHA extension backend with enabled `asm` feature. ([#224])
11+
12+
[#224]: https://github.com/RustCrypto/hashes/pull/224
13+
814
## 0.9.2 (2020-11-04)
915
### Added
1016
- `force-soft` feature to enforce use of software implementation. ([#203])

sha2/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sha2"
3-
version = "0.9.2"
3+
version = "0.9.3"
44
description = """
55
Pure Rust implementation of the SHA-2 hash function family
66
including SHA-224, SHA-256, SHA-384, and SHA-512.

sha2/src/sha256.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,20 +142,23 @@ cfg_if::cfg_if! {
142142
if #[cfg(feature = "force-soft")] {
143143
mod soft;
144144
use soft::compress;
145-
} else if #[cfg(all(feature = "asm", target_arch = "aarch64", target_os = "linux"))] {
145+
} else if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
146+
#[cfg(not(feature = "asm"))]
146147
mod soft;
147-
mod aarch64;
148-
use aarch64::compress;
149-
} else if #[cfg(all(feature = "asm", any(target_arch = "x86", target_arch = "x86_64")))] {
150-
fn compress(state: &mut [u32; 8], blocks: &[[u8; 64]]) {
151-
for block in blocks {
152-
sha2_asm::compress256(state, block);
148+
#[cfg(feature = "asm")]
149+
mod soft {
150+
pub(crate) fn compress(state: &mut [u32; 8], blocks: &[[u8; 64]]) {
151+
for block in blocks {
152+
sha2_asm::compress256(state, block);
153+
}
153154
}
154155
}
155-
} else if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
156-
mod soft;
157156
mod x86;
158157
use x86::compress;
158+
} else if #[cfg(all(feature = "asm", target_arch = "aarch64", target_os = "linux"))] {
159+
mod soft;
160+
mod aarch64;
161+
use aarch64::compress;
159162
} else {
160163
mod soft;
161164
use soft::compress;

0 commit comments

Comments
 (0)