Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sim: Add hw rollback protection tests #1710

Merged
merged 4 commits into from
Jun 27, 2023

Conversation

Roolli
Copy link

@Roolli Roolli commented May 16, 2023

This PR adds testing capabilities to the hw-rollback-protection feature of MCUboot. The non-volatile storage for the security counters is implemented on Rust's side due to the parallel nature of the tests. There is also a fix for a build error when comparing the security counter values during the simulator build.

@de-nordic de-nordic added the area: sim Affects the simulator label May 22, 2023
Copy link
Collaborator

@davidvincze davidvincze left a comment

Choose a reason for hiding this comment

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

First round of review.

sim/src/tlv.rs Outdated Show resolved Hide resolved
sim/src/tlv.rs Outdated Show resolved Hide resolved
sim/src/tlv.rs Outdated Show resolved Hide resolved
sim/src/tlv.rs Outdated Show resolved Hide resolved
sim/src/tlv.rs Outdated Show resolved Hide resolved
sim/src/tlv.rs Outdated Show resolved Hide resolved
sim/src/image.rs Outdated Show resolved Hide resolved
sim/src/image.rs Outdated Show resolved Hide resolved
sim/src/image.rs Outdated Show resolved Hide resolved
sim/src/image.rs Outdated Show resolved Hide resolved
sim/mcuboot-sys/csupport/security_cnt.c Outdated Show resolved Hide resolved
sim/mcuboot-sys/csupport/security_cnt.c Show resolved Hide resolved
sim/mcuboot-sys/csupport/security_cnt.c Show resolved Hide resolved
sim/mcuboot-sys/src/api.rs Outdated Show resolved Hide resolved
sim/mcuboot-sys/src/api.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@davidvincze davidvincze left a comment

Choose a reason for hiding this comment

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

Please rebase the patch stack.

Currently there's a compile error when building MCUboot
with HW_ROLLBACK_PROT due to a comparison
when decoding the security_cnt fih_int value. In the security_cnt.h
it is stated that this value must be between 0 and UINT32_MAX
so this cast would not cause any undefined behaviour.

Signed-off-by: Roland Mikhel <roland.mikhel@arm.com>
Change-Id: Iee158a31955ff43b73e67a0c08e7a086077b9eb5
Roland Mikhel added 3 commits June 21, 2023 14:09
This commit adds simulator support to test the
hw-rollback-protection feature which is using
nv-counters. In the simulator they are stored in Rust
to prevent any race conditions from happening due to
the parallel execution of the tests.

Signed-off-by: Roland Mikhel <roland.mikhel@arm.com>
Change-Id: I445fc50615ed1f0c06e5933b16811c24d9d302fc
Signed-off-by: Roland Mikhel <roland.mikhel@arm.com>
Change-Id: I3dee0baf27b8cae78b87135ea7447556b06fdefd
Signed-off-by: Roland Mikhel <roland.mikhel@arm.com>
Change-Id: If636d9179c6f06d4bf7452b8eb4f07d3829cf2d7
@davidvincze davidvincze merged commit 9a82eca into mcu-tools:main Jun 27, 2023
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: sim Affects the simulator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants