mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-08 04:56:43 +00:00
oem-baosec-lite support in hal-service
this one is a little bit tricky. The lite version of baosec forgoes the off-chip TRNG to save cost. Thus, there is an "anti-feature" in the configuration, and so in this case the dabao version of the server has to be selected despite the baosec flag.
This commit is contained in:
parent
e329ebeb1d
commit
bcf73733c3
5 changed files with 17 additions and 12 deletions
|
|
@ -48,6 +48,7 @@ swap = []
|
|||
mpw = ["bao1x-hal/mpw"]
|
||||
bmp180 = ["bao1x-hal/bmp180"]
|
||||
board-baosec = ["bao1x-hal/board-baosec"]
|
||||
oem-baosec-lite = []
|
||||
board-baosor = ["bao1x-hal/board-baosor"]
|
||||
board-dabao = ["bao1x-hal/board-dabao"]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
pub mod keyboard;
|
||||
|
||||
// TRNG server is only needed for baosec; dabao can cheat and use the kernel TRNG port
|
||||
#[cfg(feature = "board-baosec")]
|
||||
#[cfg(all(feature = "board-baosec", not(feature = "oem-baosec-lite")))]
|
||||
mod baosec_hw;
|
||||
pub mod bio;
|
||||
pub mod rtc;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
#[cfg(feature = "board-baosec")]
|
||||
#[cfg(all(feature = "board-baosec", not(feature = "oem-baosec-lite")))]
|
||||
use bao1x_api::bio::IoConfigMode;
|
||||
#[cfg(feature = "board-dabao")]
|
||||
#[cfg(any(feature = "board-dabao", feature = "oem-baosec-lite"))]
|
||||
use bao1x_hal_service::trng::Trng;
|
||||
use bao1x_hal_service::trng::api;
|
||||
use flatipc::Ipc;
|
||||
use num_traits::*;
|
||||
#[cfg(feature = "board-baosec")]
|
||||
#[cfg(all(feature = "board-baosec", not(feature = "oem-baosec-lite")))]
|
||||
use rand::RngCore;
|
||||
use xous::CID;
|
||||
use xous_ipc::Buffer;
|
||||
|
|
@ -18,7 +18,7 @@ struct ScalarCallback {
|
|||
cb_to_client_id: u32,
|
||||
}
|
||||
|
||||
#[cfg(feature = "board-baosec")]
|
||||
#[cfg(all(feature = "board-baosec", not(feature = "oem-baosec-lite")))]
|
||||
pub fn start_trng_service() {
|
||||
std::thread::spawn({
|
||||
move || {
|
||||
|
|
@ -26,7 +26,7 @@ pub fn start_trng_service() {
|
|||
}
|
||||
});
|
||||
}
|
||||
#[cfg(feature = "board-baosec")]
|
||||
#[cfg(all(feature = "board-baosec", not(feature = "oem-baosec-lite")))]
|
||||
fn trng_service() -> ! {
|
||||
let xns = xous_names::XousNames::new().unwrap();
|
||||
// unlimited connections allowed, anyone including less-trusted processes can get a random number
|
||||
|
|
@ -88,7 +88,7 @@ fn trng_service() -> ! {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "board-dabao")]
|
||||
#[cfg(any(feature = "board-dabao", feature = "oem-baosec-lite"))]
|
||||
pub fn start_trng_service() {
|
||||
std::thread::spawn({
|
||||
move || {
|
||||
|
|
@ -96,7 +96,7 @@ pub fn start_trng_service() {
|
|||
}
|
||||
});
|
||||
}
|
||||
#[cfg(feature = "board-dabao")]
|
||||
#[cfg(any(feature = "board-dabao", feature = "oem-baosec-lite"))]
|
||||
fn trng_service() -> ! {
|
||||
let xns = xous_names::XousNames::new().unwrap();
|
||||
// unlimited connections allowed, anyone including less-trusted processes can get a random number
|
||||
|
|
|
|||
|
|
@ -104,6 +104,10 @@ impl Trng {
|
|||
}
|
||||
}
|
||||
|
||||
/// With no avalanche TRNG, this is just a pass-through to the RO as it has enough
|
||||
/// bandwidth to provide random data at the speeds we need.
|
||||
pub fn fill_seeded_bytes(&mut self, dest: &mut [u8]) { self.fill_bytes_via_next(dest); }
|
||||
|
||||
/// Sets the test mode according to the argument. Blocks until mode is set.
|
||||
pub fn set_test_mode(&mut self, test_mode: api::TrngTestMode) { self.mode = test_mode; }
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
#[cfg(feature = "board-baosec")]
|
||||
#[cfg(all(feature = "board-baosec", not(feature = "oem-baosec-lite")))]
|
||||
pub mod baosec;
|
||||
#[cfg(feature = "board-baosec")]
|
||||
#[cfg(all(feature = "board-baosec", not(feature = "oem-baosec-lite")))]
|
||||
pub use baosec::*;
|
||||
#[cfg(feature = "board-dabao")]
|
||||
#[cfg(any(feature = "board-dabao", feature = "oem-baosec-lite"))]
|
||||
pub mod dabao;
|
||||
#[cfg(feature = "board-dabao")]
|
||||
#[cfg(any(feature = "board-dabao", feature = "oem-baosec-lite"))]
|
||||
pub use dabao::*;
|
||||
|
||||
pub mod api {
|
||||
|
|
|
|||
Loading…
Reference in a new issue