From b1121daef64ddb1aa7e0dab48f2ce743b1479692 Mon Sep 17 00:00:00 2001 From: bunnie Date: Fri, 30 Jan 2026 04:01:09 +0800 Subject: [PATCH] security-relevant: modify collateral test to not panic on failure The panic on failure causes incompatibility with older boot0's that don't set up the collateral area correctly. Make the failure more graceful, but we also promise ourselves to add CI tests to check for this explicitly, because we can't just rely on panics to enforce behavior. --- services/keystore/src/platform/baosec/server.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/keystore/src/platform/baosec/server.rs b/services/keystore/src/platform/baosec/server.rs index 244d954b5..aacc65af8 100644 --- a/services/keystore/src/platform/baosec/server.rs +++ b/services/keystore/src/platform/baosec/server.rs @@ -19,7 +19,8 @@ pub fn keystore(sid: SID) -> ! { if store.is_collateral_erased() { log::info!("{}COLLATERAL.ERASED,{}", BOOKEND_START, BOOKEND_END); } else { - panic!("Collateral is not erased - protocol error for Baochip firmwares!"); + log::error!("Collateral is not erased - protocol error for Baochip firmwares!"); + log::info!("{}COLLATERAL.FAIL,{}", BOOKEND_START, BOOKEND_END); } let mut msg_opt = None;