Merge pull request #786 from betrusted-io/release-ci

Release CI testing
This commit is contained in:
bunnie 2026-01-19 03:59:09 +08:00 committed by GitHub
commit 5eec0702f9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 44 additions and 29 deletions

View file

@ -33,7 +33,7 @@ use crate::secboot::try_boot;
// Notes:
// - "Towards" - not a release yet, but working towards the stated milestone
// - Eliminating "Towards" is done at the tag-out point.
const RELEASE_DESCRIPTION: &'static str = "Towards Beta-0";
const RELEASE_DESCRIPTION: &'static str = "Beta-0";
static UART_RX: Mutex<RefCell<VecDeque<u8>>> = Mutex::new(RefCell::new(VecDeque::new()));
#[allow(dead_code)]

View file

@ -145,7 +145,7 @@ pub fn setup() -> (UsbDeviceState, u32) {
}
pub fn shutdown() {
crate::debug::USE_CONSOLE.store(false, core::sync::atomic::Ordering::SeqCst);
crate::USB_CONNECTED.store(false, core::sync::atomic::Ordering::SeqCst);
unsafe {
if let Some(ref mut usb_ref) = crate::platform::bao1x::usb::USB {
let usb = &mut *core::ptr::addr_of_mut!(*usb_ref);

View file

@ -72,12 +72,16 @@ pub const BOOT0_TO_BOOT1: SecurityConfiguration = SecurityConfiguration {
};
/// This is different from a jump directly to loader/baremetal because the
/// function codes *must* be for Boot1.
/// function codes *must* be for Boot1 or Baremetal. Loader is not a valid option.
pub const BOOT0_TO_ALTBOOT1: SecurityConfiguration = SecurityConfiguration {
image_ptr: crate::LOADER_START as *const u32,
pubkey_ptr: crate::BOOT0_START as *const u32,
revocation_owc: crate::BOOT0_REVOCATION_OFFSET,
function_codes: &[FunctionCode::Boot1 as u32, FunctionCode::UpdatedBoot1 as u32],
function_codes: &[
FunctionCode::Boot1 as u32,
FunctionCode::UpdatedBoot1 as u32,
FunctionCode::Baremetal as u32,
],
};
pub const BOOT1_TO_LOADER_OR_BAREMETAL: SecurityConfiguration = SecurityConfiguration {

View file

@ -286,7 +286,12 @@ pub fn erase_collateral(csprng: &mut Option<&mut Csprng>) -> Result<(), String>
bollard!(die_no_std, 4);
csprng.as_deref_mut().map(|rng| rng.random_delay());
// only clear ACL if it isn't already cleared
if slot_mgr.get_acl(slot).unwrap().raw_u32() != 0 {
if slot_mgr
.get_acl(slot)
.unwrap_or(AccessSettings::Data(DataSlotAccess::new_with_raw_value(0xFFFF_FFFF)))
.raw_u32()
!= 0
{
// clear the ACL so we can operate on the data
slot_mgr
.set_acl(&mut rram, slot, &AccessSettings::Data(DataSlotAccess::new_with_raw_value(0)))
@ -347,15 +352,23 @@ pub fn erase_secrets(csprng: &mut Option<&mut Csprng>) -> Result<(), String> {
match rw_perms {
RwPerms::ReadWrite | RwPerms::WriteOnly => {
// only clear ACL if it isn't already cleared
if slot_mgr.get_acl(slot).unwrap().raw_u32() != 0 {
if slot_mgr
.get_acl(slot)
.unwrap_or(AccessSettings::Data(DataSlotAccess::new_with_raw_value(0xFFFF_FFFF)))
.raw_u32()
!= 0
{
// clear the ACL so we can operate on the data
slot_mgr
.set_acl(
&mut rram,
slot,
&AccessSettings::Data(DataSlotAccess::new_with_raw_value(0)),
)
.expect("couldn't reset ACL");
match slot_mgr.set_acl(
&mut rram,
slot,
&AccessSettings::Data(DataSlotAccess::new_with_raw_value(0)),
) {
Ok(_) => (),
Err(e) => {
crate::println!("Couldn't erase ACL: {:?}", e);
}
}
}
let bytes = unsafe { slot_mgr.read_data_slot(data_index) };
if bytes.iter().all(|&b| b == 0) {

View file

@ -109,22 +109,20 @@ impl KeyStore {
// read key material
ikm.extend_from_slice(self.slot_mgr.read(&ROOT_SEED).unwrap());
#[cfg(feature = "hazardous-debug")]
{
// analyze part of the key and print some informative statements during hazardous-debug
// we want to make sure that keys are actually being initialized, erased, or denied
// look at only 64 bits out of the 256 bit key - it's enough that it's highly unlikely that
// these 64 bits would match any of the zero/erased values, but not so much that if a
// dev image is accidentally signed & released that it'd be a serious threat to security
// as you'd still have 192 bits of secret material
let root_seed = self.slot_mgr.read(&ROOT_SEED).unwrap();
if root_seed[..8] == [0u8; 8] {
log::info!("{}KEYSTORE.ZERO,{}", BOOKEND_START, BOOKEND_END);
} else if root_seed[..8] == [bao1x_hal::sigcheck::ERASE_VALUE; 8] {
log::info!("{}KEYSTORE.ERASED,{}", BOOKEND_START, BOOKEND_END);
} else {
log::info!("{}KEYSTORE.KEYPASS,{}", BOOKEND_START, BOOKEND_END);
}
// Analyze part of the key and print some informative statements.
// We want to make sure that keys are actually being initialized, erased, or denied
// look at only 64 bits out of the 256 bit key - it's enough that it's highly unlikely that
// these 64 bits would match any of the zero/erased values, but not so much that if these
// values are leaked, that it'd be a serious threat to security as you'd still have 192 bits of
// secret material, not to mention all the additional nuisance keys and chaff keys yet to come.
let root_seed = self.slot_mgr.read(&ROOT_SEED).unwrap();
if root_seed[..8] == [0u8; 8] {
log::info!("{}KEYSTORE.ZERO,{}", BOOKEND_START, BOOKEND_END);
} else if root_seed[..8] == [bao1x_hal::sigcheck::ERASE_VALUE; 8] {
log::info!("{}KEYSTORE.ERASED,{}", BOOKEND_START, BOOKEND_END);
} else {
log::info!("{}KEYSTORE.KEYPASS,{}", BOOKEND_START, BOOKEND_END);
}
// build nuisance key offsets - this is direct readout hardening