From 4fda240a7da620fa046f51dc60719c1ddcf7fff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Garillot?= Date: Wed, 22 Jul 2020 14:53:59 -0400 Subject: [PATCH] Pass the {curve, x}25519-dalek features through the build --- Cargo.toml | 8 +++++--- src/lib.rs | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index adad5be..2e01b2d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,13 +10,15 @@ edition = "2018" readme = "README.md" [features] -default = [] +default = ["u64_backend"] slow-hash = ["scrypt"] bench = [] +u64_backend = ["curve25519-dalek/u64_backend", "x25519-dalek/u64_backend"] +u32_backend = ["curve25519-dalek/u32_backend", "x25519-dalek/u32_backend"] [dependencies] aead = "0.3.1" -curve25519-dalek = "2.1.0" +curve25519-dalek = { version = "2.1.0", default-features = false, features = ["std"]} displaydoc = "0.1" generic-array = "0.14.2" hkdf = "0.9.0-alpha.0" @@ -25,7 +27,7 @@ rand_core = "0.5.1" scrypt = { version = "0.3.0", optional = true } sha2 = "0.9.0" thiserror = "1.0.19" -x25519-dalek = "0.6.0" +x25519-dalek = { version = "0.6.0", default-features = false, features = ["std"]} zeroize = "1.1" [dev-dependencies] diff --git a/src/lib.rs b/src/lib.rs index 604ba0a..db283d2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -386,6 +386,12 @@ #![cfg_attr(not(feature = "bench"), deny(missing_docs))] #![deny(unsafe_code)] +#[cfg(not(any(feature = "u64_backend", feature = "u32_backend",)))] +compile_error!( + "no dalek arithmetic backend cargo feature enabled! \ + please enable one of: u64_backend, u32_backend" +); + // Error types pub mod errors;