Skip to content

Commit

Permalink
chore(csprng)!: remove generator_aarch64_aes feature
Browse files Browse the repository at this point in the history
BREAKING_CHANGE:
- The `generator_aarch64_aes` feature is no longer supported for tfhe-csprng
  • Loading branch information
nsarlin-zama committed Dec 9, 2024
1 parent 88288de commit 3b22760
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 109 deletions.
3 changes: 1 addition & 2 deletions tfhe-csprng/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ clap = "=4.4.4"
[features]
parallel = ["rayon"]
generator_fallback = []
generator_aarch64_aes = []

x86_64 = ["parallel", "generator_fallback"]
x86_64-unix = ["x86_64"]
aarch64 = ["parallel", "generator_aarch64_aes", "generator_fallback"]
aarch64 = ["parallel", "generator_fallback"]
aarch64-unix = ["aarch64"]
software_prng = []

Expand Down
93 changes: 0 additions & 93 deletions tfhe-csprng/build.rs

This file was deleted.

4 changes: 2 additions & 2 deletions tfhe-csprng/examples/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
use clap::{value_parser, Arg, Command};
#[cfg(all(target_arch = "x86_64", target_feature = "aes"))]
use tfhe_csprng::generators::AesniRandomGenerator as ActivatedRandomGenerator;
#[cfg(feature = "generator_aarch64_aes")]
#[cfg(all(target_arch = "aarch64", target_feature = "neon"))]
use tfhe_csprng::generators::NeonAesRandomGenerator as ActivatedRandomGenerator;
use tfhe_csprng::generators::RandomGenerator;
#[cfg(all(
not(all(target_arch = "x86_64", target_feature = "aes")),
not(feature = "generator_aarch64_aes"),
not(all(target_arch = "aarch64", target_feature = "neon")),
))]
use tfhe_csprng::generators::SoftwareRandomGenerator as ActivatedRandomGenerator;

Expand Down
3 changes: 2 additions & 1 deletion tfhe-csprng/src/generators/implem/aarch64/block_cipher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ impl AesBlockCipher for ArmAesBlockCipher {
if !(aes_detected && neon_detected) {
panic!(
"The ArmAesBlockCipher requires both aes and neon aarch64 CPU features.\n\
aes feature available: {}\nneon feature available: {}\n.",
aes feature available: {}\nneon feature available: {}\n\
Please consider enabling the SoftwareRandomGenerator with the `software_prng` feature",
aes_detected, neon_detected
)
}
Expand Down
4 changes: 2 additions & 2 deletions tfhe-csprng/src/generators/implem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ mod aesni;
#[cfg(target_arch = "x86_64")]
pub use aesni::*;

#[cfg(feature = "generator_aarch64_aes")]
#[cfg(target_arch = "aarch64")]
mod aarch64;
#[cfg(feature = "generator_aarch64_aes")]
#[cfg(target_arch = "aarch64")]
pub use aarch64::*;

#[cfg(feature = "software_prng")]
Expand Down
6 changes: 1 addition & 5 deletions tfhe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,6 @@ parallel-wasm-api = ["dep:wasm-bindgen-rayon"]

nightly-avx512 = ["tfhe-fft/nightly", "tfhe-ntt/nightly", "pulp/nightly"]

# Enable the aarch64 specific accelerated implementation of the random generator for the default
# backend
generator_aarch64_aes = ["tfhe-csprng/generator_aarch64_aes"]

# Private features
__profiling = []
__long_run_tests = []
Expand All @@ -147,7 +143,7 @@ __long_run_tests = []
x86_64 = []
x86_64-unix = ["x86_64"]

aarch64 = ["generator_aarch64_aes"]
aarch64 = []
aarch64-unix = ["aarch64"]

[package.metadata.docs.rs]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#[cfg(all(target_arch = "x86_64", target_feature = "aes"))]
use tfhe_csprng::generators::AesniRandomGenerator;
#[cfg(feature = "generator_aarch64_aes")]
#[cfg(all(target_arch = "aarch64", target_feature = "neon"))]
use tfhe_csprng::generators::NeonAesRandomGenerator;
#[cfg(all(
not(all(target_arch = "x86_64", target_feature = "aes")),
not(feature = "generator_aarch64_aes")
not(all(target_arch = "aarch64", target_feature = "neon"))
))]
use tfhe_csprng::generators::SoftwareRandomGenerator;

#[cfg(all(target_arch = "x86_64", target_feature = "aes"))]
pub type ActivatedRandomGenerator = AesniRandomGenerator;
#[cfg(feature = "generator_aarch64_aes")]
#[cfg(all(target_arch = "aarch64", target_feature = "neon"))]
pub type ActivatedRandomGenerator = NeonAesRandomGenerator;
#[cfg(all(
not(all(target_arch = "x86_64", target_feature = "aes")),
not(feature = "generator_aarch64_aes")
not(all(target_arch = "aarch64", target_feature = "neon"))
))]
pub type ActivatedRandomGenerator = SoftwareRandomGenerator;

0 comments on commit 3b22760

Please sign in to comment.