Skip to content

bluetooth: mesh: removing gotten stuck persisted psa key if key id is reused #92780

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

Merged
merged 2 commits into from
Jul 25, 2025

Conversation

alxelax
Copy link
Contributor

@alxelax alxelax commented Jul 7, 2025

PR adds destruction of the persisted in PSA ITS key if mesh does not own it (zero bit in the bitmap of persisted keys).
This is not standard mesh behavior, but might happen if something happens between removing key data in mesh and in the crypto library (for example, power off in between).

Previously, mesh wasn't able to import key with gotten stuck key ID. The current fix reproduces more robust behavior.

Additionally, PR extends the existing mesh persistent provisioning bsim test to emulate gotten stuck key and checking this key was destroyed, and correct one was imported instead.

@alxelax alxelax force-pushed the robust_key_import branch from 370207c to 1863abd Compare July 7, 2025 14:51
@alxelax alxelax requested a review from omkar3141 July 7, 2025 14:56
omkar3141
omkar3141 previously approved these changes Jul 8, 2025
@alxelax alxelax requested a review from PavelVPV July 24, 2025 10:37
Commit adds destruction of the persisted in PSA ITS key if
mesh does not own it (zero bit in the bitmap of persisted keys).

This is not standard mesh behavior, but might happen
if something happens between removing key data in mesh and
in the crypto library (for example power off in bettwen).

Previously, mesh wasn't able to import key with gotten stuck
key id. The current fix reproduces more robust behavior.

Signed-off-by: Aleksandr Khromykh <[email protected]>
PavelVPV
PavelVPV previously approved these changes Jul 24, 2025
Commit extends existing persistent provisioning bsim mesh test that
checks that mesh removes gotten stuck persisted key if key is reused.
Correct key is imported normally after that.

Signed-off-by: Aleksandr Khromykh <[email protected]>
Copy link

# Test must be added in pair and in sequence.
# First test: saves data; second test: verifies it.
#
# Test procedure:
Copy link
Contributor

Choose a reason for hiding this comment

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

It is also bit new that we are now documenting the test procedure within the ".sh" file. This is not bad, but perhaps we should do this all tests eventually whenever we touch them.

@cfriedt cfriedt merged commit 34c3ccf into zephyrproject-rtos:main Jul 25, 2025
28 checks passed
@alxelax alxelax deleted the robust_key_import branch July 25, 2025 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants