Skip to content

Harden dev mode value - #56

Open
diondokter wants to merge 2 commits into
OpenDevicePartnership:mcxa-secure-bootfrom
diondokter:devmode-sensitivity
Open

diondokter wants to merge 2 commits into
OpenDevicePartnership:mcxa-secure-bootfrom
diondokter:devmode-sensitivity

Conversation

@diondokter

Copy link
Copy Markdown
Member

Supercedes #54

Instead of collapsing dev mode into a bool, we keep it a very specific u32.

The secure_boot_cfg is also read twice.
This hopefully hardens against fault injections that saturate registers.
Everything after that uses a u32 that when saturated will not enable dev mode, so that should be good

Comment thread libs/ec-slimloader-mcxa/src/board.rs Resolved
Comment thread libs/ec-slimloader-mcxa/src/board.rs Resolved
Comment thread libs/ec-slimloader-mcxa/src/board.rs Resolved
Comment thread libs/ec-slimloader-mcxa/src/board.rs Resolved
Comment thread libs/ec-slimloader-mcxa/src/board.rs Resolved
@alamfarjadf

Copy link
Copy Markdown

#55 (comment)

And last open question / concern, but IMO not sure what else can be done (other than doing a check asm again, but where do we draw the line)

@jerrysxie jerrysxie added this to EC Oct 22, 2026
@jerrysxie jerrysxie moved this to In Progress in EC Oct 22, 2026
@jerrysxie
jerrysxie requested a review from JamesHuard October 22, 2026 15:51
@alamfarjadf

Copy link
Copy Markdown

@felipebalbi @diondokter would 0b11111100_11111100_00000011_11111100 work for the pattern? Basically !OnlyPki when computing and if it matches, we know OnlyPki not set (DEV mode can be enabled).

@JamesHuard JamesHuard left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comments I would leave are not related to this PR, so I'll hold them for follow up issues in code quality if/when we get there

pub const DEV_VAL: Self = Self {
inverse_lifecycle: 0b11111100, // InvLifeCycleState::Develop
lifecycle: 0b00000011, // LifeCycleState::Develop
inverse_secure_boot: 0b00000011, // !SecSecBootEn::AllAllowed

@alamfarjadf alamfarjadf Nov 2, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lower half of the pattern (SecBootEn) is almost all 0.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I am not sure you meant to write 'Sec' twice, it's just SecBootEn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

4 participants