Skip to content

Commit

Permalink
Small fix
Browse files Browse the repository at this point in the history
Fix
  • Loading branch information
0xdeafbeef committed Sep 6, 2021
1 parent efec464 commit 99627cf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sha2/Cargo.toml
Expand Up @@ -11,7 +11,7 @@ categories = ["cryptography", "no-std"]
edition = "2018"

[dependencies]
cpufeatures = "0.2.1"
cpufeatures = "0.2"

[build-dependencies]
cc = "1.0"
4 changes: 2 additions & 2 deletions sha2/src/lib.rs
Expand Up @@ -43,7 +43,7 @@ pub fn compress256(state: &mut [u32; 8], blocks: &[[u8; 64]]) {
#[link(name = "sha512", kind = "static")]
extern "C" {
fn sha512_compress(state: &mut [u64; 8], block: &[u8; 128]);
fn sha512_transform_rorx(state: &mut [u64; 8], block: *const [u8; 128], num_blocks: u64);
fn sha512_transform_rorx(state: &mut [u64; 8], block: *const [u8; 128], num_blocks: usize);
}

/// Safe wrapper around assembly implementation of SHA512 compression function
Expand All @@ -55,7 +55,7 @@ pub fn compress512(state: &mut [u64; 8], blocks: &[[u8; 128]]) {
let token: cpuid_avx2::InitToken = cpuid_avx2::init();
if token.get() {
if !blocks.is_empty() {
unsafe { sha512_transform_rorx(state, blocks.as_ptr(), blocks.len() as u64) }
unsafe { sha512_transform_rorx(state, blocks.as_ptr(), blocks.len()) }
}
} else {
for block in blocks {
Expand Down

0 comments on commit 99627cf

Please sign in to comment.