Skip to content

Commit 4c5903d

Browse files
greg-ferrlubos
authored andcommitted
doc: security: add crypto overview page
Added crypto overview page to the documentation. Added a new crypto section under Security. Moved the page listing crypto drivers to the new section. NCSDK-33436, NCSDK-33433, NCSDK-30041. Signed-off-by: Grzegorz Ferenc <[email protected]>
1 parent 59e2401 commit 4c5903d

19 files changed

+932
-232
lines changed

doc/_utils/redirects.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,8 @@
292292
("app_dev/optimizing/power", "test_and_optimize/optimizing/power"),
293293
("security_chapter", "security"), # Security (landing)
294294
("security/security", "security"), # Security (subpage -- removed in v2.8.0)
295+
("libraries/nrf_security/doc/drivers", "security/crypto/drivers"), # Cryptographic drivers ("nRF Security drivers" before v3.1.0)
296+
("libraries/security/nrf_security/doc/drivers", "security/crypto/drivers"),
295297
("ug_tfm", "security/tfm/index"), # Running applications with Trusted Firmware-M (split into multiple files in v3.0.0)
296298
("app_dev/tfm/index", "security/tfm/index"),
297299
("security/tfm", "security/tfm/index"),
@@ -547,7 +549,6 @@
547549
("libraries/others/fw_info", "libraries/security/bootloader/fw_info"), # Firmware information
548550
("libraries/nrf_security/index", "libraries/security/nrf_security/index"), # nRF Security (landing page in Security libraries)
549551
("libraries/nrf_security/doc/configuration", "libraries/security/nrf_security/doc/configuration"), # Configuration
550-
("libraries/nrf_security/doc/drivers", "libraries/security/nrf_security/doc/drivers"), # nRF Security drivers
551552
("libraries/nrf_security/doc/driver_config", "libraries/security/nrf_security/doc/driver_config"), # Feature configurations and driver support
552553
("libraries/nrf_security/doc/mbed_tls_header", "libraries/security/nrf_security/doc/mbed_tls_header"), # User-provided Mbed TLS configuration header
553554
("libraries/nrf_security/doc/backend_config", "libraries/security/nrf_security/doc/backend_config"), # Legacy configurations and supported features

doc/nrf/libraries/security/nrf_security/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ This library conforms to the specific revision of Mbed TLS that is supplied thro
2424
:maxdepth: 2
2525
:caption: Subpages:
2626

27-
doc/drivers
2827
doc/configuration
2928
doc/driver_config
3029
doc/backend_config

doc/nrf/links.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,6 +1561,7 @@
15611561

15621562
.. _`Platform Security Architecture (PSA)`: https://www.psacertified.org/what-is-psa-certified/
15631563
.. _`PSA Certified IoT Security Framework`: https://www.psacertified.org/what-is-psa-certified/using-psa-certified/
1564+
.. _`Embedded and IoT Security Specifications and Implementations`: https://www.psacertified.org/development-resources/building-in-security/specifications-implementations/
15641565
.. _`What is a Root of Trust?`: https://www.psacertified.org/blog/what-is-a-root-of-trust/
15651566
.. _`Device Attestation and Entity Attestation Tokens Explained`: https://www.psacertified.org/blog/what-is-an-entity-attestation-token/
15661567
.. _`PSA Certified development resources`: https://www.psacertified.org/development-resources/

doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ Developing with custom boards
117117
Security
118118
========
119119

120-
|no_changes_yet_note|
120+
* Added the new section about :ref:`ug_crypto_index`.
121+
The new section includes pages about :ref:`ug_crypto_architecture` (new page) and :ref:`crypto_drivers` (moved from :ref:`nrf_security` library).
121122

122123
Protocols
123124
=========
@@ -494,9 +495,14 @@ Gazell libraries
494495
Security libraries
495496
------------------
496497

497-
* :ref:`nrf_security_readme` library:
498+
* :ref:`nrf_security` library:
499+
500+
* Updated:
501+
502+
* The name of the Kconfig option ``CONFIG_PSA_USE_CRACEN_ASYMMETRIC_DRIVER`` to :kconfig:option:`CONFIG_PSA_USE_CRACEN_ASYMMETRIC_ENCRYPTION_DRIVER`, which is more descriptive and more consistent with the options of the other drivers.
503+
* The placement of the page about nRF Security drivers.
504+
The page was moved to :ref:`ug_crypto_index` and renamed to :ref:`crypto_drivers`.
498505

499-
* Renamed the ``CONFIG_PSA_USE_CRACEN_ASYMMETRIC_DRIVER`` Kconfig option to :kconfig:option:`CONFIG_PSA_USE_CRACEN_ASYMMETRIC_ENCRYPTION_DRIVER`, which is more descriptive and more consistent with the options of the other drivers.
500506

