Skip to content

Commit

Permalink
don't use cpuid-bool in fortanix sgx target
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Jul 14, 2020
1 parent afc167f commit e1794f2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sha2/Cargo.toml
Expand Up @@ -21,7 +21,7 @@ opaque-debug = "0.3"
cfg-if = "0.1"
sha2-asm = { version = "0.5", optional = true }

[target.'cfg(any(target_arch = "x86", target_arch = "x86_64"))'.dependencies]
[target.'cfg(all(any(target_arch = "x86", target_arch = "x86_64"), not(target_env = "sgx")))'.dependencies]
cpuid-bool = "0.1"

[target.'cfg(all(target_arch = "aarch64", target_os = "linux"))'.dependencies]
Expand Down
6 changes: 6 additions & 0 deletions sha2/src/sha256/x86.rs
Expand Up @@ -95,6 +95,7 @@ unsafe fn digest_blocks(state: &mut [u32; 8], blocks: &[[u8; 64]]) {
_mm_storeu_si128(state_ptr_mut.add(1), hgef);
}

#[cfg(feature = "cpuid_bool")]
pub fn compress(state: &mut [u32; 8], blocks: &[[u8; 64]]) {
// TODO: Replace with https://github.com/rust-lang/rfcs/pull/2725
// after stabilization
Expand All @@ -106,3 +107,8 @@ pub fn compress(state: &mut [u32; 8], blocks: &[[u8; 64]]) {
super::soft::compress(state, blocks);
}
}

#[cfg(not(feature = "cpuid_bool"))]
pub fn compress(state: &mut [u32; 8], blocks: &[[u8; 64]]) {
super::soft::compress(state, blocks);
}

0 comments on commit e1794f2

Please sign in to comment.