From 534e99216afeac78c87b4d1ed0ecba2897d688ca Mon Sep 17 00:00:00 2001 From: bunnie Date: Tue, 16 Dec 2025 01:05:57 +0800 Subject: [PATCH] cleanup the erase-check key code to reflect new APIs for managing buram --- loader/src/main.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/loader/src/main.rs b/loader/src/main.rs index f83803bd3..1363a7980 100644 --- a/loader/src/main.rs +++ b/loader/src/main.rs @@ -535,7 +535,10 @@ fn boot_sequence( // cleanup the leaked key to the backup registers let mut buram = bao1x_hal::buram::BackupManager::new(); bao1x_api::bollard!(bao1x_hal::sigcheck::die_no_std, 4); - buram.store_slice(&[0u8; 32], bao1x_hal::buram::ERASURE_PROOF_RANGE_BYTES.start); + // safety: this specific region is not part of the hash-checked register bank + unsafe { + buram.store_slice_no_hash(&[0u8; 32], bao1x_hal::buram::ERASURE_PROOF_RANGE_BYTES.start); + } bao1x_api::bollard!(bao1x_hal::sigcheck::die_no_std, 4); } } @@ -589,7 +592,10 @@ fn boot_sequence( // clean it twice, just in case the first cleanup was glitched past let mut buram = bao1x_hal::buram::BackupManager::new(); bao1x_api::bollard!(bao1x_hal::sigcheck::die_no_std, 4); - buram.store_slice(&[0u8; 32], bao1x_hal::buram::ERASURE_PROOF_RANGE_BYTES.start); + // safety: this specific region is not part of the hash-checked register bank + unsafe { + buram.store_slice_no_hash(&[0u8; 32], bao1x_hal::buram::ERASURE_PROOF_RANGE_BYTES.start); + } bao1x_api::bollard!(bao1x_hal::sigcheck::die_no_std, 4); }