501507
Modem libraries
502508
---------------

doc/nrf/samples/crypto.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
.. _crypto_samples:
22

3-
Cryptography samples
4-
####################
3+
Cryptographic samples
4+
#####################
55

6-
This section lists the available |NCS| samples and tests for the :ref:`nrf_security` and the :ref:`nrfxlib:crypto`, two of the :ref:`security` features of the |NCS|.
6+
This section lists the available |NCS| samples and tests for the :ref:`cryptographic features in the nRF Connect SDK <ug_crypto_index>`.
7+
The samples use :ref:`nrf_security` and the :ref:`nrfxlib:crypto`.
78

89
.. include:: ../samples.rst
910
:start-after: samples_general_info_start

doc/nrf/security.rst

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,28 @@ Some of them are documented in detail in other parts of this documentation, whil
2828
| - :ref:`DFU libraries <lib_dfu>`
2929
| - :ref:`Software Updates for Internet of Things (SUIT) <ug_nrf54h20_suit_dfu>`
3030
| - :doc:`MCUboot <mcuboot:design>`
31-
* - Processing environments (CMSE)
32-
- The :ref:`boards supported by the SDK <app_boards_names>` distinguish entries according to which CPU is to be targeted (for multi-core SoCs) and whether Cortex-M Security Extensions (CMSE) are used or not.
33-
When CMSE is used, the firmware is split in accordance with the security by separation architecture principle to better protect sensitive assets and code.
34-
In the |NCS|, the CMSE support is implemented using Trusted Firmware-M (TF-M).
35-
- See :ref:`app_boards_spe_nspe`.
36-
- All samples and applications that support the ``*/ns`` :ref:`variant <app_boards_names>` of the boards.
31+
* - Cryptographic operations
32+
- The |NCS| follows the :ref:`PSA Crypto standard <ug_psa_certified_api_overview_crypto>` and provides :ref:`two different implementations <ug_crypto_architecture_implementation_standards>`, Oberon PSA Crypto and TF-M Crypto Service.
33+
The :ref:`nrf_security` library acts as an orchestrator for the different cryptographic libraries available in the system.
34+
HW accelerated libraries are prioritized over SW libraries when both are enabled.
35+
- :kconfig:option:`CONFIG_NRF_SECURITY` (:ref:`more info<psa_crypto_support>`)
36+
- | - :ref:`nrf_security` library
37+
| - :ref:`nrfxlib:crypto`
38+
| - :ref:`crypto_samples`
39+
| - :ref:`ug_nrf54l_cryptography`
3740
* - Trusted Firmware-M (TF-M)
3841
- TF-M is the reference implementation of `Platform Security Architecture (PSA)`_.
39-
On nRF5340, nRF54L and nRF91 Series devices, TF-M is used to configure and boot an application with :ref:`CMSE enabled <app_boards_spe_nspe_cpuapp_ns>`.
42+
On nRF5340, nRF54L and nRF91 Series devices, TF-M is used to configure and boot an application with :ref:`security by separation <app_boards_spe_nspe_cpuapp_ns>`.
4043
- See :ref:`ug_tfm`.
4144
- | - :ref:`tfm_samples`
4245
| - :ref:`crypto_samples`
4346
| - :zephyr:code-sample-category:`tfm_integration` in Zephyr
44-
* - Cryptographic operations (:ref:`nrf_security`)
45-
- The :ref:`nrf_security` library acts as an orchestrator for the different cryptographic libraries available in the system.
46-
HW accelerated libraries are prioritized over SW libraries when both are enabled.
47-
| Find more information on nRF54L Series-specific cryptography operations and the related configuration in :ref:`ug_nrf54l_cryptography`.
48-
- :kconfig:option:`CONFIG_NRF_SECURITY` (:ref:`more info<nrf_security_config>`)
49-
- | - :ref:`nrf_security` library with :ref:`nrf_security_drivers`
50-
| - :ref:`nrfxlib:crypto`
51-
| - :ref:`crypto_samples`
47+
* - Processing environments (CMSE)
48+
- The :ref:`boards supported by the SDK <app_boards_names>` distinguish entries according to which CPU is to be targeted (for multi-core SoCs) and whether Cortex-M Security Extensions (CMSE) are used or not.
49+
When CMSE is used, the firmware is split in accordance with the security by separation architecture principle to better protect sensitive assets and code.
50+
In the |NCS|, the CMSE support is implemented using Trusted Firmware-M (TF-M).
51+
- See :ref:`app_boards_spe_nspe`.
52+
- All samples and applications that support the ``*/ns`` :ref:`variant <app_boards_names>` of the boards.
5253
* - Trusted storage
5354
- The trusted storage library enables you to provide features like integrity, confidentiality and authenticity of the stored data, without using the TF-M Platform Root of Trust (PRoT).
5455
- See :ref:`trusted_storage_in_ncs` and :ref:`trusted storage library configuration <trusted_storage_configuration>`.
@@ -65,6 +66,7 @@ Some of them are documented in detail in other parts of this documentation, whil
6566
:caption: Subpages:
6667

