diff --git a/services/modals/Cargo.toml b/services/modals/Cargo.toml index 3b0bbd93a..dda3884c2 100644 --- a/services/modals/Cargo.toml +++ b/services/modals/Cargo.toml @@ -19,7 +19,8 @@ rkyv = { version = "0.4.3", features = [ "const_generics", ], default-features = false } gam = { path = "../gam" } -trng = { path = "../trng" } +trng = { path = "../trng", optional = true } +cram-hal-service = { path = "../cram-hal-service", optional = true } # provides trng for cramium-soc tts-frontend = { path = "../tts" } locales = { path = "../../locales" } bit_field = "0.9.0" @@ -27,9 +28,10 @@ bit_field = "0.9.0" utralib = { version = "0.1.24", optional = true, default-features = false } [features] -precursor = ["utralib/precursor"] -hosted = ["utralib/hosted"] -renode = ["utralib/renode"] +precursor = ["utralib/precursor", "trng"] +hosted = ["utralib/hosted", "trng"] +renode = ["utralib/renode", "trng"] +cramium-soc = ["utralib/cramium-soc", "cram-hal-service"] tts = [] ditherpunk = [] hazardous-debug = [] diff --git a/services/modals/src/lib.rs b/services/modals/src/lib.rs index 0c22893e4..5b3f1bc9f 100644 --- a/services/modals/src/lib.rs +++ b/services/modals/src/lib.rs @@ -180,6 +180,9 @@ impl Modals { REFCOUNT.fetch_add(1, Ordering::Relaxed); let conn = xns.request_connection_blocking(api::SERVER_NAME_MODALS).expect("Can't connect to Modals server"); + #[cfg(feature = "cramium-soc")] + let trng = cram_hal_service::trng::Trng::new(&xns).unwrap(); + #[cfg(not(feature = "cramium-soc"))] let trng = trng::Trng::new(&xns).unwrap(); let mut token = [0u32; 4]; trng.fill_buf(&mut token).unwrap(); diff --git a/services/modals/src/main.rs b/services/modals/src/main.rs index 2d5870249..8c078984a 100644 --- a/services/modals/src/main.rs +++ b/services/modals/src/main.rs @@ -138,6 +138,9 @@ fn wrapped_main() -> ! { let mut list_selected = 0u32; let mut token_lock: Option<[u32; 4]> = None; + #[cfg(feature = "cramium-soc")] + let trng = cram_hal_service::trng::Trng::new(&xns).unwrap(); + #[cfg(not(feature = "cramium-soc"))] let trng = trng::Trng::new(&xns).unwrap(); // this is a random number that serves as a "default" that cannot be guessed let default_nonce =