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

doc: tfm: Add documentation regarding configurable build #19562

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

SeppoTakalo
Copy link
Contributor

Add documentation regarding CONFIG_TFM_PROFILE_TYPE_NOT_SET and various TF-M partitions that user need to configure.

NOTE: This is very early phase. This work is still in progress, but I'm just starting the review process very early.

@github-actions github-actions bot added doc-required PR must not be merged without tech writer approval. changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. labels Dec 16, 2024
@NordicBuilder
Copy link
Contributor

NordicBuilder commented Dec 16, 2024

CI Information

To view the history of this post, clich the 'edited' button above
Build number: 16

Inputs:

Sources:

sdk-nrf: PR head: e06cb9f1bc53dae4852f3b9dad58d9f4c340eab6

more details

sdk-nrf:

PR head: e06cb9f1bc53dae4852f3b9dad58d9f4c340eab6
merge base: 47c18832e293d6f3e11b91c753ce436e62a46265
target head (main): 47c18832e293d6f3e11b91c753ce436e62a46265
Diff

Github labels

Enabled Name Description
ci-disabled Disable the ci execution
ci-all-test Run all of ci, no test spec filtering will be done
ci-force-downstream Force execution of downstream even if twister fails
ci-run-twister Force run twister
ci-run-zephyr-twister Force run zephyr twister
List of changed files detected by CI (6)
doc
│  ├── nrf
│  │  ├── images
│  │  │  ├── nrf-secure-rom-granularity.svg
│  │  │  │ secure-flash-regions.svg
│  │  ├── links.txt
│  │  ├── releases_and_maturity
│  │  │  ├── migration
│  │  │  │  ├── migration_guide_1.x_to_2.x.rst
│  │  │  │  │ migration_guide_spm_to_tf-m.rst
│  │  ├── security
│  │  │  │ tfm.rst

Outputs:

Toolchain

Version:
Build docker image:

Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped; ⚠️ Quarantine

  • ◻️ Toolchain
  • ◻️ Build twister
  • ◻️ Integration tests
Disabled integration tests
    • desktop52_verification
    • doc-internal
    • test_ble_nrf_config
    • test-fw-nrfconnect-apps
    • test-fw-nrfconnect-ble_mesh
    • test-fw-nrfconnect-ble_samples
    • test-fw-nrfconnect-boot
    • test-fw-nrfconnect-chip
    • test-fw-nrfconnect-fem
    • test-fw-nrfconnect-nfc
    • test-fw-nrfconnect-nrf-iot_libmodem-nrf
    • test-fw-nrfconnect-nrf-iot_lwm2m
    • test-fw-nrfconnect-nrf-iot_mosh
    • test-fw-nrfconnect-nrf-iot_positioning
    • test-fw-nrfconnect-nrf-iot_samples
    • test-fw-nrfconnect-nrf-iot_serial_lte_modem
    • test-fw-nrfconnect-nrf-iot_thingy91
    • test-fw-nrfconnect-nrf-iot_zephyr_lwm2m
    • test-fw-nrfconnect-nrf_crypto
    • test-fw-nrfconnect-ps
    • test-fw-nrfconnect-rpc
    • test-fw-nrfconnect-rs
    • test-fw-nrfconnect-tfm
    • test-fw-nrfconnect-thread
    • test-fw-nrfconnect-zigbee
    • test-low-level
    • test-sdk-audio
    • test-sdk-dfu
    • test-sdk-find-my
    • test-sdk-mcuboot
    • test-sdk-pmic-samples
    • test-sdk-sidewalk
    • test-sdk-wifi
    • test-secdom-samples-public

Note: This message is automatically posted and updated by the CI

@NordicBuilder
Copy link
Contributor

You can find the documentation preview for this PR at this link. It will be updated about 10 minutes after the documentation build succeeds.

Note: This comment is automatically posted by the Documentation Publish GitHub Action.

@SeppoTakalo SeppoTakalo force-pushed the tfm_partition_docs branch 3 times, most recently from 426dd6c to 536d653 Compare December 23, 2024 14:04
Copy link
Contributor

@MarkusLassila MarkusLassila left a comment

Choose a reason for hiding this comment

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

Some comments. Moving to right direction.

