feat(cpu): expose hardware aes for csprng

This commit is contained in:
Mayeul@Zama
2023-03-09 11:03:36 +01:00
committed by Quentin Bourgerie
parent 46755e613c
commit f393d255a2
2 changed files with 9 additions and 3 deletions

View File

@@ -39,6 +39,8 @@ std = [
csprng = ["concrete-csprng"]
parallel = ["rayon"]
nightly = ["pulp/nightly"]
x86_64 = ["concrete-csprng/generator_x86_64_aesni"]
aarch64 = ["concrete-csprng/generator_aarch64_aes"]
[build-dependencies]
cbindgen = "0.24"

View File

@@ -1,12 +1,16 @@
use std::io::Read;
use super::types::{Csprng, CsprngVtable, Uint128};
use concrete_csprng::generators::{RandomGenerator, SoftwareRandomGenerator};
#[cfg(feature = "x86_64")]
use concrete_csprng::generators::AesniRandomGenerator as Generator;
#[cfg(feature = "aarch64")]
use concrete_csprng::generators::NeonAesRandomGenerator as Generator;
use concrete_csprng::generators::RandomGenerator;
#[cfg(all(not(feature = "aarch64"), not(feature = "x86_64")))]
use concrete_csprng::generators::SoftwareRandomGenerator as Generator;
use concrete_csprng::seeders::Seed;
use libc::c_int;
type Generator = SoftwareRandomGenerator;
#[no_mangle]
pub static CONCRETE_CSPRNG_VTABLE: CsprngVtable = CsprngVtable {
remaining_bytes: {