Skip to content

Commit 9ad48b8

Browse files
committed
Update
1 parent b685df3 commit 9ad48b8

File tree

4 files changed

+18
-383
lines changed

4 files changed

+18
-383
lines changed

Cargo.lock

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

sha2/build.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,7 @@ fn main() {
1010
} else if target_arch == "x86_64" {
1111
if target_os == "linux" {
1212
(
13-
[
14-
"src/sha256_x64_ni.S",
15-
"src/sha256_x64_avx2.S",
16-
"src/sha256_x64.S",
17-
]
18-
.iter(),
13+
["src/sha256_x64_avx2.S", "src/sha256_x64.S"].iter(),
1914
["src/sha512_x64_avx2.S", "src/sha512_x64.S"].iter(),
2015
)
2116
} else {

sha2/src/lib.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,18 @@
1414
compile_error!("crate can only be used on x86, x86-64 and aarch64 architectures");
1515

1616
cpufeatures::new!(cpuid_avx2, "avx2");
17-
cpufeatures::new!(cpuid_sha, "sha");
1817

1918
#[link(name = "sha256", kind = "static")]
2019
#[allow(dead_code)]
2120
extern "C" {
2221
fn sha256_compress(state: &mut [u32; 8], block: &[u8; 64]);
2322
fn sha256_transform_rorx(state: &mut [u32; 8], block: *const [u8; 64], num_blocks: u64);
24-
fn sha256_ni_transform(digest: &mut [u32; 8], data: *const [u8; 64], nblk: u64);
2523
}
2624

2725
/// Safe wrapper around assembly implementation of SHA256 compression function
2826
///
2927
#[inline]
3028
pub fn compress256(state: &mut [u32; 8], blocks: &[[u8; 64]]) {
31-
let token_sha = cpuid_sha::init();
32-
if token_sha.get() {
33-
if !blocks.is_empty() {
34-
unsafe { sha256_ni_transform(state, blocks.as_ptr(), blocks.len() as u64) }
35-
}
36-
return;
37-
}
3829
let token: cpuid_avx2::InitToken = cpuid_avx2::init();
3930

4031
if token.get() {

0 commit comments

Comments
 (0)