diff --git a/services/bao-console/src/cmds/i2cdetect.rs b/services/bao-console/src/cmds/i2cdetect.rs index 9aa68b69d..21394ae00 100644 --- a/services/bao-console/src/cmds/i2cdetect.rs +++ b/services/bao-console/src/cmds/i2cdetect.rs @@ -1,6 +1,9 @@ use String; use bao1x_api::I2cApi; use bao1x_api::I2cResult; +#[cfg(feature = "hosted-baosec")] +use bao1x_emu::i2c::I2c; +#[cfg(not(feature = "hosted-baosec"))] use bao1x_hal_service::I2c; use crate::{CommonEnv, ShellCmdApi}; diff --git a/services/bao-console/src/cmds/test.rs b/services/bao-console/src/cmds/test.rs index b866bb462..b21f3d64a 100644 --- a/services/bao-console/src/cmds/test.rs +++ b/services/bao-console/src/cmds/test.rs @@ -57,6 +57,7 @@ impl<'a> ShellCmdApi<'a> for Test { } } } + #[cfg(not(feature = "hosted-baosec"))] "shutdown" => { use bao1x_api::*; use bao1x_hal_service::I2c; diff --git a/services/bao1x-emu/src/main.rs b/services/bao1x-emu/src/main.rs index bfe3985ea..714d4420f 100644 --- a/services/bao1x-emu/src/main.rs +++ b/services/bao1x-emu/src/main.rs @@ -8,7 +8,7 @@ fn main() { log::info!("my PID is {}", xous::process::id()); let xns = xous_names::XousNames::new().unwrap(); - let sid = xns.register_name(bao1x_api::SERVER_NAME_bao1x_HAL, None).expect("can't register server"); + let sid = xns.register_name(bao1x_api::SERVER_NAME_BAO1X_HAL, None).expect("can't register server"); // start keyboard emulator service keyboard::start_keyboard_service(); @@ -123,6 +123,7 @@ fn main() { HalOpcode::InvalidCall => { log::error!("Invalid opcode received: {:?}", msg); } + bao1x_api::HalOpcode::ConfigureBio => todo!(), HalOpcode::Quit => { log::info!("Received quit opcode, exiting."); break; diff --git a/services/bao1x-emu/src/trng.rs b/services/bao1x-emu/src/trng.rs index fcde8bfe9..28a3766d0 100644 --- a/services/bao1x-emu/src/trng.rs +++ b/services/bao1x-emu/src/trng.rs @@ -18,20 +18,19 @@ impl Trng { /// This is copied out of the 0.5 API for rand_core pub fn fill_bytes_via_next(&mut self, dest: &mut [u8]) { - use core::mem::transmute; let mut left = dest; while left.len() >= 8 { let (l, r) = { left }.split_at_mut(8); left = r; - let chunk: [u8; 8] = unsafe { transmute(rand::thread_rng().next_u64().to_le()) }; + let chunk: [u8; 8] = u64::to_ne_bytes(rand::thread_rng().next_u64().to_le()); l.copy_from_slice(&chunk); } let n = left.len(); if n > 4 { - let chunk: [u8; 8] = unsafe { transmute(rand::thread_rng().next_u64().to_le()) }; + let chunk: [u8; 8] = u64::to_ne_bytes(rand::thread_rng().next_u64().to_le()); left.copy_from_slice(&chunk[..n]); } else if n > 0 { - let chunk: [u8; 4] = unsafe { transmute(rand::thread_rng().next_u32().to_le()) }; + let chunk: [u8; 4] = u32::to_ne_bytes(rand::thread_rng().next_u32().to_le()); left.copy_from_slice(&chunk[..n]); } } diff --git a/services/keystore/Cargo.toml b/services/keystore/Cargo.toml index 70aeff51f..01e2ffacd 100644 --- a/services/keystore/Cargo.toml +++ b/services/keystore/Cargo.toml @@ -87,6 +87,7 @@ test-baosec = ["ux-api/loader-baosec"] hosted-baosec = [ "keystore-api/gen2", "modals/no-gam", + "aes", ] # emulated hardware on x86 platform board-baosor = [ "utralib/bao1x", @@ -94,10 +95,7 @@ board-baosor = [ "modals/bao1x", ] # Precursor form factor loader-baosor = [] -board-dabao = [ - "utralib/bao1x", - "keystore-api/gen2", -] # Dev board form factor +board-dabao = ["utralib/bao1x", "keystore-api/gen2"] # Dev board form factor loader-dabao = [] policy-menu = [