add coreuser table setup to boot0

I think it belongs here, because this "should" be a "baked in"
setting. Maybe I'll regret that, because it really enforces
a hardware one-way door on changing/updating the coreuser maps,
but also, I think it makes it a bit stronger if there is no
easy way to bypass/override that setting.
This commit is contained in:
bunnie 2025-10-20 02:18:28 +08:00
parent 0943b67972
commit 356ab47c3c
No known key found for this signature in database

View file

@ -105,6 +105,13 @@ pub fn early_init() {
// malleable (no hardware lock to prevent update), which is a potential vulnerability.
init_hash();
// this is a security-critical initialization. Failure to do this correctly breaks
// the hardware access control scheme for key/data slots.
let mut cu = bao1x_hal::coreuser::Coreuser::new();
// safety: this is safe because it's followed by a `protect()` call.
unsafe { cu.set() };
cu.protect();
// TxRx setup
#[cfg(feature = "unsafe-dev")]
let mut udma_uart = {