Skip to content

Commit

Permalink
Ignore asm feature on unsupported targets (#388)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkna committed Aug 29, 2022
1 parent 79af27a commit e5ad181
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions md5/Cargo.toml
Expand Up @@ -16,6 +16,8 @@ name = "md5"

[dependencies]
digest = "0.10.3"

[target.'cfg(any(target_arch = "x86", target_arch = "x86_64"))'.dependencies]
md5-asm = { version = "0.5", optional = true }

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions md5/src/lib.rs
Expand Up @@ -31,10 +31,10 @@
)]
#![warn(missing_docs, rust_2018_idioms)]

#[cfg(feature = "asm")]
#[cfg(all(feature = "asm", any(target_arch = "x86", target_arch = "x86_64")))]
extern crate md5_asm as compress;

#[cfg(not(feature = "asm"))]
#[cfg(not(all(feature = "asm", any(target_arch = "x86", target_arch = "x86_64"))))]
mod compress;

pub use digest::{self, Digest};
Expand Down
2 changes: 1 addition & 1 deletion sha1/Cargo.toml
Expand Up @@ -15,10 +15,10 @@ categories = ["cryptography", "no-std"]
[dependencies]
digest = "0.10.3"
cfg-if = "1.0"
sha1-asm = { version = "0.5", optional = true }

[target.'cfg(any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64"))'.dependencies]
cpufeatures = "0.2"
sha1-asm = { version = "0.5", optional = true }

[dev-dependencies]
digest = { version = "0.10.3", features = ["dev"] }
Expand Down
2 changes: 1 addition & 1 deletion sha2/Cargo.toml
Expand Up @@ -17,10 +17,10 @@ categories = ["cryptography", "no-std"]
[dependencies]
digest = "0.10.3"
cfg-if = "1.0"
sha2-asm = { version = "0.6.1", optional = true }

[target.'cfg(any(target_arch = "aarch64", target_arch = "x86_64", target_arch = "x86"))'.dependencies]
cpufeatures = "0.2"
sha2-asm = { version = "0.6.1", optional = true }

[dev-dependencies]
digest = { version = "0.10.3", features = ["dev"] }
Expand Down
2 changes: 2 additions & 0 deletions whirlpool/Cargo.toml
Expand Up @@ -13,6 +13,8 @@ categories = ["cryptography", "no-std"]

[dependencies]
digest = "0.10.3"

[target.'cfg(any(target_arch = "x86", target_arch = "x86_64"))'.dependencies]
whirlpool-asm = { version = "0.6", optional = true}

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions whirlpool/src/lib.rs
Expand Up @@ -45,10 +45,10 @@

pub use digest::{self, Digest};

#[cfg(not(feature = "asm"))]
#[cfg(not(all(feature = "asm", any(target_arch = "x86", target_arch = "x86_64"))))]
mod compress;

#[cfg(feature = "asm")]
#[cfg(all(feature = "asm", any(target_arch = "x86", target_arch = "x86_64")))]
use whirlpool_asm as compress;

use compress::compress;
Expand Down

0 comments on commit e5ad181

Please sign in to comment.