From 88a64924813f033f8154936f521adf7f37226e49 Mon Sep 17 00:00:00 2001 From: bunnie Date: Mon, 22 Dec 2025 16:17:08 +0800 Subject: [PATCH] make the signature check/security elements more clearly optional the problem with it being default in most configurations is that it pulls in a sha-2 and ed25519 dependency into routines that never rely on them. now libs that rely on the sigcheck need to specify the feature explicitly to pull in the depedency. --- libs/bao1x-hal/Cargo.toml | 8 +++----- libs/bao1x-hal/src/lib.rs | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/libs/bao1x-hal/Cargo.toml b/libs/bao1x-hal/Cargo.toml index 67f85735b..1a73e3a09 100644 --- a/libs/bao1x-hal/Cargo.toml +++ b/libs/bao1x-hal/Cargo.toml @@ -70,7 +70,6 @@ board-baosec = [ "utralib/bao1x", "ux-api/board-baosec", "ux-api/std", - "sigcheck", ] # USB form factor token loader-baosec = [ "utralib/bao1x", @@ -79,7 +78,6 @@ loader-baosec = [ "axp2101", "bmp180", "ux-api/loader-baosec", - "sigcheck", ] kernel = [] kernel-baosec = ["utralib/bao1x", "kernel"] @@ -93,11 +91,10 @@ board-baosor = [ "axp2101", "utralib/bao1x", "ux-api/std", - "sigcheck", ] # Precursor form factor loader-baosor = [] -board-dabao = ["utralib/bao1x", "sigcheck"] # Dev board form factor -loader-dabao = ["sigcheck"] +board-dabao = ["utralib/bao1x"] # Dev board form factor +loader-dabao = [] verilator-only = ["utralib/bao1x"] mpw = ["utralib/bao1x"] hdl-test = ["utralib/bao1x"] @@ -107,6 +104,7 @@ debug-print-duart = ["debug-print", "debug-countermeasures"] debug-print-uart = ["debug-print"] debug-countermeasures = [] debug-wfi = [] +security = ["sigcheck"] udma-stress-test = [ ] # For RTL simulation testing - aggravates a key corner case diff --git a/libs/bao1x-hal/src/lib.rs b/libs/bao1x-hal/src/lib.rs index be53682ad..bb66f02c9 100644 --- a/libs/bao1x-hal/src/lib.rs +++ b/libs/bao1x-hal/src/lib.rs @@ -36,7 +36,7 @@ pub mod buram; pub mod clocks; #[cfg(not(feature = "hosted-baosec"))] pub mod coreuser; -#[cfg(all(not(feature = "hosted-baosec"), not(feature = "kernel")))] +#[cfg(feature = "security")] pub mod hardening; #[cfg(feature = "std")] pub mod i2c; @@ -48,7 +48,7 @@ pub mod mbox; pub mod rram; #[cfg(not(feature = "hosted-baosec"))] pub mod rtc; -#[cfg(all(not(feature = "hosted-baosec"), not(feature = "kernel")))] +#[cfg(feature = "security")] pub mod sigcheck; #[cfg(not(feature = "hosted-baosec"))] pub mod sram_trim;