Skip to content

Commit

Permalink
Use SHA1 intrinsics when asm feature is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
not-an-aardvark committed Jan 31, 2021
1 parent f6a0efd commit 0cd7dc8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions sha1/CHANGELOG.md
Expand Up @@ -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.9.3 (2021-01-31)
### Changed
- Use SHA1 intrinsics when `asm` feature is enabled

[#225]: https://github.com/RustCrypto/hashes/pull/225

## 0.9.2 (2020-11-04)
### Added
- `force-soft` feature to enforce use of software implementation. ([#203])
Expand Down
2 changes: 1 addition & 1 deletion sha1/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "sha-1"
version = "0.9.2"
version = "0.9.3"
description = "SHA-1 hash function"
authors = ["RustCrypto Developers"]
license = "MIT OR Apache-2.0"
Expand Down
15 changes: 9 additions & 6 deletions sha1/src/compress.rs
Expand Up @@ -9,14 +9,17 @@ cfg_if::cfg_if! {
mod soft;
mod aarch64;
use aarch64::compress as compress_inner;
} else if #[cfg(all(feature = "asm", any(target_arch = "x86", target_arch = "x86_64")))] {
fn compress_inner(state: &mut [u32; 5], blocks: &[[u8; 64]]) {
for block in blocks {
sha1_asm::compress(state, block);
}
}
} else if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
#[cfg(not(feature = "asm"))]
mod soft;
#[cfg(feature = "asm")]
mod soft {
pub(crate) fn compress(state: &mut [u32; 5], blocks: &[[u8; 64]]) {
for block in blocks {
sha1_asm::compress(state, block);
}
}
}
mod x86;
use x86::compress as compress_inner;
} else {
Expand Down

0 comments on commit 0cd7dc8

Please sign in to comment.