Skip to content

Commit

Permalink
sha1: bump sha1-asm to v0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
tarcieri committed Jul 18, 2021
1 parent 5f9d064 commit 30d358d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
6 changes: 4 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion sha1/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ digest = "0.9"
block-buffer = "0.9"
opaque-debug = "0.3"
cfg-if = "1.0"
sha1-asm = { version = "0.4", optional = true }
sha1-asm = { version = "0.5", optional = true }

[target.'cfg(any(target_arch = "aarch64", target_arch = "x86_64", target_arch = "x86"))'.dependencies]
cpufeatures = "0.1.5"
Expand Down
4 changes: 1 addition & 3 deletions sha1/src/compress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ cfg_if::cfg_if! {
#[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);
}
sha1_asm::compress(state, blocks)
}
}
mod x86;
Expand Down
8 changes: 3 additions & 5 deletions sha1/src/compress/aarch64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
/// SHA-1 as well:
///
/// > Enable SHA1 and SHA256 support.
cpufeatures::new!(sha2_hwcap, "sha2");
cpufeatures::new!(sha1_hwcap, "sha2");

pub fn compress(state: &mut [u32; 5], blocks: &[u8; 64]) {
// TODO: Replace with https://github.com/rust-lang/rfcs/pull/2725
// after stabilization
if sha2_hwcap::get() {
for block in blocks {
sha1_asm::compress(state, block);
}
if sha1_hwcap::get() {
sha1_asm::compress(state, blocks);
} else {
super::soft::compress(state, blocks);
}
Expand Down

0 comments on commit 30d358d

Please sign in to comment.