-
Notifications
You must be signed in to change notification settings - Fork 1.4k
secure_storage: add backward compatibility and plug in HUK library #22491
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
secure_storage: add backward compatibility and plug in HUK library #22491
Conversation
The following west manifest projects have changed revision in this Pull Request:
✅ All manifest checks OK Note: This message is automatically posted and updated by the Manifest GitHub Action. |
CI InformationTo view the history of this post, clich the 'edited' button above Inputs:Sources:sdk-nrf: PR head: 886dab1a282a2253a9b4df379b27f185f59d830d more detailssdk-nrf:
zephyr:
Github labels
List of changed files detected by CI (41)
Outputs:ToolchainVersion: 4aa3467a6d Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped;
|
You can find the documentation preview for this PR here. Preview links for modified nRF Connect SDK documents: https://ncsdoc.z6.web.core.windows.net/PR-22491/nrf/samples/crypto/persistent_key_usage/README.html |
671cf05
to
6f197c5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test automation part LGTM
6f197c5
to
da6d2ff
Compare
subsys/secure_storage/CMakeLists.txt
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should only be called (zephyr_library()
) if it is used, so CONFIG_SECURE_STORAGE_TRUSTED_STORAGE_COMPATIBILITY
is not set then this will generate an empty library which will throw a warning, library should be in the subsys/secure_storage/compatibility/CMakeLists.txt
file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woops. Addressed differently than you suggested as the conditions for there being source files aren't that straightforward. Unfortunately I couldn't seem to be able to fill the list in the child CMakeLists.txt
and use it in the parent one (the list would be empty). Let me know if you have a better suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
help always goes last
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
experimental needs [EXPERIMENTAL]
at the end of the choice text
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep selects together
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default x if SECURE_STORAGE_TRUSTED_STORAGE_COMPATIBILITY ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What for? SECURE_STORAGE_ITS_TRANSFORM_IMPLEMENTATION_TSBC
already has depends on SECURE_STORAGE_TRUSTED_STORAGE_COMPATIBILITY
, which is required so that SECURE_STORAGE_ITS_TRANSFORM_IMPLEMENTATION_TSBC
cannot be chosen if SECURE_STORAGE_TRUSTED_STORAGE_COMPATIBILITY
is not y
(enclosing if
is not enough, I did some experiments).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it makes it far easier to read and spot errors and is just good practice. Imagine if these 2 symbols were in different files for example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prompt is always at top
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point
da6d2ff
to
8b18c51
Compare
Rebased and addressed @nordicjm's comments. |
8b18c51
to
6e32278
Compare
Fixed an issue with one addition in |
@nordicjm @ncs-aegir please review |
subsys/secure_storage/CMakeLists.txt
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rather than this, config SECURE_STORAGE_ITS_TRANSFORM_IMPLEMENTATION_AEAD
should just have depends on !SECURE_STORAGE_TRUSTED_STORAGE_COMPATIBILITY
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would love to have a Kconfig-based solution but I went for this because I couldn't find one that worked. What you suggest would require a noup which I would rather not have.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it makes it far easier to read and spot errors and is just good practice. Imagine if these 2 symbols were in different files for example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ITS backend is either provided by TF-M or either the :ref:`secure_storage` subsystem or the :ref:`trusted_storage_readme` library when building applications without TF-M. | |
A persistent key becomes unusable when the ``psa_destroy_key`` function is called. | |
The ITS backend is provided in one of the following ways, depending on your configuration: | |
* Through TF-M using Internal Trusted Storage and Protected Storage services | |
* When building without TF-M: using either Zephyr's :ref:`secure_storage` subsystem or the :ref:`trusted_storage_readme` library | |
A persistent key becomes unusable when the ``psa_destroy_key`` function is called. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# When TF-M is not in use, the secure storage subsystem provides the PSA Secure Storage API. | |
# When TF-M is not in use, the Secure storage subsystem provides the PSA Secure Storage API. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# When TF-M is not in use, the secure storage subsystem provides the PSA Secure Storage API. | |
# When TF-M is not in use, the Secure storage subsystem provides the PSA Secure Storage API. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# When TF-M is not in use, the secure storage subsystem provides the PSA Secure Storage API. | |
# When TF-M is not in use, the Secure storage subsystem provides the PSA Secure Storage API. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# When TF-M is not in use, the secure storage subsystem provides the PSA Secure Storage API. | |
# When TF-M is not in use, the Secure storage subsystem provides the PSA Secure Storage API. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for "example" or "sample" in name
. Most samples don't have this.
name: Persistent key usage example | |
name: Persistent key usage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right. Forgot about that. Got distracted by how it was.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- ".*Example finished successfully!.*" | |
- ".*Sample finished successfully!*" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is something that would need to be updated in all the crypto samples. Not changing this here.
subsys/secure_storage/Kconfig
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool "HUK library-derived keys" | |
bool "Keys derived from HUK library" |
Or using HUK library
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enable this to make the secure storage subsystem compatible with | |
an existing installation that was previously using the trusted storage library. | |
It will allow the secure storage subsystem to operate and store entries | |
like the trusted storage library would. | |
Enable to make the Secure storage subsystem compatible with | |
an existing installation that was previously using the Trusted storage library. | |
This allows the Secure storage subsystem to operate and store entries | |
like the Trusted storage library would. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool "ITS transform module implementation compatible with trusted storage" | |
bool "ITS transform module implementation compatible with trusted storage" |
Do you mean ITS with "trusted storage" or the trusted storage library?
Maybe:
bool "ITS transform module implementation compatible with trusted storage" | |
bool "Implementation of the ITS transform module, compatible with the Trusted storage library" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented this change except I had to make it shorter for it to fit within 100 (or so) characters.
164675e
to
c35551a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving, but please address comments.
subsys/secure_storage/Kconfig
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, missed this in the first round :/
NCS
is a forbidden term and should not be used.
# Secure storage subsystem integration into NCS | |
# Secure storage subsystem integration into the nRF Connect SDK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😮
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this about Oberon?
* which holds all the active keys in the PSA Crypto core. | |
* which holds all the active keys in the Oberon PSA Core. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No.
c35551a
to
03e902a
Compare
The ChaCha20-Poly1305 alg is needed, but the ChaCha20 key type also. Signed-off-by: Tomi Fontanilles <[email protected]>
They cause issues when compiling on native_sim. Signed-off-by: Tomi Fontanilles <[email protected]>
Previously was only on 54L15. Signed-off-by: Tomi Fontanilles <[email protected]>
For downstream integration and expansion. Signed-off-by: Tomi Fontanilles <[email protected]>
Allow the secure storage subsystem to be compatible with the trusted storage library. This is controlled by the top-level Kconfig option CONFIG_SECURE_STORAGE_TRUSTED_STORAGE_COMPATIBILITY. Signed-off-by: Tomi Fontanilles <[email protected]>
As trusted storage's TRUSTED_STORAGE_BACKEND_AEAD_KEY_DERIVE_FROM_HUK, provide the possibility to derive keys using the HUK library through CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_PROVIDER_HUK_LIBRARY. Signed-off-by: Tomi Fontanilles <[email protected]>
Extend the test scenarios found under tests/subsys/secure_storage/psa/its with configurations tailored to NCS. CONFIG_NRF_SECURITY and other relevant Kconfig options are enabled. The primary intent is to test the backward-compatible implementation, so all test scenarios except the ZMS one use it. Signed-off-by: Tomi Fontanilles <[email protected]>
Make secure storage the default option on non-TF-M board targets. Have test scenarios for both secure storage and trusted storage to test both. Reduce a bit the number of board targets in integration_platforms to reduce CI load as some don't bring extra value when others are already in there. Signed-off-by: Tomi Fontanilles <[email protected]>
03e902a
to
886dab1
Compare
See commits.
test_crypto: PR-808