doc/nrf/security/tfm.rst Outdated Show resolved Hide resolved
doc/nrf/security/tfm.rst Outdated Show resolved Hide resolved
doc/nrf/security/tfm.rst Show resolved Hide resolved
doc/nrf/security/tfm.rst Outdated Show resolved Hide resolved
:align: center

Partition alignment granularity on different nRF devices.

When the :ref:`partition_manager` is enabled, it will take into consideration the alignment requirements.
Copy link
Contributor

Choose a reason for hiding this comment

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

Partition manager likely warrants its own chapter in here. I would like to at least give the flow of working with partition manager in here:

  1. Minimize your partitions
  2. Copy the partitions.yaml from build directory as static partitions.yaml.
  3. Modify static partitions.yaml (if necessary) (PS and ITS storage can be set more efficiently, reserve enough space for future updates).

:align: center

Example of aligning partitions with flash regions.

If you are experiencing any partition alignment issues when using the Partition Manager, check the :ref:`known_issues` page on the main branch.

The partitions which need to be aligned with the TrustZone flash region size are partitions ``tfm_nonsecure`` and ``nonsecure_storage``.
Copy link
Contributor

Choose a reason for hiding this comment

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

tfm_storage also needs to be aligned with this, if it is set after non-secure partition.

doc/nrf/security/tfm.rst Outdated Show resolved Hide resolved
@SeppoTakalo SeppoTakalo requested a review from melwee01 December 30, 2024 12:40
@MarkusLassila MarkusLassila force-pushed the tfm_partition_docs branch 2 times, most recently from 82f0ec3 to de44e9e Compare January 20, 2025 11:45
@SeppoTakalo SeppoTakalo marked this pull request as ready for review January 21, 2025 13:03
@SeppoTakalo SeppoTakalo requested review from a team as code owners January 21, 2025 13:03
doc/nrf/security/tfm.rst Outdated Show resolved Hide resolved
doc/nrf/security/tfm.rst Outdated Show resolved Hide resolved
doc/nrf/security/tfm.rst Outdated Show resolved Hide resolved
doc/nrf/security/tfm.rst Outdated Show resolved Hide resolved
doc/nrf/security/tfm.rst Outdated Show resolved Hide resolved
doc/nrf/security/tfm.rst Outdated Show resolved Hide resolved
doc/nrf/security/tfm.rst Outdated Show resolved Hide resolved
doc/nrf/security/tfm.rst Outdated Show resolved Hide resolved
@peknis
Copy link
Contributor

peknis commented Jan 21, 2025

More comments/suggestions coming later this week.

@SeppoTakalo SeppoTakalo changed the title WIP: doc: tfm: Add documentation regarding configurable build doc: tfm: Add documentation regarding configurable build Jan 22, 2025
doc/nrf/security/tfm.rst Outdated Show resolved Hide resolved
doc/nrf/security/tfm.rst Outdated Show resolved Hide resolved
doc/nrf/security/tfm.rst Outdated Show resolved Hide resolved
doc/nrf/security/tfm.rst Outdated Show resolved Hide resolved
doc/nrf/security/tfm.rst Outdated Show resolved Hide resolved
doc/nrf/security/tfm.rst Outdated Show resolved Hide resolved
doc/nrf/security/tfm.rst Outdated Show resolved Hide resolved
doc/nrf/security/tfm.rst Outdated Show resolved Hide resolved
doc/nrf/security/tfm.rst Outdated Show resolved Hide resolved
doc/nrf/security/tfm.rst Outdated Show resolved Hide resolved
Add documentation regarding CONFIG_TFM_PROFILE_TYPE_NOT_SET
and various TF-M partitions that user need to configure.

Signed-off-by: Seppo Takalo <[email protected]>
Current user guide does not need this information anymore.
It should be moved to a separate migration guide.

Signed-off-by: Seppo Takalo <[email protected]>
Move building, configuring and limitations to
appear before background information on TF-M user
guide.

Signed-off-by: Seppo Takalo <[email protected]>
Unfortunately TF-M rst file in Zephyr does not have
cross-reference labels.

Signed-off-by: Seppo Takalo <[email protected]>
SeppoTakalo and others added 4 commits January 22, 2025 15:49
Add diagram to show the granularity differences
between each HW.

Signed-off-by: Seppo Takalo <[email protected]>
Add usage examples from tfm_ram_report and tfm_rom_report.

