From b557cd5ebc1fb72e20b2f023cfd4c7fcd07f562e Mon Sep 17 00:00:00 2001 From: bunnie Date: Tue, 28 Oct 2025 18:02:33 +0800 Subject: [PATCH] add some trng tests to the console --- services/bao-console/Cargo.toml | 3 ++- services/bao-console/src/cmds/trng_cmd.rs | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/services/bao-console/Cargo.toml b/services/bao-console/Cargo.toml index 068e14caf..a9a80b2e1 100644 --- a/services/bao-console/Cargo.toml +++ b/services/bao-console/Cargo.toml @@ -70,6 +70,7 @@ modal-testing = ["ux-api", "modals/modal-testing"] test-scrollbars = [] test-flash = [] ctap-bringup = ["xous-usb-hid"] +# this is mutually exclusive with the keystore, as keystore owns rram rramtests = [] # Activating this makes this crate *try* to grab the DUART. To improve its odds @@ -77,4 +78,4 @@ rramtests = [] # loaded and run. duart-debug-hal = ["bao1x-hal/debug-print-duart"] -default = ["rramtests"] +default = [] diff --git a/services/bao-console/src/cmds/trng_cmd.rs b/services/bao-console/src/cmds/trng_cmd.rs index 43c8845af..14aa1f39e 100644 --- a/services/bao-console/src/cmds/trng_cmd.rs +++ b/services/bao-console/src/cmds/trng_cmd.rs @@ -14,12 +14,13 @@ impl<'a> ShellCmdApi<'a> for TrngCmd { fn process(&mut self, args: String, env: &mut CommonEnv) -> Result, xous::Error> { use core::fmt::Write; let mut ret = String::new(); - let helpstring = "trng [pump]"; + let helpstring = "trng [pump] [u32] [u64]"; let mut tokens = args.split(' '); if let Some(sub_cmd) = tokens.next() { match sub_cmd { + // used to test reseeding of the TRNG API "pump" => { const ROUNDS: usize = 16; for i in 0..ROUNDS { @@ -30,6 +31,12 @@ impl<'a> ShellCmdApi<'a> for TrngCmd { } write!(ret, "Pumped {}x1k values out of the engine", ROUNDS).unwrap(); } + "u32" => { + log::info!("A u32 trng value: {:x}", env.trng.get_u32().unwrap()); + } + "u64" => { + log::info!("A u64 trng value: {:x}", env.trng.get_u64().unwrap()); + } _ => { write!(ret, "{}", helpstring).unwrap(); }