Skip to content

cypress: make the security counter stub fail closed - #2795

Open
flaviens wants to merge 1 commit into
mcu-tools:mainfrom
flaviens:harden/cypress-security-counter
Open

cypress: make the security counter stub fail closed#2795
flaviens wants to merge 1 commit into
mcu-tools:mainfrom
flaviens:harden/cypress-security-counter

Conversation

@flaviens

Copy link
Copy Markdown

Hi!

The example backend returned a fixed counter value and discarded updates while reporting success. It linked and ran with a rollback floor that never advanced with no error at build or boot time because a build that enables MCUBOOT_HW_ROLLBACK_PROT picks this file up automatically.

This PR proposes to return errors instead and document that a persistent platform backend is required before enabling MCUBOOT_HW_ROLLBACK_PROT.

Thanks!
Flavien

The example backend returned a fixed counter value and discarded updates
while reporting success. A build that enables MCUBOOT_HW_ROLLBACK_PROT picks
this file up automatically, so it linked and ran with a rollback floor that
never advanced, with no error at build or boot time.

Return errors instead, and document that a persistent platform backend is
required before enabling MCUBOOT_HW_ROLLBACK_PROT.

Signed-off-by: Flavien Solt <flavien@nus.edu.sg>
Copilot AI review requested due to automatic review settings July 18, 2026 09:17
@flaviens
flaviens requested review from d3zd3z and romanjoe as code owners July 18, 2026 09:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Cypress example security counter backend to “fail closed” when MCUBOOT_HW_ROLLBACK_PROT is enabled, preventing builds from silently operating with a non-advancing rollback floor due to a non-persistent stub implementation.

Changes:

  • Make the Cypress cy_security_cnt.c stub return failures instead of returning a fixed counter value and reporting success.
  • Document in the Cypress MCUboot app README that a persistent, monotonic, power-fail-safe backend is required before enabling MCUBOOT_HW_ROLLBACK_PROT.
  • Add a release note entry describing the behavioral change.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
docs/release-notes.d/cypress-security-counter-fail-closed.md Adds a release note explaining the Cypress security counter backend now fails closed.
boot/cypress/MCUBootApp/README.md Documents that the bundled security counter backend is non-persistent and must be replaced before enabling rollback protection.
boot/cypress/MCUBootApp/cy_security_cnt.c Changes the example backend to return errors (fail closed) rather than returning a fixed value and succeeding.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants