diff --git a/rust/bridge/ffi/Cargo.toml b/rust/bridge/ffi/Cargo.toml index 8de687fa0f..9e08c51d96 100644 --- a/rust/bridge/ffi/Cargo.toml +++ b/rust/bridge/ffi/Cargo.toml @@ -14,6 +14,9 @@ license = "AGPL-3.0-only" name = "signal_ffi" crate-type = ["staticlib"] +[features] +nightly = ["signal-crypto/nightly", "libsignal-protocol/nightly"] + [dependencies] libsignal-protocol = { path = "../../protocol" } device-transfer = { path = "../../device-transfer" } diff --git a/rust/bridge/jni/Cargo.toml b/rust/bridge/jni/Cargo.toml index 9702b79a0d..f6e9606a59 100644 --- a/rust/bridge/jni/Cargo.toml +++ b/rust/bridge/jni/Cargo.toml @@ -14,6 +14,9 @@ license = "AGPL-3.0-only" name = "signal_jni" crate-type = ["cdylib"] +[features] +nightly = ["libsignal-protocol/nightly", "signal-crypto/nightly"] + [dependencies] libsignal-protocol = { path = "../../protocol" } signal-crypto = { path = "../../crypto" } diff --git a/rust/bridge/node/Cargo.toml b/rust/bridge/node/Cargo.toml index 50f8d6b425..293098b894 100644 --- a/rust/bridge/node/Cargo.toml +++ b/rust/bridge/node/Cargo.toml @@ -14,6 +14,9 @@ edition = "2018" name = "signal_node" crate-type = ["cdylib"] +[features] +nightly = ["libsignal-protocol/nightly", "libsignal-bridge/nightly"] + [dependencies] libsignal-protocol = { path = "../../protocol" } libsignal-bridge = { path = "../shared", features = ["node"] } diff --git a/rust/bridge/shared/Cargo.toml b/rust/bridge/shared/Cargo.toml index f713e55d5b..6d49322426 100644 --- a/rust/bridge/shared/Cargo.toml +++ b/rust/bridge/shared/Cargo.toml @@ -34,3 +34,4 @@ signal-neon-futures = { path = "../node/futures", optional = true } ffi = ["libc", "libsignal-bridge-macros/ffi"] jni = ["jni_crate", "libsignal-bridge-macros/jni"] node = ["neon", "linkme", "signal-neon-futures", "libsignal-bridge-macros/node"] +nightly = ["signal-crypto/nightly", "libsignal-protocol/nightly"] diff --git a/rust/crypto/Cargo.toml b/rust/crypto/Cargo.toml index df5364c4bc..a41ee4c593 100644 --- a/rust/crypto/Cargo.toml +++ b/rust/crypto/Cargo.toml @@ -20,6 +20,9 @@ rand = "0.7.3" sha-1 = "0.9" sha2 = "0.9" +[features] +nightly = [] + [target.'cfg(all(target_arch = "aarch64", any(target_os = "linux")))'.dependencies] libc = "0.2" # for getauxval diff --git a/rust/crypto/src/lib.rs b/rust/crypto/src/lib.rs index b33e2b6f53..47b0a80745 100644 --- a/rust/crypto/src/lib.rs +++ b/rust/crypto/src/lib.rs @@ -3,8 +3,11 @@ // SPDX-License-Identifier: AGPL-3.0-only // -#![cfg_attr(target_arch = "aarch64", feature(stdsimd))] -#![cfg_attr(target_arch = "aarch64", feature(aarch64_target_feature))] +#![cfg_attr(all(target_arch = "aarch64", feature = "nightly"), feature(stdsimd))] +#![cfg_attr( + all(target_arch = "aarch64", feature = "nightly"), + feature(aarch64_target_feature) +)] #![deny(clippy::unwrap_used)] mod error; diff --git a/rust/crypto/src/polyval.rs b/rust/crypto/src/polyval.rs index 849f7fbe7f..fa7b916fbf 100644 --- a/rust/crypto/src/polyval.rs +++ b/rust/crypto/src/polyval.rs @@ -10,7 +10,7 @@ mod polyval_soft; #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] mod polyval_clmul; -#[cfg(target_arch = "aarch64")] +#[cfg(all(target_arch = "aarch64", feature = "nightly"))] mod polyval_pmul; #[derive(Clone)] @@ -18,7 +18,7 @@ pub enum Polyval { Soft(polyval_soft::PolyvalSoft), #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] Clmul(polyval_clmul::PolyvalClmul), - #[cfg(target_arch = "aarch64")] + #[cfg(all(target_arch = "aarch64", feature = "nightly"))] Pmul(polyval_pmul::PolyvalPmul), } @@ -35,7 +35,7 @@ impl Polyval { } } - #[cfg(target_arch = "aarch64")] + #[cfg(all(target_arch = "aarch64", feature = "nightly"))] { if crate::cpuid::has_armv8_crypto() { return Ok(Polyval::Pmul(polyval_pmul::PolyvalPmul::new(key)?)); @@ -54,7 +54,7 @@ impl Polyval { Polyval::Soft(polyval) => polyval.update(data), #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] Polyval::Clmul(polyval) => polyval.update(data), - #[cfg(target_arch = "aarch64")] + #[cfg(all(target_arch = "aarch64", feature = "nightly"))] Polyval::Pmul(polyval) => polyval.update(data), } } @@ -64,7 +64,7 @@ impl Polyval { Polyval::Soft(polyval) => polyval.update_padded(data), #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] Polyval::Clmul(polyval) => polyval.update_padded(data), - #[cfg(target_arch = "aarch64")] + #[cfg(all(target_arch = "aarch64", feature = "nightly"))] Polyval::Pmul(polyval) => polyval.update_padded(data), } } @@ -74,7 +74,7 @@ impl Polyval { Polyval::Soft(polyval) => polyval.finalize(), #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] Polyval::Clmul(polyval) => polyval.finalize(), - #[cfg(target_arch = "aarch64")] + #[cfg(all(target_arch = "aarch64", feature = "nightly"))] Polyval::Pmul(polyval) => polyval.finalize(), } } diff --git a/rust/protocol/Cargo.toml b/rust/protocol/Cargo.toml index 59dc5c72e7..1fd6ae95a0 100644 --- a/rust/protocol/Cargo.toml +++ b/rust/protocol/Cargo.toml @@ -40,7 +40,7 @@ default = ["u64_backend"] u32_backend = ["curve25519-dalek/u32_backend"] u64_backend = ["curve25519-dalek/u64_backend"] simd_backend = ["curve25519-dalek/simd_backend"] -nightly = ["curve25519-dalek/nightly"] +nightly = ["curve25519-dalek/nightly", "signal-crypto/nightly"] [dev-dependencies] criterion = "0.3"