Skip to content

Commit 30d358d

Browse files
committed
sha1: bump sha1-asm to v0.5
1 parent 5f9d064 commit 30d358d

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

Cargo.lock

+4-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sha1/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ digest = "0.9"
1919
block-buffer = "0.9"
2020
opaque-debug = "0.3"
2121
cfg-if = "1.0"
22-
sha1-asm = { version = "0.4", optional = true }
22+
sha1-asm = { version = "0.5", optional = true }
2323

2424
[target.'cfg(any(target_arch = "aarch64", target_arch = "x86_64", target_arch = "x86"))'.dependencies]
2525
cpufeatures = "0.1.5"

sha1/src/compress.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ cfg_if::cfg_if! {
1515
#[cfg(feature = "asm")]
1616
mod soft {
1717
pub(crate) fn compress(state: &mut [u32; 5], blocks: &[[u8; 64]]) {
18-
for block in blocks {
19-
sha1_asm::compress(state, block);
20-
}
18+
sha1_asm::compress(state, blocks)
2119
}
2220
}
2321
mod x86;

sha1/src/compress/aarch64.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@
55
/// SHA-1 as well:
66
///
77
/// > Enable SHA1 and SHA256 support.
8-
cpufeatures::new!(sha2_hwcap, "sha2");
8+
cpufeatures::new!(sha1_hwcap, "sha2");
99

1010
pub fn compress(state: &mut [u32; 5], blocks: &[u8; 64]) {
1111
// TODO: Replace with https://github.com/rust-lang/rfcs/pull/2725
1212
// after stabilization
13-
if sha2_hwcap::get() {
14-
for block in blocks {
15-
sha1_asm::compress(state, block);
16-
}
13+
if sha1_hwcap::get() {
14+
sha1_asm::compress(state, blocks);
1715
} else {
1816
super::soft::compress(state, blocks);
1917
}

0 commit comments

Comments
 (0)