6768
security/psa_certified_api_overview
68-
security/ap_protect
69+
security/crypto/index
6970
security/tfm/index
71+
security/ap_protect
7072
security/trusted_storage
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
.. _ug_crypto_architecture:
2+
3+
Cryptographic architecture overview
4+
###################################
5+
6+
.. contents::
7+
:local:
8+
:depth: 2
9+
10+
The cryptographic subsystem in the |NCS| is based on the `PSA Certified Crypto API`_ standard (PSA Crypto API), which is one of the `PSA Certified APIs <Embedded and IoT Security Specifications and Implementations_>`_.
11+
The PSA Crypto API is a cryptographic standard that offers a unified interface for cryptographic operations across different hardware platforms.
12+
13+
PSA Crypto API architecture
14+
***************************
15+
16+
The following figure shows the general architecture of PSA Crypto:
17+
18+
.. figure:: ../images/psa_crypto_api_arch.svg
19+
:alt: PSA Crypto standard architecture
20+
:align: center
21+
22+
PSA Crypto standard architecture
23+
24+
In this figure:
25+
26+
* Application calls the PSA Crypto implementation through the PSA Crypto API.
27+
* The PSA Crypto API implementation is an abstraction layer that manages cryptographic operations, key handling, and driver coordination.
28+
The implementations can be different, but they should all conform to the PSA Crypto specification.
29+
* Crypto driver is a specialized component that implements specific cryptographic algorithms or provides access to hardware accelerators.
30+
* Storage integration provides persistent and secure storage capabilities through standardized PSA Secure Storage APIs.
31+
It implements storage interfaces that allow the PSA Crypto implementation to securely store and retrieve keys, ensuring proper protection of sensitive material throughout its lifecycle.
32+
33+
.. _ug_crypto_architecture_interaction_flow:
34+
35+
Component interaction flow
36+
==========================
37+
38+
When an application makes a call to the PSA Crypto API, the following interaction flow occurs between the architecture components:
39+
40+
1. The application or protocol stack initiates a cryptographic operation by calling a function in the PSA Crypto API, such as ``psa_cipher_encrypt()`` or ``psa_sign_message()``.
41+
2. The PSA Crypto implementation receives the request and performs initial parameter validation to ensure the request is properly formatted and contains valid parameters.
42+
3. Based on the specific operation requested, the implementation selects the most appropriate crypto driver.
43+
Hardware drivers are typically prioritized when available, with software drivers serving as fallbacks.
44+
4. If the operation involves cryptographic keys, the implementation coordinates with the storage integration to securely retrieve the necessary key material.
45+
Keys are handled using `Key Identifiers`_ to maintain security and prevent direct exposure of key material to the application.
46+
5. The implementation delegates the actual cryptographic processing to the selected crypto driver.
47+
The driver performs the requested operation using either hardware acceleration or software algorithms.
48+
6. The driver returns the operation result to the PSA Crypto implementation, which performs any necessary post-processing and validation.
49+
7. The implementation returns the final result to the application through the PSA Crypto API, completing the cryptographic operation.
50+
51+
.. _ug_crypto_architecture_implementation_standards:
52+
53+
Implementations in the |NCS|
54+
****************************
55+
56+
The |NCS| follows the PSA Crypto standard through two major API implementations: Oberon PSA Crypto and TF-M Crypto Service.
57+
They are designed for use without and with Trusted Firmware-M (TF-M), respectively, and have different security requirements.
58+
Both are based on the `sdk-oberon-psa-crypto`_ library, which offers a lightweight PSA Crypto API implementation optimized for resource-constrained microcontrollers.
59+
60+
.. figure:: ../images/psa_crypto_api_overview.svg
61+
:alt: PSA Crypto API implementations in the |NCS|
62+
:align: center
63+
64+
PSA Crypto API implementations in the |NCS|
65+
66+
.. _ug_crypto_architecture_implementation_standards_oberon:
67+
68+
Oberon PSA Crypto implementation
69+
================================
70+
71+
The Oberon PSA Crypto implementation provides a direct PSA Crypto API interface for applications that do not require Trusted Firmware-M (TF-M).
72+
The Oberon PSA Crypto is a library that serves as the central component managing cryptographic operations and driver selection.
73+
74+
.. figure:: ../images/psa_crypto_api_oberon.svg
75+
:alt: Oberon PSA Crypto implementation
76+
:align: center
77+
78+
Oberon PSA Crypto implementation
79+
80+
The Oberon PSA Crypto acts as the implementation provider, directly exposing the PSA Crypto API to applications.
81+
Each driver can implement support for different subsets of cryptographic algorithms, providing software support for algorithms that hardware cannot support.
82+
83+
The following figure shows the driver library selection through the driver wrapper, one of the internal modules of Oberon PSA Crypto:
84+
85+
.. figure:: ../images/psa_certified_api_lib_selection.svg
86+
:alt: Oberon PSA Crypto driver library selection
87+
:align: center
88+
89+
Oberon PSA Crypto driver library selection
90+
91+
This implementation standard is suitable for applications that prioritize simplicity and do not require the additional security isolation provided by TF-M.
92+
It offers direct access to cryptographic functionality with minimal overhead, making it ideal for resource-constrained applications.
93+
94+
Storage integration for the Oberon PSA Crypto implementation
95+
------------------------------------------------------------
96+
97+
When using the Oberon PSA Crypto implementation, persistent keys from the PSA Crypto API can be stored in the |NCS| using one of the following storage mechanisms:
98+
99+
* Zephyr's :ref:`Secure storage <zephyr:secure_storage>` subsystem - Zephyr-specific implementation of the functions defined in the `PSA Certified Secure Storage API`_.
100+
* |NCS|'s :ref:`trusted_storage_readme` library - which provides features like integrity, confidentiality, and authenticity of the stored data without using the TF-M Platform Root of Trust (PRoT).
101+
102+
For more information about the storage integration for the Oberon PSA Crypto implementation, see :ref:`trusted_storage_in_ncs`.
103+
104+
.. _ug_crypto_architecture_implementation_standards_tfm:
105+
106+
TF-M Crypto Service implementation
107+
==================================
108+
109+
The TF-M Crypto Service implementation provides PSA Crypto API access through Trusted Firmware-M for applications that require enhanced security through hardware-enforced separation.
110+
111+
.. figure:: ../images/psa_crypto_api_tfm.svg
112+
:alt: TF-M Crypto Service implementation
113+
:align: center
114+
115+
TF-M Crypto Service implementation
116+
117+
This implementation leverages TF-M's Secure Processing Environment (SPE) to isolate cryptographic operations from the Non-Secure Processing Environment (NSPE).
118+
TF-M is built on top of TrustZone technology and isolates the PSA Crypto API as non-secure callable calls into a secure processing environment.
119+
120+
.. figure:: ../images/tfm_psa_crypto_api_nspe_spe.svg
121+
:alt: TF-M Crypto Service implementation in the NSPE and SPE
122+
:align: center
123+
124+
TF-M Crypto Service implementation in the NSPE and SPE
125+
126+
In this architecture, TF-M implements the secure cryptographic service using the existing Oberon PSA Core and its associated drivers within the secure environment.
127+
Cryptographic keys are stored and isolated in the SPE, ensuring they are not accessible by the application running in the NSPE.
128+
The same cryptographic drivers (nrf_cc3xx, nrf_oberon, and CRACEN) are available within the secure environment, providing consistent cryptographic capabilities.
129+
Additionally, TF-M integrates key storage using its internal mechanisms, offering secure key management through :ref:`Internal Trusted Storage <ug_tfm_services_its>` and :ref:`Protected Storage <tfm_partition_ps>`.
130+
131+
This implementation standard is mandatory for applications requiring PSA Certified security levels and provides the highest level of security through hardware-enforced isolation.
132+
It ensures that cryptographic operations and key material remain protected even if the non-secure application is compromised.
133+
134+
Storage integration for the TF-M Crypto Service implementation
135+
--------------------------------------------------------------
136+
137+
When using the TF-M Crypto Service implementation, keys from the PSA Crypto API are stored in the |NCS| using both of the following storage mechanisms:
138+
139+
* Internal Trusted Storage (ITS) - One of :ref:`ug_tfm_architecture_rot_services_platform` that provides secure storage within the Trusted Firmware-M environment.
140+
ITS is the only storage for persistent keys in the TF-M Crypto Service implementation.
141+
* Protected Storage (PS) - One of :ref:`ug_tfm_architecture_rot_services_application` that provides secure storage within the Trusted Firmware-M environment.
142+
143+
For more information about the storage integration for the TF-M Crypto Service implementation, see :ref:`ug_psa_certified_api_overview_secstorage` and :ref:`ug_tfm_services`.

0 commit comments

Comments
 (0)