From 34957af554cfc92c3aea44fc46044997972ee8c0 Mon Sep 17 00:00:00 2001 From: Alexander Weiss Date: Tue, 18 Apr 2023 22:22:56 +0200 Subject: [PATCH] Use sha2 assembler optimization when possible --- Cargo.lock | 10 ++++++++++ Cargo.toml | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 2f5d858..72189f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2174,6 +2174,16 @@ dependencies = [ "cfg-if", "cpufeatures", "digest", + "sha2-asm", +] + +[[package]] +name = "sha2-asm" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf27176fb5d15398e3a479c652c20459d9dac830dedd1fa55b42a77dbcdbfcea" +dependencies = [ + "cc", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 3f54746..c7bfe11 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,7 +35,6 @@ crossbeam-channel = "0.5" rayon = "1" #crypto aes256ctr_poly1305aes = "0.1" -sha2 = "0.10" rand = "0.8" scrypt = { version = "0.11", default-features = false } # chunker / packer @@ -90,8 +89,13 @@ libc = "0.2" rhai = {version = "1.13", features = ["sync", "serde", "no_optimize", "no_module", "no_custom_syntax", "only_i64"]} [target.'cfg(not(windows))'.dependencies] +sha2 = { version = "0.10", features = ["asm"] } users = "0.11" +[target.'cfg(windows)'.dependencies] +# unfortunately, the asm extensions do not build on MSVC, see https://github.com/RustCrypto/asm-hashes/issues/17 +sha2 = "0.10" + [target.'cfg(not(any(windows, target_os="openbsd")))'.dependencies] xattr = "1"