Signed-off-by: Markus Lassila <[email protected]>
Add information from TF-M partitions:
- CONFIG_TFM_PARTITION_PLATFORM
- CONFIG_TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
- CONFIG_TFM_PARTITION_CRYPTO
- CONFIG_TFM_PARTITION_PROTECTED_STORAGE
- CONFIG_TFM_PARTITION_INITIAL_ATTESTATION

Signed-off-by: Markus Lassila <[email protected]>
Fixes from documentation review

Signed-off-by: Seppo Takalo <[email protected]>

Co-authored-by: Pekka Niskanen <[email protected]>
Copy link
Contributor

Choose a reason for hiding this comment

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

These images need to be converted to the unified style in Visio. https://nordicsemi.atlassian.net/wiki/spaces/TECHDOC/pages/120293046/Figure+guide If you prefer, I can do it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, please.
I don't have a Visio, as it does not exist on Linux.

#############################################################

The Nordic Secure Partition Manager (SPM) was replaced with Trusted Firmware-M (TF-M) as the default trusted execution solution in the |NCS| v2.1.0.
This change was made to enhance the security features of the SDK by integrating the more widely adopted TF-M that aligns with the Arm Platform Security Architecture (PSA).
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
This change was made to enhance the security features of the SDK by integrating the more widely adopted TF-M that aligns with the Arm Platform Security Architecture (PSA).
This change enhances the security features of the SDK by integrating the more widely adopted TF-M that aligns with the Arm Platform Security Architecture (PSA).

The Nordic Secure Partition Manager (SPM) was replaced with Trusted Firmware-M (TF-M) as the default trusted execution solution in the |NCS| v2.1.0.
This change was made to enhance the security features of the SDK by integrating the more widely adopted TF-M that aligns with the Arm Platform Security Architecture (PSA).

The migration from SPM to TF-M requires changes in the application code and the partition configuration.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The migration from SPM to TF-M requires changes in the application code and the partition configuration.
Migration from SPM to TF-M requires changes in the application code and the partition configuration.

Internal Trusted Storage partition
----------------------------------

To enable Internal Trusted Storage (ITS) partition, set the :kconfig:option:`CONFIG_TFM_PARTITION_INTERNAL_TRUSTED_STORAGE` Kconfig option.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
To enable Internal Trusted Storage (ITS) partition, set the :kconfig:option:`CONFIG_TFM_PARTITION_INTERNAL_TRUSTED_STORAGE` Kconfig option.
To enable the Internal Trusted Storage (ITS) partition, set the :kconfig:option:`CONFIG_TFM_PARTITION_INTERNAL_TRUSTED_STORAGE` Kconfig option.


To strengthen data integrity, the metadata of the ITS file (creation flags/size) is used as authenticated data in the encryption process.

The nonce for the AEAD operation is generated by concatenating a random 8-byte seed and an increasing the 4-byte counter.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The nonce for the AEAD operation is generated by concatenating a random 8-byte seed and an increasing the 4-byte counter.
The nonce for the AEAD operation is generated by concatenating a random 8-byte seed and an increasing the 4-byte counter.

Either 'an' or 'the' need to go, but I'm not sure which. It depends. Is the 4-byte counter concatenated?

Protect Storage partition
-------------------------

To enable Protect Storage (PS) partition, set the :kconfig:option:`CONFIG_TFM_PARTITION_PROTECTED_STORAGE`.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think 'the' partition for all of these reads better.

The :ref:`provisioning_image` sample shows how to switch the device from the **Device Assembly and Test** state to the **PRoT Provisioning** state, and how to provision the device with hardware unique keys (HUKs) and an identity key.

To switch the device from the **PRoT Provisioning** state to the **Secured** state, set the :kconfig:option:`CONFIG_TFM_NRF_PROVISIONING` Kconfig option for your application.
In the first boot, TF-M ensures that the keys are stored in the Key Management Unit (KMU) and switches the device to the **Secured** state.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
In the first boot, TF-M ensures that the keys are stored in the Key Management Unit (KMU) and switches the device to the **Secured** state.
On the first boot, TF-M ensures that the keys are stored in the Key Management Unit (KMU) and switches the device to the **Secured** state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. doc-required PR must not be merged without tech writer approval.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants