remove the developer function from the function code list

The developer function was decided to be overly-broad: the
issue is you could slot that in to *any* boot position and
it'd be accepted, and we already have a mechanism to deal
with developer mode (developer-signed images). Thus eliminate
the extra case and simplify the code base to reduce
potential bugs.
This commit is contained in:
bunnie 2025-12-19 01:09:44 +08:00
parent 391927139a
commit 36b103ef6c
No known key found for this signature in database
3 changed files with 5 additions and 19 deletions

View file

@ -68,11 +68,7 @@ pub const BOOT0_TO_BOOT1: SecurityConfiguration = SecurityConfiguration {
image_ptr: crate::BOOT1_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,
FunctionCode::Developer as u32,
],
function_codes: &[FunctionCode::Boot1 as u32, FunctionCode::UpdatedBoot1 as u32],
};
/// This is different from a jump directly to loader/baremetal because the
@ -81,11 +77,7 @@ 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,
FunctionCode::Developer as u32,
],
function_codes: &[FunctionCode::Boot1 as u32, FunctionCode::UpdatedBoot1 as u32],
};
pub const BOOT1_TO_LOADER_OR_BAREMETAL: SecurityConfiguration = SecurityConfiguration {
@ -97,7 +89,6 @@ pub const BOOT1_TO_LOADER_OR_BAREMETAL: SecurityConfiguration = SecurityConfigur
FunctionCode::UpdatedBaremetal as u32,
FunctionCode::Loader as u32,
FunctionCode::UpdatedLoader as u32,
FunctionCode::Developer as u32,
],
};
@ -105,11 +96,7 @@ pub const LOADER_TO_KERNEL: SecurityConfiguration = SecurityConfiguration {
image_ptr: crate::KERNEL_START as *const u32,
pubkey_ptr: crate::LOADER_START as *const u32,
revocation_owc: crate::LOADER_REVOCATION_OFFSET,
function_codes: &[
FunctionCode::Kernel as u32,
FunctionCode::UpdatedKernel as u32,
FunctionCode::Developer as u32,
],
function_codes: &[FunctionCode::Kernel as u32, FunctionCode::UpdatedKernel as u32],
};
pub const LOADER_TO_DETACHED_APP: SecurityConfiguration = SecurityConfiguration {

View file

@ -39,8 +39,6 @@ pub enum FunctionCode {
/// Application region
App = 0x10_0000,
UpdatedApp = 0x10_0001,
/// Developer use - can go in any region, but only usable with secrets wiped.
Developer = 0x1000_0000,
}
pub const BAOCHIP_SIG_VERSION: u32 = 0x1_00;

View file

@ -211,7 +211,8 @@ pub fn sign_image(
Some("kernel") => FunctionCode::Kernel,
Some("app") => FunctionCode::App,
Some("swap") => FunctionCode::Swap,
_ => FunctionCode::Developer,
Some("baremetal") => FunctionCode::Baremetal,
_ => panic!("Invalid function code"),
};
let mut header = SignatureInFlash::default();
header.sealed_data.version = version as u32;